Hi,
the following patch adds 4 more tests to t/pmc/sub.t
One of the new tests ('load_bytecode @LOAD second sub - imc') is currently
failing.
(The patch also removes a redundant assignment of $temp)
jens
Index: t/pmc/sub.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/sub.t,v
retrieving revision 1.39
diff -u -w -r1.39 sub.t
--- t/pmc/sub.t 8 Mar 2004 00:20:09 -0000 1.39
+++ t/pmc/sub.t 11 Mar 2004 19:11:23 -0000
@@ -17,7 +17,7 @@
=cut
-use Parrot::Test tests => 66;
+use Parrot::Test tests => 70;
use Test::More;
use Parrot::Config;
@@ -769,7 +769,6 @@
ok
OUT
-$temp = "temp.pasm";
open S, ">$temp" or die "Can't write $temp";
print S <<'EOF';
.pcc_sub @LOAD _sub1:
@@ -790,6 +789,28 @@
back
OUTPUT
+open S, ">$temp" or die "Can't write $temp";
+print S <<'EOF';
+ .pcc_sub _error:
+ print "error\n"
+ .pcc_sub @LOAD _sub1:
+ print "in sub1\n"
+ invoke P1
+EOF
+close S;
+
+output_is(<<'CODE', <<'OUTPUT', 'load_bytecode @LOAD second sub');
+.pcc_sub _main:
+ print "main\n"
+ load_bytecode "temp.pasm"
+ print "back\n"
+ end
+CODE
+main
+in sub1
+back
+OUTPUT
+
system(".$PConfig{slash}parrot$PConfig{exe} -o temp.pbc $temp");
output_is(<<'CODE', <<'OUTPUT', 'load_bytecode @LOAD in pbc');
@@ -1051,3 +1072,74 @@
unlink($temp, 'temp.pbc');
+$temp = "temp.imc";
+open S, ">$temp" or die "Can't write $temp";
+print S <<'EOF';
+.emit
+ .pcc_sub @LOAD _sub1:
+ print "in sub1\n"
+ invoke P1
+.eom
+EOF
+close S;
+
+output_is(<<'CODE', <<'OUTPUT', 'load_bytecode @LOAD first sub - imc');
+.pcc_sub _main:
+ print "main\n"
+ load_bytecode "temp.imc"
+ print "back\n"
+ end
+CODE
+main
+in sub1
+back
+OUTPUT
+
+open S, ">$temp" or die "Can't write $temp";
+print S <<'EOF';
+.emit
+ .pcc_sub _foo:
+ print "error\n"
+ .pcc_sub @LOAD _sub1:
+ print "in sub1\n"
+ invoke P1
+.eom
+EOF
+close S;
+
+output_is(<<'CODE', <<'OUTPUT', 'load_bytecode @LOAD second sub - imc');
+.pcc_sub _main:
+ print "main\n"
+ load_bytecode "temp.imc"
+ print "back\n"
+ end
+CODE
+main
+in sub1
+back
+OUTPUT
+
+open S, ">$temp" or die "Can't write $temp";
+print S <<'EOF';
+.emit
+ .pcc_sub _foo:
+ print "error\n"
+ .pcc_sub _sub1:
+ print "in sub1\n"
+ invoke P1
+.eom
+EOF
+close S;
+
+output_is(<<'CODE', <<'OUTPUT', 'load_bytecode no @LOAD - imc');
+.pcc_sub _main:
+ print "main\n"
+ load_bytecode "temp.imc"
+ print "back\n"
+ end
+CODE
+main
+back
+OUTPUT
+
+unlink($temp);