diff options
author | Michael G. Schwern <schwern@pobox.com> | 2001-09-01 10:06:28 -0400 |
---|---|---|
committer | Artur Bergman <sky@nanisky.com> | 2001-09-01 17:19:30 +0000 |
commit | 0dee299505be854b55f6a69aa322f436217cfe87 (patch) | |
tree | 2f6efd82c7453079dc382cfa39836b71977d3844 /t/op/concat.t | |
parent | 13a704ac64c9ed54ec92d50031172f7eed309d3b (diff) | |
download | perl-0dee299505be854b55f6a69aa322f436217cfe87.tar.gz |
cleanup
Message-ID: <20010901140628.C606@blackrider>
p4raw-id: //depot/perl@11812
Diffstat (limited to 't/op/concat.t')
-rw-r--r-- | t/op/concat.t | 68 |
1 files changed, 30 insertions, 38 deletions
diff --git a/t/op/concat.t b/t/op/concat.t index 5ae7da51b9..4813690d6b 100644 --- a/t/op/concat.t +++ b/t/op/concat.t @@ -5,22 +5,28 @@ BEGIN { @INC = '../lib'; } -print "1..11\n"; +# This ok() function is specially written to avoid any concatenation. +my $test = 1; +sub ok { + my($ok, $name) = @_; -($a, $b, $c) = qw(foo bar); + printf "%sok %d - %s\n", ($ok ? "" : "not "), $test, $name; -print "not " unless "$a" eq "foo"; -print "ok 1\n"; + printf "# Failed test at line %d\n", (caller)[2] unless $ok; -print "not " unless "$a$b" eq "foobar"; -print "ok 2\n"; + $test++; + return $ok; +} -print "not " unless "$c$a$c" eq "foo"; -print "ok 3\n"; +print "1..12\n"; -# Okay, so that wasn't very challenging. Let's go Unicode. +($a, $b, $c) = qw(foo bar); + +ok("$a" eq "foo", "verifying assign"); +ok("$a$b" eq "foobar", "basic concatenation"); +ok("$c$a$c" eq "foo", "concatenate undef, fore and aft"); -my $test = 4; +# Okay, so that wasn't very challenging. Let's go Unicode. { # bug id 20000819.004 @@ -28,26 +34,20 @@ my $test = 4; $_ = $dx = "\x{10f2}"; s/($dx)/$dx$1/; { - print "not " unless $_ eq "$dx$dx"; - print "ok $test\n"; - $test++; + ok($_ eq "$dx$dx","bug id 20000819.004, back"); } $_ = $dx = "\x{10f2}"; s/($dx)/$1$dx/; { - print "not " unless $_ eq "$dx$dx"; - print "ok $test\n"; - $test++; + ok($_ eq "$dx$dx","bug id 20000819.004, front"); } $dx = "\x{10f2}"; $_ = "\x{10f2}\x{10f2}"; s/($dx)($dx)/$1$2/; { - print "not " unless $_ eq "$dx$dx"; - print "ok $test\n"; - $test++; + ok($_ eq "$dx$dx","bug id 20000819.004, front and back"); } } @@ -57,9 +57,9 @@ my $test = 4; my $a; $a .= "\x{1ff}"; - print "not " unless $a eq "\x{1ff}"; - print "ok $test\n"; - $test++; + ok($a eq "\x{1ff}", "bug id 20000901.092, undef left"); + $a .= undef; + ok($a eq "\x{1ff}", "bug id 20000901.092, undef right"); } { @@ -69,29 +69,21 @@ my $test = 4; # Without the fix this 5.7.0 would croak: # Modification of a read-only value attempted at ... - "$2\x{1234}"; - - print "ok $test\n"; - $test++; + eval {"$2\x{1234}"}; + ok(!$@, "bug id 20001020.006, left"); # For symmetry with the above. - "\x{1234}$2"; - - print "ok $test\n"; - $test++; + eval {"\x{1234}$2"}; + ok(!$@, "bug id 20001020.006, right"); *pi = \undef; # This bug existed earlier than the $2 bug, but is fixed with the same # patch. Without the fix this 5.7.0 would also croak: # Modification of a read-only value attempted at ... - "$pi\x{1234}"; - - print "ok $test\n"; - $test++; + eval{"$pi\x{1234}"}; + ok(!$@, "bug id 20001020.006, constant left"); # For symmetry with the above. - "\x{1234}$pi"; - - print "ok $test\n"; - $test++; + eval{"\x{1234}$pi"}; + ok(!$@, "bug id 20001020.006, constant right"); } |