Add do-in-defn tests
This commit is contained in:
parent
940afcafa9
commit
06511fe303
@ -245,3 +245,22 @@
|
|||||||
(defn my-fun [x]
|
(defn my-fun [x]
|
||||||
(+ x 1))
|
(+ x 1))
|
||||||
(assert (= 43 (my-fun 42))))
|
(assert (= 43 (my-fun 42))))
|
||||||
|
|
||||||
|
(defn test-defn-do []
|
||||||
|
"NATIVE: test defn evaluation order with do"
|
||||||
|
(setv acc [])
|
||||||
|
(defn my-fun []
|
||||||
|
(do
|
||||||
|
(.append acc "Foo")
|
||||||
|
(.append acc "Bar")
|
||||||
|
(.append acc "Baz")))
|
||||||
|
(my-fun)
|
||||||
|
(assert (= acc ["Foo" "Bar" "Baz"])))
|
||||||
|
|
||||||
|
(defn test-defn-do-return []
|
||||||
|
"NATIVE: test defn return with do"
|
||||||
|
(defn my-fun [x]
|
||||||
|
(do
|
||||||
|
(+ x 42) ; noop
|
||||||
|
(+ x 1)))
|
||||||
|
(assert (= 43 (my-fun 42))))
|
||||||
|
Loading…
Reference in New Issue
Block a user