cvsuser 04/11/15 02:31:04
Modified: t/op gc.t
t/pmc exception.t
Log:
use lexicals for failing tests
Revision Changes Path
1.22 +41 -22 parrot/t/op/gc.t
Index: gc.t
===================================================================
RCS file: /cvs/public/parrot/t/op/gc.t,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- gc.t 12 Nov 2004 15:09:14 -0000 1.21
+++ gc.t 15 Nov 2004 10:31:03 -0000 1.22
@@ -1,6 +1,6 @@
#! perl -w
# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-# $Id: gc.t,v 1.21 2004/11/12 15:09:14 leo Exp $
+# $Id: gc.t,v 1.22 2004/11/15 10:31:03 leo Exp $
=head1 NAME
@@ -352,24 +352,35 @@
newsub fail, .Closure, _fail
store_lex "fail", fail
arr1 = new PerlArray
+ store_lex 0, "arr1", arr1
arr1[0] = 1
arr1[1] = 3
arr1[2] = 5
arr2 = new PerlArray
+ store_lex 0, "arr2", arr2
arr2[0] = 1
arr2[1] = 5
arr2[2] = 9
x = choose(arr1)
+ store_lex 0, "x", x
#print "Chosen "
#print x
#print " from arr1\n"
- # XXX need this these closures have different state
+
+ # need to create a new closure: these closures have different state
+ #
+ # arr2 and x,y have to be lexicals as due to continuations
+ # all variables needs refetching after a subroutine call
+
newsub choose, .Closure, _choose
+ arr2 = find_lex "arr2"
y = choose(arr2)
+ store_lex 0, "y", y
#print "Chosen "
#print y
#print " from arr2\n"
+ x = find_lex "x"
$I1 = x
$I2 = y
$I0 = $I1 * $I2
@@ -379,6 +390,8 @@
print "Shouldn't get here without a failure report\n"
branch the_end
success:
+ x = find_lex "x"
+ y = find_lex "y"
print x
print " * "
print y
@@ -454,30 +467,36 @@
# this did segfault with GC_DEBUG
.sub main @MAIN
- .local int n
- $P0 = getinterp
- $P0."recursion_limit"(10)
- newclass $P0, "b"
- $I0 = find_type "b"
- $P0 = new $I0
- n = $P0."b11"(0)
- print "ok 1\n"
- print n
- print "\n"
+ .local pmc n
+ new_pad 0
+ $P0 = getinterp
+ $P0."recursion_limit"(10)
+ newclass $P0, "b"
+ $I0 = find_type "b"
+ $P0 = new $I0
+ $P1 = new Integer
+ $P1 = 0
+ n = $P0."b11"($P1)
+ print "ok 1\n"
+ print n
+ print "\n"
.end
.namespace ["b"]
.sub b11 method
- .param int n
- .local int n1
- n1 = n + 1
- newsub $P0, .Exception_Handler, catch
- set_eh $P0
- n = self."b11"(n1)
- clear_eh
+ .param pmc n
+ .local pmc n1
+ new_pad -1
+ store_lex -1, "n", n
+ n1 = new Integer
+ n1 = n + 1
+ newsub $P0, .Exception_Handler, catch
+ set_eh $P0
+ n = self."b11"(n1)
+ store_lex -1, "n", n
+ clear_eh
catch:
- .pcc_begin_return
- .return n
- .pcc_end_return
+ n = find_lex "n"
+ .return(n)
.end
CODE
ok 1
1.13 +29 -21 parrot/t/pmc/exception.t
Index: exception.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/exception.t,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- exception.t 12 Nov 2004 15:09:15 -0000 1.12
+++ exception.t 15 Nov 2004 10:31:04 -0000 1.13
@@ -1,6 +1,6 @@
#! perl -w
# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-# $Id: exception.t,v 1.12 2004/11/12 15:09:15 leo Exp $
+# $Id: exception.t,v 1.13 2004/11/15 10:31:04 leo Exp $
=head1 NAME
@@ -527,31 +527,39 @@
output_is(<<'CODE', <<'OUTPUT', "set recursion limit, method call ");
##PIR##
+# see also t/op/gc_14.imc
+
.sub main @MAIN
- .local int n
- $P0 = getinterp
- $P0."recursion_limit"(100)
- newclass $P0, "b"
- $I0 = find_type "b"
- $P0 = new $I0
- n = $P0."b11"(0)
- print "ok 1\n"
- print n
- print "\n"
+ .local pmc n
+ new_pad 0
+ $P0 = getinterp
+ $P0."recursion_limit"(100)
+ newclass $P0, "b"
+ $I0 = find_type "b"
+ $P0 = new $I0
+ $P1 = new Integer
+ $P1 = 0
+ n = $P0."b11"($P1)
+ print "ok 1\n"
+ print n
+ print "\n"
.end
.namespace ["b"]
.sub b11 method
- .param int n
- .local int n1
- n1 = n + 1
- newsub $P0, .Exception_Handler, catch
- set_eh $P0
- n = self."b11"(n1)
- clear_eh
+ .param pmc n
+ .local pmc n1
+ new_pad -1
+ store_lex -1, "n", n
+ n1 = new Integer
+ n1 = n + 1
+ newsub $P0, .Exception_Handler, catch
+ set_eh $P0
+ n = self."b11"(n1)
+ store_lex -1, "n", n
+ clear_eh
catch:
- .pcc_begin_return
- .return n
- .pcc_end_return
+ n = find_lex "n"
+ .return(n)
.end
CODE
ok 1