Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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 Benabik authored
Showing with 21 additions and 0 deletions.
  1. +14 −0 t/00-sanity.t
  2. +7 −0 t/common.winxed
14 t/00-sanity.t
View
@@ -33,6 +33,20 @@ class SanityTest {
assert.not_null(class PACT.Packfile.Decompile, 'found Decompile');
}
+
+ function test_compile() {
+ var assert = self.assert;
+
+ var pack = compile(<<:
+.namespace [] # work around for segfault
+.sub 'test_compile'
+.end
+:>>
+ );
+
+ assert.not_null(pack);
+ assert.instance_of(pack, 'Packfile');
+ }
}
# vim: se ft=winxed :
7 t/common.winxed
View
@@ -8,3 +8,10 @@ $include 'PACT/Packfile/Decompile.winxed';
# Load PACT (Decompile loads Packfile)
$load 'PACT/Packfile/Decompile.pbc';
+
+function compile(string pir) {
+ var imcc = compreg('PIR');
+ var view = imcc.compile(pir);
+ var pack = new 'Packfile'(view);
+ return pack;
+}
Please sign in to comment.
Something went wrong with that request. Please try again.