From eeb0be8fb0bdbd9d7d23dc908be2d24d4e475d0a Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Mon, 17 Apr 2017 16:37:20 -0700 Subject: [PATCH] Add some xfail tests for known bugs --- tests/native_tests/language.hy | 27 +++++++++++++++++++++++++-- tests/native_tests/operators.hy | 7 ++++++- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/tests/native_tests/language.hy b/tests/native_tests/language.hy index 28c9d02..fbf7ce4 100644 --- a/tests/native_tests/language.hy +++ b/tests/native_tests/language.hy @@ -2,7 +2,8 @@ [os.path [exists isdir isfile]] [sys :as systest] [operator [or_]] - [hy.errors [HyTypeError]]) + [hy.errors [HyTypeError]] + pytest) (import sys) (import [hy._compat [PY3 PY34 PY35]]) @@ -1161,7 +1162,7 @@ (defn test-try-except-return [] - "NATIVE: test we can return from in a try except" + "NATIVE: test that we can return from an `except` form" (assert (= ((fn [] (try xxx (except [NameError] (+ 1 1))))) 2)) (setv foo (try xxx (except [NameError] (+ 1 1)))) (assert (= foo 2)) @@ -1169,6 +1170,21 @@ (assert (= foo 4))) +#@(pytest.mark.xfail +(defn test-try-else-return [] + "NATIVE: test that we can return from the `else` clause of a `try`" + ; https://github.com/hylang/hy/issues/798 + (assert (= "ef" ((fn [] + (try (+ "a" "b") + (except [NameError] (+ "c" "d")) + (else (+ "e" "f"))))))) + (setv foo + (try (+ "A" "B") + (except [NameError] (+ "C" "D")) + (else (+ "E" "F")))) + (assert (= foo "EF")))) + + (defn test-require [] "NATIVE: test requiring macros from python code" (try (qplah 1 2 3 4) @@ -1288,6 +1304,13 @@ (assert (= (macroexpand '(-> (a b) (-> (c d) (e f)))) '(e (c (a b) d) f)))) +#@(pytest.mark.xfail +(defn test-macroexpand-with-named-import [] + ; https://github.com/hylang/hy/issues/1207 + (defmacro m-with-named-import [] + (import [math [pow]]) + (pow 2 3)) + (assert (= (macroexpand '(m-with-named-import)) (** 2 3))))) (defn test-macroexpand-1 [] "Test macroexpand-1 on ->" diff --git a/tests/native_tests/operators.hy b/tests/native_tests/operators.hy index 1f60650..9ee5c12 100644 --- a/tests/native_tests/operators.hy +++ b/tests/native_tests/operators.hy @@ -1,4 +1,4 @@ -(import [hy._compat [PY35]]) +(import pytest [hy._compat [PY35]]) (defmacro op-and-shadow-test [op &rest body] ; Creates two tests with the given `body`, one where all occurrences @@ -284,3 +284,8 @@ (assert (is (f 3 [1 2]) (!= f-name "in"))) (assert (is (f 2 [1 2]) (= f-name "in"))) (forbid (f 2 [1 2] [3 4]))) + +#@(pytest.mark.xfail +(defn test-apply-op [] + ; https://github.com/hylang/hy/issues/647 + (assert (= (eval '(apply + ["a" "b" "c"])) "abc"))))