Ejemplo n.º 1
0
def All_examples_evaluate():
    from pycell.run import run
    for example in all_examples():
        with StringIO() as stdin, StringIO() as stdout:
            run(example, stdin, stdout, stdout)
            with open(example[:-5] + ".output.txt") as outputfile:
                assert_that(stdout.getvalue(), equals(outputfile.read()))
Ejemplo n.º 2
0
def All_examples_evaluate():
    from pycell.run import run
    for example in all_examples():
        try:
            with StringIO() as stdin, StringIO() as stdout:
                run(example, stdin, stdout, stdout)
                with open(example[:-5] + ".output.txt") as outputfile:
                    assert_that(stdout.getvalue(), equals(outputfile.read()))
        except Exception as e:
            raise Exception("%s: %s" % (example, str(e)))
Ejemplo n.º 3
0
def All_examples_work_in_js():
    import os
    from subprocess import check_output
    from pycell.chars_in_file import chars_in_file
    from pycell.compile_ import compile_list
    for example in all_examples():
        compile_("compiled.js", example)
        with open(example[:-5] + ".output.txt") as outputfile:
            expected = outputfile.read()

        stdout = check_output(["node", "compiled.js"], universal_newlines=True)
        assert_that(stdout, equals(expected))
        os.remove("compiled.js")
Ejemplo n.º 4
0
def All_examples_work_in_js():
    import os
    from subprocess import check_output
    from pycell.chars_in_file import chars_in_file
    from pycell.compile_ import compile_list
    for example in all_examples():
        compile_("compiled.js", example)
        with open(example[:-5] + ".output.txt") as outputfile:
            expected = outputfile.read()

        stdout = check_output(
            ["node", "compiled.js"], universal_newlines=True )
        assert_that(stdout, equals(expected))
        os.remove("compiled.js")
Ejemplo n.º 5
0
def All_examples_lex():
    from pycell.chars_in_file import chars_in_file
    for example in all_examples():
        with open(example, encoding="ascii") as f:
            lexed(chars_in_file(f))
Ejemplo n.º 6
0
def All_examples_parse():
    from pycell.chars_in_file import chars_in_file
    for example in all_examples():
        with open(example, encoding="ascii") as f:
            parsed(chars_in_file(f))