Add some xfail tests for known bugs

This commit is contained in:
Kodi Arfer 2017-04-17 16:37:20 -07:00
parent 28e2c2840e
commit eeb0be8fb0
2 changed files with 31 additions and 3 deletions

View File

@ -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 ->"

View File

@ -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"))))