Skip to content

Commit

Permalink
Add test for macroexpand-all with require.
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonwillard committed Jul 25, 2018
1 parent 1aadc90 commit 285dde1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion hy/contrib/walk.hy
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
[(= (first form) 'quote) form]
[(= (first form) 'quasiquote) (+quote)]
[(= (first form) (HySymbol "require"))
(ast-compiler.compile form)]
(ast-compiler.compile form)
(return)]
[True (traverse (mexpand form ast-compiler))])
(if (coll? form)
(traverse form)
Expand Down
2 changes: 2 additions & 0 deletions tests/native_tests/contrib/expand_module.hy
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(defmacro test-macro []
'(setv blah 1))
10 changes: 9 additions & 1 deletion tests/native_tests/contrib/walk.hy
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,15 @@
(do '(with [b 2])
`(with [c 3]
~(with* [d 4] (do))
~@[(with* [e 5] (do))]))))))
~@[(with* [e 5] (do))])))))

(defmacro require-macro []
`(do
(require [tests.native_tests.contrib.expand_module [test-macro :as my-test-macro]])
(my-test-macro)))

(assert (= (macroexpand-all '(require-macro))
`(do ~None (setv blah 1)))))

(defn test-let-basic []
(assert (zero? (let [a 0] a)))
Expand Down

0 comments on commit 285dde1

Please sign in to comment.