diff --git a/NEWS b/NEWS index 513ac40..9ae3612 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,7 @@ Changes from 0.12.1 returns. * `setv` no longer unnecessarily tries to get attributes * `loop` no longer replaces string literals equal to "recur" + * The REPL now prints the correct value of `do` and `try` forms [ Misc. Improvements ] * New contrib module `hy-repr` diff --git a/tests/test_bin.py b/tests/test_bin.py index b355e63..0c748de 100644 --- a/tests/test_bin.py +++ b/tests/test_bin.py @@ -114,6 +114,23 @@ def test_bin_hy_stdin_error_underline_alignment(): assert "\n (mabcdefghi)\n ^----------^" in err +def test_bin_hy_stdin_except_do(): + # https://github.com/hylang/hy/issues/533 + + output, _ = run_cmd("hy", '(try (/ 1 0) (except [ZeroDivisionError] "hello"))') # noqa + assert "hello" in output + + output, _ = run_cmd("hy", '(try (/ 1 0) (except [ZeroDivisionError] "aaa" "bbb" "ccc"))') # noqa + assert "aaa" not in output + assert "bbb" not in output + assert "ccc" in output + + output, _ = run_cmd("hy", '(if True (do "xxx" "yyy" "zzz"))') + assert "xxx" not in output + assert "yyy" not in output + assert "zzz" in output + + def test_bin_hy_stdin_hy_repr(): output, _ = run_cmd("hy", '(+ [1] [2])') assert "[1, 2]" in output.replace('L', '')