def test_factorial(capsys): with open("examples/fizzbuzz.nu") as f: prog = f.read() interp = Interpreter() interp.run(prog) out, err = capsys.readouterr() print(out) assert out == expected
def test_argv(capsys): with open("examples/argv.nu") as f: prog = f.read() interp = Interpreter(argv=["-a", "-b", "--spam"]) interp.run(prog) out, err = capsys.readouterr() print(out) assert out == expected
def test_importing(capsys): with open(path) as f: prog = f.read() interp = Interpreter() interp.run(prog, file=path) out, err = capsys.readouterr() print(out) assert out == expected
def test_factorial(capsys): with open("examples/factorial.nu") as f: prog = f.read() interp = Interpreter() with StdinWrapper(["5", "7", ""]): try: interp.run(prog) except: pass out, err = capsys.readouterr() print(out) assert out == expected