[svn:parrot] r38435 - branches/pmc_pct/compilers/pmc/t

cotto at svn.parrot.org cotto at svn.parrot.org
Sat May 2 03:59:15 UTC 2009


Author: cotto
Date: Sat May  2 03:59:12 2009
New Revision: 38435
URL: https://trac.parrot.org/parrot/changeset/38435

Log:
[t] refactor test_parse_one to return a value rather than running ok() directly

Modified:
   branches/pmc_pct/compilers/pmc/t/01-parse.t
   branches/pmc_pct/compilers/pmc/t/02-parse-all-pmcs.t
   branches/pmc_pct/compilers/pmc/t/common.pir

Modified: branches/pmc_pct/compilers/pmc/t/01-parse.t
==============================================================================
--- branches/pmc_pct/compilers/pmc/t/01-parse.t	Sat May  2 03:40:20 2009	(r38434)
+++ branches/pmc_pct/compilers/pmc/t/01-parse.t	Sat May  2 03:59:12 2009	(r38435)
@@ -3,8 +3,9 @@
 .include 't/common.pir'
 
 .sub 'main' :main
-.include 'test_more.pir'
-load_bytecode 'pmc.pbc'
+
+    .include 'test_more.pir'
+    load_bytecode 'pmc.pbc'
 
     .local int total
     total = 25
@@ -21,7 +22,8 @@
     $P0 = new 'ResizablePMCArray'
     push $P0, i
     $S0 = sprintf "t/data/class%02d.pmc", $P0
-    test_parse_one($S0)
+    $S1 = test_parse_one($S0)
+    is($S1, '', $S0)
     inc i
     unless i >= total goto loop
 

Modified: branches/pmc_pct/compilers/pmc/t/02-parse-all-pmcs.t
==============================================================================
--- branches/pmc_pct/compilers/pmc/t/02-parse-all-pmcs.t	Sat May  2 03:40:20 2009	(r38434)
+++ branches/pmc_pct/compilers/pmc/t/02-parse-all-pmcs.t	Sat May  2 03:59:12 2009	(r38435)
@@ -3,8 +3,9 @@
 .include 't/common.pir'
 
 .sub 'main' :main
-.include 'test_more.pir'
-load_bytecode 'pmc.pbc'
+    .include 'test_more.pir'
+    load_bytecode 'pmc.pbc'
+
     .local int total
     .local pmc os, all_files, pmc_files, dynpmc_files, it
 
@@ -65,7 +66,8 @@
   iter_start:
     unless it goto iter_done
     $S0 = shift it
-    test_parse_one($S0)
+    $S1 = test_parse_one($S0)
+    is($S1, '', $S0)
     goto iter_start
   iter_done:
 

Modified: branches/pmc_pct/compilers/pmc/t/common.pir
==============================================================================
--- branches/pmc_pct/compilers/pmc/t/common.pir	Sat May  2 03:40:20 2009	(r38434)
+++ branches/pmc_pct/compilers/pmc/t/common.pir	Sat May  2 03:59:12 2009	(r38435)
@@ -10,11 +10,18 @@
     push_eh fail
     compiler.'parse'($S0, 'target'=>'parse')
     pop_eh
-    ok(1, file)
-    .return ()
+    .return ('')
+
   fail:
+    .local pmc ex
+    .local string ex_type, ex_msg, ret_val
+    .get_results(ex)
     pop_eh
-    ok(0, file)
+    ex_type = typeof ex
+    ex_msg = ex
+    ret_val = concat ex_type, ': '
+    ret_val = concat ret_val, ex_msg
+    .return (ret_val)
 .end
 
 .sub '_slurp'


More information about the parrot-commits mailing list