def assertCompilesTo(self, source, output): """ Assertion that the source compiles to the output. Doesn't fail horribly on whitespace differences. """ compiled = translate_string(self.unindent_code(source)) self.assertEqual( " ".join(compiled.split()), " ".join(output.split()), )
def compile_file(filename): # Work out the destination file dest_filename = os.path.splitext(filename)[0] + ".js" with open(dest_filename, "w") as dest: with open(filename, "r") as src: dest.write(translate_string(src.read(), "VC.core"))