From 9dc04555a4dee089737beb20cff84a725f3a5696 Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Tue, 5 Dec 2000 16:39:47 +0000 Subject: Start migrating bits of pragma/utf8 to elsewhere (since the long term plan is to obsolete 'use utf8'). p4raw-id: //depot/perl@7995 --- t/op/length.t | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ t/pragma/utf8.t | 71 +---------------------------------------------- 2 files changed, 86 insertions(+), 70 deletions(-) create mode 100644 t/op/length.t (limited to 't') diff --git a/t/op/length.t b/t/op/length.t new file mode 100644 index 0000000000..ceb005ecc4 --- /dev/null +++ b/t/op/length.t @@ -0,0 +1,85 @@ +#!./perl + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + +print "1..13\n"; + +print "not " unless length("") == 0; +print "ok 1\n"; + +print "not " unless length("abc") == 3; +print "ok 2\n"; + +$_ = "foobar"; +print "not " unless length() == 6; +print "ok 3\n"; + +# Okay, so that wasn't very challenging. Let's go Unicode. + +{ + my $a = "\x{41}"; + + print "not " unless length($a) == 1; + print "ok 4\n"; + $test++; + + use bytes; + print "not " unless $a eq "\x41" && length($a) == 1; + print "ok 5\n"; + $test++; +} + +{ + my $a = "\x{80}"; + + print "not " unless length($a) == 1; + print "ok 6\n"; + $test++; + + use bytes; + print "not " unless $a eq "\xc2\x80" && length($a) == 2; + print "ok 7\n"; + $test++; +} + +{ + my $a = "\x{100}"; + + print "not " unless length($a) == 1; + print "ok 8\n"; + $test++; + + use bytes; + print "not " unless $a eq "\xc4\x80" && length($a) == 2; + print "ok 9\n"; + $test++; +} + +{ + my $a = "\x{100}\x{80}"; + + print "not " unless length($a) == 2; + print "ok 10\n"; + $test++; + + use bytes; + print "not " unless $a eq "\xc4\x80\xc2\x80" && length($a) == 4; + print "ok 11\n"; + $test++; +} + +{ + my $a = "\x{80}\x{100}"; + + print "not " unless length($a) == 2; + print "ok 12\n"; + $test++; + + use bytes; + print "not " unless $a eq "\xc2\x80\xc4\x80" && length($a) == 4; + print "ok 13\n"; + $test++; +} diff --git a/t/pragma/utf8.t b/t/pragma/utf8.t index 60cbd8c97a..3d8693efc0 100755 --- a/t/pragma/utf8.t +++ b/t/pragma/utf8.t @@ -10,7 +10,7 @@ BEGIN { } } -print "1..191\n"; +print "1..181\n"; my $test = 1; @@ -734,72 +734,3 @@ __EOMK__ } } -{ - # tests 182..191 - - { - my $a = "\x{41}"; - - print "not " unless length($a) == 1; - print "ok $test\n"; - $test++; - - use bytes; - print "not " unless $a eq "\x41" && length($a) == 1; - print "ok $test\n"; - $test++; - } - - { - my $a = "\x{80}"; - - print "not " unless length($a) == 1; - print "ok $test\n"; - $test++; - - use bytes; - print "not " unless $a eq "\xc2\x80" && length($a) == 2; - print "ok $test\n"; - $test++; - } - - { - my $a = "\x{100}"; - - print "not " unless length($a) == 1; - print "ok $test\n"; - $test++; - - use bytes; - print "not " unless $a eq "\xc4\x80" && length($a) == 2; - print "ok $test\n"; - $test++; - } - - { - my $a = "\x{100}\x{80}"; - - print "not " unless length($a) == 2; - print "ok $test\n"; - $test++; - - use bytes; - print "not " unless $a eq "\xc4\x80\xc2\x80" && length($a) == 4; - print "ok $test\n"; - $test++; - } - - { - my $a = "\x{80}\x{100}"; - - print "not " unless length($a) == 2; - print "ok $test\n"; - $test++; - - use bytes; - print "not " unless $a eq "\xc2\x80\xc4\x80" && length($a) == 4; - print "ok $test\n"; - $test++; - } -} - -- cgit v1.2.1