[svn:parrot] r38023 - branches/packfile_revamp/t/pmc

bacek at svn.parrot.org bacek at svn.parrot.org
Fri Apr 10 06:10:34 UTC 2009


Author: bacek
Date: Fri Apr 10 06:10:34 2009
New Revision: 38023
URL: https://trac.parrot.org/parrot/changeset/38023

Log:
Move common test functions into packfile_common.pir

Added:
   branches/packfile_revamp/t/pmc/packfile_common.pir
Modified:
   branches/packfile_revamp/t/pmc/packfile.t
   branches/packfile_revamp/t/pmc/packfileconstanttable.t
   branches/packfile_revamp/t/pmc/packfiledirectory.t

Modified: branches/packfile_revamp/t/pmc/packfile.t
==============================================================================
--- branches/packfile_revamp/t/pmc/packfile.t	Fri Apr 10 06:10:06 2009	(r38022)
+++ branches/packfile_revamp/t/pmc/packfile.t	Fri Apr 10 06:10:34 2009	(r38023)
@@ -17,6 +17,7 @@
 
 =cut
 
+.include 't/pmc/packfile_common.pir'
 
 .sub main :main
 .include 'test_more.pir'
@@ -211,32 +212,6 @@
     is($I0, 0, "unpack and set_string are synonyms")
 .end
 
-# Return test filename
-# Currently parrot doesn't support system independent PBCs. So, cross your
-# fingers and try different filename for binary-dependent tests...
-.sub '_filename'
-    .local string filename
-    filename = 't/native_pbc/number_1.pbc'
-    .return (filename)
-.end
-
-# common pbc loading function
-.sub '_pbc'
-    .include "stat.pasm"
-    .include "interpinfo.pasm"
-    .local pmc pf, pio
-    pf   = new ['Packfile']
-    #$S0  = interpinfo .INTERPINFO_RUNTIME_PREFIX
-    #$S0 .= "/runtime/parrot/library/uuid.pbc"
-    $S0 = '_filename'()
-    pio  = open $S0, 'r'
-    $S0  = pio.'readall'()
-    close pio
-    pf   = $S0
-    .return(pf)
-.end
-
-
 
 # Local Variables:
 #   mode: cperl

Added: branches/packfile_revamp/t/pmc/packfile_common.pir
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/packfile_revamp/t/pmc/packfile_common.pir	Fri Apr 10 06:10:34 2009	(r38023)
@@ -0,0 +1,37 @@
+#! parrot
+# Common functions for various Packfile* PMCs tests.
+# Return test filename
+# Currently parrot doesn't support system independent PBCs. So, cross your
+# fingers and try different filename for binary-dependent tests...
+
+.sub '_filename'
+    .local string filename
+    filename = 't/native_pbc/number_1.pbc'
+    .return (filename)
+.end
+
+# common pbc loading function
+.sub '_pbc'
+    .include "stat.pasm"
+    .include "interpinfo.pasm"
+    .local pmc pf, pio
+    pf   = new ['Packfile']
+    #$S0  = interpinfo .INTERPINFO_RUNTIME_PREFIX
+    #$S0 .= "/runtime/parrot/library/uuid.pbc"
+    $S0 = '_filename'()
+    pio  = open $S0, 'r'
+    $S0  = pio.'readall'()
+    close pio
+    pf   = $S0
+    .return(pf)
+.end
+
+
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
+

Modified: branches/packfile_revamp/t/pmc/packfileconstanttable.t
==============================================================================
--- branches/packfile_revamp/t/pmc/packfileconstanttable.t	Fri Apr 10 06:10:06 2009	(r38022)
+++ branches/packfile_revamp/t/pmc/packfileconstanttable.t	Fri Apr 10 06:10:34 2009	(r38023)
@@ -22,6 +22,8 @@
 # fetches for the found types don't crash.
 
 
+.include 't/pmc/packfile_common.pir'
+
 .sub 'main' :main
 .include 'test_more.pir'
 .include 'packfile_constants.pasm'
@@ -130,40 +132,15 @@
 
     # Check types of created constants
     $I0 = ct.'get_type'(0)
-    is($I0, 0x73, "First element is string")
+    is($I0, .PFC_STRING, "First element is string")
     $I0 = ct.'get_type'(1)
-    is($I0, 0x6E, "Second element is number")
+    is($I0, .PFC_NUMBER, "Second element is number")
     $I0 = ct.'get_type'(2)
-    is($I0, 0x70, "Third element is PMC")
+    is($I0, .PFC_PMC, "Third element is PMC")
 
 .end
 
 
-# Return test filename
-# Currently parrot doesn't support system independent PBCs. So, cross your
-# fingers and try different filename for binary-dependent tests...
-.sub '_filename'
-    .local string filename
-    filename = 't/native_pbc/number_1.pbc'
-    .return (filename)
-.end
-
-# common pbc loading function
-.sub '_pbc'
-    .include "stat.pasm"
-    .include "interpinfo.pasm"
-    .local pmc pf, pio
-    pf   = new ['Packfile']
-    #$S0  = interpinfo .INTERPINFO_RUNTIME_PREFIX
-    #$S0 .= "/runtime/parrot/library/uuid.pbc"
-    $S0 = '_filename'()
-    pio  = open $S0, 'r'
-    $S0  = pio.'readall'()
-    close pio
-    pf   = $S0
-    .return(pf)
-.end
-
 .sub '_get_consttable'
     .param pmc pf
     .local pmc dir, it

Modified: branches/packfile_revamp/t/pmc/packfiledirectory.t
==============================================================================
--- branches/packfile_revamp/t/pmc/packfiledirectory.t	Fri Apr 10 06:10:06 2009	(r38022)
+++ branches/packfile_revamp/t/pmc/packfiledirectory.t	Fri Apr 10 06:10:34 2009	(r38023)
@@ -17,6 +17,8 @@
 
 =cut
 
+.include 't/pmc/packfile_common.pir'
+
 .sub 'main' :main
 .include 'test_more.pir'
     plan(13)
@@ -111,31 +113,6 @@
     .return()
 .end
 
-# Return test filename
-# Currently parrot doesn't support system independent PBCs. So, cross your
-# fingers and try different filename for binary-dependent tests...
-.sub '_filename'
-    .local string filename
-    filename = 't/native_pbc/number_1.pbc'
-    .return (filename)
-.end
-
-# common pbc loading function
-.sub '_pbc'
-    .include "stat.pasm"
-    .include "interpinfo.pasm"
-    .local pmc pf, pio
-    pf   = new ['Packfile']
-    #$S0  = interpinfo .INTERPINFO_RUNTIME_PREFIX
-    #$S0 .= "/runtime/parrot/library/uuid.pbc"
-    $S0 = '_filename'()
-    pio  = open $S0, 'r'
-    $S0  = pio.'readall'()
-    close pio
-    pf   = $S0
-    .return(pf)
-.end
-
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4


More information about the parrot-commits mailing list