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

bacek at svn.parrot.org bacek at svn.parrot.org
Sun Apr 26 02:10:14 UTC 2009


Author: bacek
Date: Sun Apr 26 02:10:12 2009
New Revision: 38359
URL: https://trac.parrot.org/parrot/changeset/38359

Log:
Factor out common test function into common.pir

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

Modified: branches/pmc_pct/compilers/pmc/t/01-parse.t
==============================================================================
--- branches/pmc_pct/compilers/pmc/t/01-parse.t	Sat Apr 25 23:58:17 2009	(r38358)
+++ branches/pmc_pct/compilers/pmc/t/01-parse.t	Sun Apr 26 02:10:12 2009	(r38359)
@@ -1,9 +1,11 @@
 #!parrot
 
+.include 'compilers/pmc/t/common.pir'
 
 .sub 'main' :main
 .include 'test_more.pir'
 load_bytecode 'compilers/pmc/pmc.pbc'
+
     .local int total
     total = 24
 
@@ -25,30 +27,6 @@
 
 .end
 
-.sub 'test_parse_one'
-    .param string file
-    $S0 = _slurp(file)
-    .local pmc compiler
-    compiler = compreg 'PMC'
-    push_eh fail
-    compiler.'parse'($S0, 'target'=>'parse')
-    pop_eh
-    ok(1, file)
-    .return ()
-  fail:
-    pop_eh
-    ok(0, file)
-.end
-
-.sub '_slurp'
-    .param string file
-    .local pmc pio
-    pio  = open file
-    $S0  = pio.'readall'()
-    close pio
-    .return ($S0)
-.end
-
 # Don't forget to update plan!
 
 # Local Variables:

Modified: branches/pmc_pct/compilers/pmc/t/02-parse-all-pmcs.t
==============================================================================
--- branches/pmc_pct/compilers/pmc/t/02-parse-all-pmcs.t	Sat Apr 25 23:58:17 2009	(r38358)
+++ branches/pmc_pct/compilers/pmc/t/02-parse-all-pmcs.t	Sun Apr 26 02:10:12 2009	(r38359)
@@ -1,5 +1,6 @@
 #!parrot
 
+.include 'compilers/pmc/t/common.pir'
 
 .sub 'main' :main
 .include 'test_more.pir'
@@ -70,35 +71,10 @@
 
 .end
 
-.sub 'test_parse_one'
-    .param string file
-    $S0 = _slurp(file)
-    .local pmc compiler
-    compiler = compreg 'PMC'
-    push_eh fail
-    compiler.'parse'($S0, 'target'=>'parse')
-    pop_eh
-    ok(1, file)
-    .return ()
-  fail:
-    pop_eh
-    ok(0, file)
-.end
-
-.sub '_slurp'
-    .param string file
-    .local pmc pio
-    pio  = open file
-    $S0  = pio.'readall'()
-    close pio
-    .return ($S0)
-.end
-
 # Don't forget to update plan!
 
 # Local Variables:
-#   mode: cperl
-#   cperl-indent-level: 4
+#   mode: pir
 #   fill-column: 100
 # End:
 # vim: expandtab shiftwidth=4 ft=pir:

Added: branches/pmc_pct/compilers/pmc/t/common.pir
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/pmc_pct/compilers/pmc/t/common.pir	Sun Apr 26 02:10:12 2009	(r38359)
@@ -0,0 +1,33 @@
+=head1 COMMON FUNCTIONS FOR TESTING
+
+=cut
+
+.sub 'test_parse_one'
+    .param string file
+    $S0 = _slurp(file)
+    .local pmc compiler
+    compiler = compreg 'PMC'
+    push_eh fail
+    compiler.'parse'($S0, 'target'=>'parse')
+    pop_eh
+    ok(1, file)
+    .return ()
+  fail:
+    pop_eh
+    ok(0, file)
+.end
+
+.sub '_slurp'
+    .param string file
+    .local pmc pio
+    pio  = open file
+    $S0  = pio.'readall'()
+    close pio
+    .return ($S0)
+.end
+
+# Local Variables:
+#   mode: pir
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:


More information about the parrot-commits mailing list