From fe14fcc35f78a371a174a1d14256c2f35ae4262b Mon Sep 17 00:00:00 2001 From: Larry Wall Date: Thu, 21 Mar 1991 00:00:00 +0000 Subject: perl 4.0.00: (no release announcement available) So far, 4.0 is still a beta test version. For the last production version, look in pub/perl.3.0/kits@44. --- t/op/chop.t | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 t/op/chop.t (limited to 't/op/chop.t') diff --git a/t/op/chop.t b/t/op/chop.t new file mode 100644 index 0000000000..ba6d6262b3 --- /dev/null +++ b/t/op/chop.t @@ -0,0 +1,30 @@ +#!./perl + +# $Header: chop.t,v 4.0 91/03/20 01:51:42 lwall Locked $ + +print "1..4\n"; + +# optimized + +$_ = 'abc'; +$c = do foo(); +if ($c . $_ eq 'cab') {print "ok 1\n";} else {print "not ok 1 $c$_\n";} + +# unoptimized + +$_ = 'abc'; +$c = chop($_); +if ($c . $_ eq 'cab') {print "ok 2\n";} else {print "not ok 2\n";} + +sub foo { + chop; +} + +@foo = ("hi \n","there\n","!\n"); +@bar = @foo; +chop(@bar); +print join('',@bar) eq 'hi there!' ? "ok 3\n" : "not ok 3\n"; + +$foo = "\n"; +chop($foo,@foo); +print join('',$foo,@foo) eq 'hi there!' ? "ok 4\n" : "not ok 4\n"; -- cgit v1.2.1