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

bacek at svn.parrot.org bacek at svn.parrot.org
Tue Apr 7 21:36:02 UTC 2009


Author: bacek
Date: Tue Apr  7 21:36:02 2009
New Revision: 37961
URL: https://trac.parrot.org/parrot/changeset/37961

Log:
Add test for Packfile_pack

Modified:
   branches/packfile_revamp/t/pmc/packfile.t

Modified: branches/packfile_revamp/t/pmc/packfile.t
==============================================================================
--- branches/packfile_revamp/t/pmc/packfile.t	Tue Apr  7 21:35:25 2009	(r37960)
+++ branches/packfile_revamp/t/pmc/packfile.t	Tue Apr  7 21:36:02 2009	(r37961)
@@ -21,13 +21,14 @@
 .sub main :main
 .include 'test_more.pir'
 
-    plan(6)
+    plan(7)
     'test_new'()
     'test_get_integer'()
     'test_get_directory'()
     'test_get_integer_keyed_str'()
     'test_set_integer_keyed_str'()
     'test_get_directory'()
+    'test_pack'()
 .end
 
 
@@ -104,10 +105,35 @@
     ok($I1, 'get_directory')
 .end
 
+# Packfile.pack.
+# Check that unpack-pack produce correct result.
+.sub 'test_pack'
+    .local string filename, first
+    $S0 = '_filename'()
+    $P0 = open $S0, 'r'
+
+    first = $P0.'readall'()
+
+    .local pmc packfile
+    packfile = new 'Packfile'
+    packfile = first
+
+    # Packed file should be exactly the same as loaded
+    .local string second
+    # Pack
+    second = packfile
+    
+    $I0 = cmp first, second
+    $I0 = not $I0
+    todo($I0, 'pack produced same result twice')
+.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/integer_1.pbc'
+    filename = 't/native_pbc/number_1.pbc'
     .return (filename)
 .end
 


More information about the parrot-commits mailing list