Test requires from native code
This commit is contained in:
parent
bd478590fa
commit
1e7c90c44e
@ -689,8 +689,17 @@
|
|||||||
|
|
||||||
|
|
||||||
(defn test-require []
|
(defn test-require []
|
||||||
|
"NATIVE: test requiring macros from python code"
|
||||||
(try
|
(try
|
||||||
(assert (= "this won't happen" (qplah 1 2 3 4)))
|
(assert (= "this won't happen" (qplah 1 2 3 4)))
|
||||||
(catch [NameError]))
|
(catch [NameError]))
|
||||||
(require tests.resources.tlib)
|
(require tests.resources.tlib)
|
||||||
(assert (= [1 2 3] (qplah 1 2 3))))
|
(assert (= [1 2 3] (qplah 1 2 3))))
|
||||||
|
|
||||||
|
|
||||||
|
(defn test-require-native []
|
||||||
|
"NATIVE: test requiring macros from native code"
|
||||||
|
(require tests.native_tests.native_macros)
|
||||||
|
(setv x [])
|
||||||
|
(rev (.append x 1) (.append x 2) (.append x 3))
|
||||||
|
(assert (= x [3 2 1])))
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
(defn test-rev-macro []
|
|
||||||
"NATIVE: test stararged native macros"
|
|
||||||
(defmacro rev [&rest body]
|
(defmacro rev [&rest body]
|
||||||
"Execute the `body` statements in reverse"
|
"Execute the `body` statements in reverse"
|
||||||
(quasiquote (do (unquote-splice (list (reversed body)))))))
|
(quasiquote (do (unquote-splice (list (reversed body))))))
|
||||||
|
|
||||||
|
|
||||||
|
(defn test-rev-macro []
|
||||||
|
"NATIVE: test stararged native macros"
|
||||||
(setv x [])
|
(setv x [])
|
||||||
(rev (.append x 1) (.append x 2) (.append x 3))
|
(rev (.append x 1) (.append x 2) (.append x 3))
|
||||||
(assert (= x [3 2 1])))
|
(assert (= x [3 2 1])))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user