Fix bin/hy and add a unit test

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2013-04-20 22:27:10 +02:00
parent 7f230fdd10
commit 3226ecc33f
2 changed files with 10 additions and 2 deletions

4
bin/hy
View File

@ -21,7 +21,7 @@ from hy.lex.states import Idle, LexException
from hy.lex.machine import Machine from hy.lex.machine import Machine
from hy.compiler import hy_compile from hy.compiler import hy_compile
from hy.core import process from hy.core import process
from hy.importer import compile_ from hy.importer import ast_compile
import hy.completer import hy.completer
@ -59,7 +59,7 @@ class HyREPL(code.InteractiveConsole):
_machine = Machine(Idle, 1, 0) _machine = Machine(Idle, 1, 0)
try: try:
_ast = hy_compile(tokens, root=ast.Interactive) _ast = hy_compile(tokens, root=ast.Interactive)
code = compile_(_ast, filename, symbol) code = ast_compile(_ast, filename, symbol)
except Exception: except Exception:
self.showtraceback() self.showtraceback()
return False return False

8
tests/test_bin.py Normal file
View File

@ -0,0 +1,8 @@
import subprocess
def test_bin_hy():
p = subprocess.Popen("echo | bin/hy",
shell=True)
p.wait()
assert p.returncode == 0