diff options
Diffstat (limited to 't/op')
-rwxr-xr-x | t/op/each.t | 4 | ||||
-rw-r--r-- | t/op/length.t | 2 | ||||
-rwxr-xr-x | t/op/pack.t | 41 | ||||
-rw-r--r-- | t/op/qu.t | 36 |
4 files changed, 5 insertions, 78 deletions
diff --git a/t/op/each.t b/t/op/each.t index 397176a40d..2e80dcd009 100755 --- a/t/op/each.t +++ b/t/op/each.t @@ -163,7 +163,7 @@ print "ok 23\n"; print "#$u{$_}\n" for keys %u; # Used to core dump before change #8056. print "ok 24\n"; -$d = qu"\xe3\x81\x82"; +$d = pack("U*", 0xe3, 0x81, 0x82); %u = ($d => "downgrade"); for (keys %u) { use bytes; @@ -172,6 +172,6 @@ for (keys %u) { } { use bytes; - print "not " if length($d) ne 6 or $d ne qu"\xe3\x81\x82"; + print "not " if length($d) ne 6; print "ok 26\n"; } diff --git a/t/op/length.t b/t/op/length.t index 46f0c59698..df80fcd039 100644 --- a/t/op/length.t +++ b/t/op/length.t @@ -33,7 +33,7 @@ print "ok 3\n"; } { - my $a = qu"\x{80}"; # make "\x{80}" to produce UTF-8 + my $a = pack("U", 0x80); print "not " unless length($a) == 1; print "ok 6\n"; diff --git a/t/op/pack.t b/t/op/pack.t index 3483597fbe..67bd547c5b 100755 --- a/t/op/pack.t +++ b/t/op/pack.t @@ -6,7 +6,7 @@ BEGIN { require Config; import Config; } -print "1..163\n"; +print "1..159\n"; $format = "c2 x5 C C x s d i l a6"; # Need the expression in here to force ary[5] to be numeric. This avoids @@ -22,13 +22,7 @@ $out2=join(':',@ary2); # Using long double NVs may introduce greater accuracy than wanted. $out1 =~ s/:9\.87654321097999\d*:/:9.87654321098:/; $out2 =~ s/:9\.87654321097999\d*:/:9.87654321098:/; -if ($out1 eq $out2) { - print "ok 2\n"; -} else { - print "# out1: $out1\n"; - print "# out2: $out2\n"; - print "not ok 2\n"; -} +print ($out1 eq $out2? "ok 2\n" : "not ok 2\n"); print ($foo =~ /def/ ? "ok 3\n" : "not ok 3\n"); @@ -413,8 +407,6 @@ $z = pack <<EOP,'string','etc'; EOP print 'not ' unless $z eq "\000\006string\003etc"; print "ok $test\n"; $test++; -# 157..169: ??? - print 'not ' unless "1.20.300.4000" eq sprintf "%vd", pack("U*",1,20,300,4000); print "ok $test\n"; $test++; print 'not ' unless "1.20.300.4000" eq @@ -424,32 +416,3 @@ print 'not ' unless v1.20.300.4000 ne sprintf "%vd", pack("C0U*",1,20,300,4000); print "ok $test\n"; $test++; -# 160: unpack("C") and ord() equivalence for Unicode - -print "not " unless unpack("C", chr(0x100)) eq ord(chr(0x100)) && - ord(chr(0x100)) == 0x100; -print "ok $test\n"; $test++; - -# 161: use bytes + unpack C == UTF-8 unraveling - -{ - use bytes; - my @bytes = unpack("C*", pack("U", 0x100)); - print "not " unless "@bytes" eq "196 128"; - print "ok $test\n"; $test++; -} - -# 162: pack C > 255 - -print "not " unless ord(pack("C", 0x100)) == 0x100; -print "ok $test\n"; $test++; - -# 163: pack C > 255 + use bytes == wraparound - -{ - use bytes; - - print "not " unless ord(pack("C", 0x100 + 0xab)) == 0xab; - print "ok $test\n"; $test++; -} - diff --git a/t/op/qu.t b/t/op/qu.t deleted file mode 100644 index c24b507022..0000000000 --- a/t/op/qu.t +++ /dev/null @@ -1,36 +0,0 @@ -print "1..6\n"; - - -BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; -} - -my $foo = "foo"; - -print "not " unless qu(abc$foo) eq "abcfoo"; -print "ok 1\n"; - -# qu is always Unicode, even in EBCDIC, so \x41 is 'A' and \x{61} is 'a'. - -print "not " unless qu(abc\x41) eq "abcA"; -print "ok 2\n"; - -print "not " unless qu(abc\x{61}$foo) eq "abcafoo"; -print "ok 3\n"; - -print "not " unless qu(\x{41}\x{100}\x61\x{200}) eq "A\x{100}a\x{200}"; -print "ok 4\n"; - -{ - -use bytes; - -print "not " unless join(" ", unpack("C*", qu(\x80))) eq "194 128"; -print "ok 5\n"; - -print "not " unless join(" ", unpack("C*", qu(\x{100}))) eq "196 128"; -print "ok 6\n"; - -} - |