summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorGisle Aas <gisle@aas.no>2001-05-18 00:55:25 -0700
committerJarkko Hietaniemi <jhi@iki.fi>2001-05-20 10:57:00 +0000
commit9b33ce3b1592d0c13aec55cf7c63e0b9253b6b22 (patch)
tree2825f65aaca1384f881a7f20d05d87a6cb759a87 /t
parente9fd7a0eb5d53105494ad0f7f42d2975607b8d82 (diff)
downloadperl-9b33ce3b1592d0c13aec55cf7c63e0b9253b6b22.tar.gz
Chomp should not always stringify
Message-ID: <lrk83eogf6.fsf@caliper.ActiveState.com> p4raw-id: //depot/perl@10161
Diffstat (limited to 't')
-rwxr-xr-xt/op/chop.t12
1 files changed, 11 insertions, 1 deletions
diff --git a/t/op/chop.t b/t/op/chop.t
index 1b55f11832..e8b777eb6a 100755
--- a/t/op/chop.t
+++ b/t/op/chop.t
@@ -1,6 +1,6 @@
#!./perl
-print "1..37\n";
+print "1..41\n";
# optimized
@@ -116,3 +116,13 @@ print chop(@stuff[0, 2]) eq 'f' ? "ok 36\n" : "not ok 36\n";
my %stuff = (1..4);
print chop(@stuff{1, 3}) eq '4' ? "ok 37\n" : "not ok 37\n";
+
+# chomp should not stringify references unless it decides to modify them
+$_ = [];
+$/ = "\n";
+print chomp() == 0 ? "ok 38\n" : "not ok 38\n";
+print ref($_) eq "ARRAY" ? "ok 39\n" : "not ok 39\n";
+
+$/ = ")"; # the last char of something like "ARRAY(0x80ff6e4)"
+print chomp() == 1 ? "ok 40\n" : "not ok 40\n";
+print !ref($_) ? "ok 41\n" : "not ok 41\n";