cvsuser 01/12/19 16:13:14
Modified: . core.ops
t/op stacks.t
Log:
Added tests for entrytype op, noticed that asking for type of entry at
depth causes segfault as stack is zero based, fixed cmp in core.ops to
reflect this. Last test is skipped as we don't do exceptions right yet.
Revision Changes Path
1.52 +1 -1 parrot/core.ops
Index: core.ops
===================================================================
RCS file: /home/perlcvs/parrot/core.ops,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -w -r1.51 -r1.52
--- core.ops 18 Dec 2001 07:05:00 -0000 1.51
+++ core.ops 20 Dec 2001 00:13:13 -0000 1.52
@@ -2059,7 +2059,7 @@
INTVAL depth;
struct Stack_Entry *entry;
depth = stack_depth(interpreter, interpreter->user_stack_base);
- if (depth < $2) {
+ if (depth <= $2) {
INTERNAL_EXCEPTION(99, "Stack Depth wrong");
}
1.9 +51 -1 parrot/t/op/stacks.t
Index: stacks.t
===================================================================
RCS file: /home/perlcvs/parrot/t/op/stacks.t,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -r1.8 -r1.9
--- stacks.t 12 Dec 2001 05:09:53 -0000 1.8
+++ stacks.t 20 Dec 2001 00:13:14 -0000 1.9
@@ -1,6 +1,6 @@
#! perl -w
-use Parrot::Test tests => 16;
+use Parrot::Test tests => 18;
# Tests for stack operations, currently push*, push_*_c and pop*
# where * != p.
@@ -385,6 +385,56 @@
never to escape
OUTPUT
+output_is(<<CODE, <<OUTPUT, "entrytype");
+ set I0, 12
+ set N0, 0.1
+ set S0, "Difference Engine #2"
+ new P0, PerlString
+ set P0, "Shalmaneser"
+
+ save P0
+ save S0
+ save "Wintermute"
+ save N0
+ save 1.23
+ save I0
+ save 12
+
+ print "starting\\n"
+
+ set I1, 0
+LOOP: entrytype I0, I1
+ print I0
+ print "\\n"
+ inc I1
+ lt I1, 7, LOOP
+
+ print "done\\n"
+ end
+CODE
+starting
+1
+1
+2
+2
+3
+3
+4
+done
+OUTPUT
+
+SKIP: { skip("Await exceptions", 1);
+# this should throw an exception...
+output_is(<<CODE, <<OUTPUT, "entrytype, beyond stack depth");
+ save 12
+ print "ready\\n"
+ entrytype I0, 1
+ print "done\\n"
+CODE
+ready
+Stack Depth Wrong
+OUTPUT
+}
##############################