Bytecode patching from Enache.
[p5sagit/p5-mst-13.2.git] / ext / B / t / bytecode.t
index 75fcf2e..e8f7d6b 100644 (file)
@@ -1,14 +1,23 @@
 #!./perl
 
 BEGIN {
+    if ($^O eq 'VMS') {
+       print "1..0 # skip - Bytecode/ByteLoader doesn't work on VMS\n";
+       exit 0;
+    }
     chdir 't' if -d 't';
     @INC = qw(../lib);
+    use Config;
+    if ($Config{ccflags} =~ /-DPERL_COPY_ON_WRITE/) {
+       print "1..0 # skip - no COW for now\n";
+       exit 0;
+    }
     require './test.pl'; # for run_perl()
 }
 use strict;
 
 my $test = 'bytecode.pl';
-END { 1 while unlink $test }
+END { 1 while unlink $test, "${test}c" }
 
 undef $/;
 my @tests = split /\n###+\n/, <DATA>;
@@ -22,10 +31,13 @@ for (@tests) {
     my ($script, $expect) = split />>>+\n/;
     $expect =~ s/\n$//;
     open T, ">$test"; print T $script; close T;
-    $got = run_perl(switches => "-MO=Bytecode,-H,-o$test",
+    $got = run_perl(switches => [ "-MO=Bytecode,-H,-o${test}c" ],
+                   verbose  => 0, # for debugging
+                   stderr   => 1, # to capture the "bytecode.pl syntax ok"
                    progfile => $test);
     unless ($?) {
-       $got = run_perl(progfile => $test);
+       1 while unlink($test); # nuke the .pl
+       $got = run_perl(progfile => "${test}c"); # run the .plc
        unless ($?) {
            if ($got =~ /^$expect$/) {
                print "ok $cnt\n";
@@ -97,10 +109,6 @@ my $i = 1;
 my $foo = sub {$i = shift if @_};
 &$foo(3);
 ############################################################
-$_="\xff\xff"; use utf8; utf8::encode $_; print $_
->>>>
-\xc3\xbf\xc3\xbf
-############################################################
 $x="Cannot use"; print index $x, "Can"
 >>>>
 0