summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2000-12-05 16:39:47 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2000-12-05 16:39:47 +0000
commit9dc04555a4dee089737beb20cff84a725f3a5696 (patch)
treeda47734a803d73165d2571d6a95a8207debe7e6c
parentfbb63a9e8bf07b6f1dccaccb6b70a9ad58efc968 (diff)
downloadperl-9dc04555a4dee089737beb20cff84a725f3a5696.tar.gz
Start migrating bits of pragma/utf8 to elsewhere
(since the long term plan is to obsolete 'use utf8'). p4raw-id: //depot/perl@7995
-rw-r--r--MANIFEST1
-rw-r--r--t/op/length.t85
-rwxr-xr-xt/pragma/utf8.t71
3 files changed, 87 insertions, 70 deletions
diff --git a/MANIFEST b/MANIFEST
index 7da209ef0f..4f30dd12ff 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 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++;
- }
-}
-