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

bacek at svn.parrot.org bacek at svn.parrot.org
Wed Apr 29 11:33:28 UTC 2009


Author: bacek
Date: Wed Apr 29 11:33:28 2009
New Revision: 38403
URL: https://trac.parrot.org/parrot/changeset/38403

Log:
Refactor 04-header test for future extension.

Modified:
   branches/pmc_pct/compilers/pmc/t/04-header.t

Modified: branches/pmc_pct/compilers/pmc/t/04-header.t
==============================================================================
--- branches/pmc_pct/compilers/pmc/t/04-header.t	Wed Apr 29 10:43:27 2009	(r38402)
+++ branches/pmc_pct/compilers/pmc/t/04-header.t	Wed Apr 29 11:33:28 2009	(r38403)
@@ -13,21 +13,30 @@
     .local string filename
     filename = 'compilers/pmc/t/data/class00.pmc'
     $S0 = _slurp(filename)
+    check_one_header(filename, $S0, "'DO NOT EDIT THIS FILE'", "Warning generated")
+
+.end
+
+# Check genrated header.
+# Parse passed string, generate header, check against supplied pattern
+.sub 'check_one_header'
+    .param string name
+    .param string source
+    .param string pattern
+    .param string message
+
     .local pmc compiler
     compiler = compreg 'PMC'
-    $P0 = compiler.'compile'($S0, 'target'=>'past')
+    $P0 = compiler.'compile'(source, 'target'=>'past')
 
     .local pmc emitter
     $P1 = split '::', 'PMC::Emitter'
     emitter = new $P1
-    emitter.'set_filename'(filename)
+    emitter.'set_filename'(name)
     $S0 = emitter.'generate_h_file'($P0)
-    say $S0
-    like($S0, "'DO NOT EDIT THIS FILE'", "Warning generated")
-
+    like($S0, pattern, message)
 .end
 
-
 # Don't forget to update plan!
 
 # Local Variables:


More information about the parrot-commits mailing list