From: Jarkko Hietaniemi Date: Tue, 5 Dec 2000 16:39:47 +0000 (+0000) Subject: Start migrating bits of pragma/utf8 to elsewhere X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9dc04555a4dee089737beb20cff84a725f3a5696;p=p5sagit%2Fp5-mst-13.2.git Start migrating bits of pragma/utf8 to elsewhere (since the long term plan is to obsolete 'use utf8'). p4raw-id: //depot/perl@7995 --- diff --git a/MANIFEST b/MANIFEST index 7da209e..4f30dd1 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1522,6 +1522,7 @@ t/op/inc.t See if inc/dec of integers near 32 bit limit work t/op/index.t See if index works t/op/int.t See if int works t/op/join.t See if join works +t/op/length.t See if length works t/op/lex_assign.t See if ops involving lexicals or pad temps work t/op/lfs.t See if large files work for perlio t/op/list.t See if array lists work diff --git a/t/op/length.t b/t/op/length.t new file mode 100644 index 0000000..ceb005e --- /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 60cbd8c..3d8693e 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++; - } -} -