integrate cfgperl contents into mainline
[p5sagit/p5-mst-13.2.git] / t / op / quotemeta.t
index 0979457..60e5b7b 100755 (executable)
@@ -1,15 +1,33 @@
 #!./perl
+
+BEGIN {
+    chdir 't' if -d 't';
+    unshift @INC, '../lib' if -d '../lib';
+    require Config; import Config;
+}
+
 print "1..15\n";
 
-$_=join "", grep $_=chr($_), 32..127;
+if ($Config{ebcdic} eq 'define') {
+    $_=join "", map chr($_), 129..233;
+
+    # 105 characters - 52 letters = 53 backslashes
+    # 105 characters + 53 backslashes = 158 characters
+    $_=quotemeta $_;
+    if ( length == 158 ){print "ok 1\n"} else {print "not ok 1\n"}
+    # 104 non-backslash characters
+    if (tr/\\//cd == 104){print "ok 2\n"} else {print "not ok 2\n"}
+} else { # some ASCII descendant, then.
+    $_=join "", map chr($_), 32..127;
 
-#95 characters - 52 letters - 10 digits = 33 backslashes
-#95 characters + 33 backslashes = 128 characters
-$_=quotemeta $_;
-if ( length == 128 ){print "ok 1\n"} else {print "not ok 1\n"}
-if (tr/\\//cd == 94){print "ok 2\n"} else {print "not ok 2\n"}
+    # 96 characters - 52 letters - 10 digits - 1 underscore = 33 backslashes
+    # 96 characters + 33 backslashes = 129 characters
+    $_=quotemeta $_;
+    if ( length == 129 ){print "ok 1\n"} else {print "not ok 1\n"}
+    # 95 non-backslash characters
+    if (tr/\\//cd == 95){print "ok 2\n"} else {print "not ok 2\n"}
+}
 
-#perl5a11 bus errors on this:
 if (length quotemeta "" == 0){print "ok 3\n"} else {print "not ok 3\n"}
 
 print "aA\UbB\LcC\EdD" eq "aABBccdD" ? "ok 4\n" : "not ok 4 \n";