[svn:parrot] r43638 - branches/kill_array_pmc/t/pmc

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Fri Jan 29 15:47:07 UTC 2010


Author: whiteknight
Date: Fri Jan 29 15:47:07 2010
New Revision: 43638
URL: https://trac.parrot.org/parrot/changeset/43638

Log:
fix failure on t/pmc/exception-old.t that caused test to hang. While I was at it, converted the test from Perl/PASM to PIR and moved to exception.t

Modified:
   branches/kill_array_pmc/t/pmc/exception-old.t
   branches/kill_array_pmc/t/pmc/exception.t

Modified: branches/kill_array_pmc/t/pmc/exception-old.t
==============================================================================
--- branches/kill_array_pmc/t/pmc/exception-old.t	Fri Jan 29 15:10:20 2010	(r43637)
+++ branches/kill_array_pmc/t/pmc/exception-old.t	Fri Jan 29 15:47:07 2010	(r43638)
@@ -6,7 +6,7 @@
 use warnings;
 use lib qw( . lib ../lib ../../lib );
 use Test::More;
-use Parrot::Test tests => 28;
+use Parrot::Test tests => 27;
 
 =head1 NAME
 
@@ -52,61 +52,6 @@
 just pining
 OUTPUT
 
-pasm_output_is( <<'CODE', <<'OUTPUT', "exception attributes" );
-    print "main\n"
-    push_eh handler
-    new P1, ['Exception']
-    new P2, ['String']
-    set P2, "just pining"
-    setattribute P1, 'message', P2
-    new P3, ['Integer']
-    set P3, 5
-    setattribute P1, 'severity', P3
-    new P4, ['String']
-    set P4, "additional payload"
-    setattribute P1, 'payload', P4
-    new P5, ['Array']
-    set P5, 2
-    set P5[0], 'backtrace line 1'
-    set P5[1], 'backtrace line 2'
-    setattribute P1, 'backtrace', P5
-
-    throw P1
-    print "not reached\n"
-    end
-handler:
-    get_results "0", P0
-    set S0, P0
-    print "caught it\n"
-    getattribute P16, P0, 'message'
-    print P16
-    print "\n"
-    getattribute P17, P0, 'severity'
-    print P17
-    print "\n"
-    getattribute P18, P0, 'payload'
-    print P18
-    print "\n"
-    getattribute P19, P0, 'backtrace'
-    set P20, P19[0]
-    print P20
-    print "\n"
-    set P20, P19[1]
-    print P20
-    print "\n"
-    null P5
-    end
-
-CODE
-main
-caught it
-just pining
-5
-additional payload
-backtrace line 1
-backtrace line 2
-OUTPUT
-
 pir_output_is( <<'CODE', <<'OUTPUT', 'Exception initialized with String' );
 .sub main :main
   .local pmc ex, exr

Modified: branches/kill_array_pmc/t/pmc/exception.t
==============================================================================
--- branches/kill_array_pmc/t/pmc/exception.t	Fri Jan 29 15:10:20 2010	(r43637)
+++ branches/kill_array_pmc/t/pmc/exception.t	Fri Jan 29 15:47:07 2010	(r43638)
@@ -18,10 +18,11 @@
 
 .sub main :main
     .include 'test_more.pir'
-    plan( 14 )
+    plan( 19 )
     test_bool()
     test_int()
     test_attrs()
+    test_attributes()
     test_push_pop_eh()
     test_push_pop_eh_long()
     test_push_eh_throw()
@@ -45,7 +46,7 @@
     die 3, 100
     say "not reached"
     .return()
-handler:
+  handler:
     ok(1,'die works')
 .end
 
@@ -90,7 +91,7 @@
     set_addr $P0, _handler
     ok($P0,'ExceptionHandler objects return true')
     .return()
-_handler:
+  _handler:
     say "howdy bool!"
 .end
 
@@ -101,7 +102,7 @@
     $I0 = $P0
     ok(1,'get_integer on ExceptionHandler ')
     .return()
-_handler:
+  _handler:
     say "howdy int!"
 .end
 
@@ -110,7 +111,7 @@
     set_addr $P0, _handler
     push_eh $P0
     throw $P0
-_handler:
+  _handler:
     get_results "0", $P0
     getattribute $P1, $P0, 'type'
     ok(1,'got type')
@@ -129,6 +130,47 @@
     ok($I0, "Can't fetch non-existent attribute")
 .end
 
+.sub test_attributes
+    push_eh handler
+    $P1 = new ['Exception']
+    $P2 = new ['String']
+    $P2 = "just pining"
+    setattribute $P1, 'message', $P2
+    $P3 = new ['Integer']
+    $P3 = 5
+    setattribute $P1, 'severity', $P3
+    $P4 = new ['String']
+    $P4 = "additional payload"
+    setattribute $P1, 'payload', $P4
+    $P5 = new ['ResizablePMCArray']
+    $P5 = 2
+    $P5[0] = 'backtrace line 1'
+    $P5[1] = 'backtrace line 2'
+    setattribute $P1, 'backtrace', $P5
+
+    throw $P1
+    is(0, "throwing exception failed")
+    .return()
+  handler:
+    .get_results($P0)
+
+    $P16 = getattribute $P0, 'message'
+    is($P16, "just pining")
+
+    $P17 = getattribute $P0, 'severity'
+    is($P17, 5)
+
+    $P18 = getattribute $P0, 'payload'
+    is($P18, "additional payload")
+
+    $P19 = getattribute $P0, 'backtrace'
+    $P20 = $P19[0]
+    is($P20, "backtrace line 1")
+
+    $P20 = $P19[1]
+    is($P20, "backtrace line 2")
+.end
+
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4


More information about the parrot-commits mailing list