Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

t/common: Central compile function

Takes in PIR, outputs a Packfile.  Going to be doing this a lot so
would rather not write those three lines over and over again.
  • Loading branch information...
commit c725ca9ad1e20ac49efb9530773d981825aee995 1 parent c3d555e
Brian Gernhardt authored July 24, 2012
14  t/00-sanity.t
@@ -33,6 +33,20 @@ class SanityTest {
33 33
 
34 34
         assert.not_null(class PACT.Packfile.Decompile, 'found Decompile');
35 35
     }
  36
+
  37
+    function test_compile() {
  38
+        var assert = self.assert;
  39
+
  40
+        var pack = compile(<<:
  41
+.namespace [] # work around for segfault
  42
+.sub 'test_compile'
  43
+.end
  44
+:>>
  45
+        );
  46
+
  47
+        assert.not_null(pack);
  48
+        assert.instance_of(pack, 'Packfile');
  49
+    }
36 50
 }
37 51
 
38 52
 # vim: se ft=winxed :
7  t/common.winxed
@@ -8,3 +8,10 @@ $include 'PACT/Packfile/Decompile.winxed';
8 8
 
9 9
 # Load PACT (Decompile loads Packfile)
10 10
 $load    'PACT/Packfile/Decompile.pbc';
  11
+
  12
+function compile(string pir) {
  13
+    var imcc = compreg('PIR');
  14
+    var view = imcc.compile(pir);
  15
+    var pack = new 'Packfile'(view);
  16
+    return pack;
  17
+}

0 notes on commit c725ca9

Please sign in to comment.
Something went wrong with that request. Please try again.