Add a native macros test

This commit is contained in:
Nicolas Dandrimont 2013-05-11 19:40:48 +02:00
parent 4ffe20e853
commit 0bbce2a819
2 changed files with 11 additions and 0 deletions

View File

@ -4,6 +4,7 @@
import hy # noqa
from .native_tests.defclass import * # noqa
from .native_tests.math import * # noqa
from .native_tests.native_macros import *
from .native_tests.quote import * # noqa
from .native_tests.language import * # noqa
from .native_tests.unless import * # noqa

View File

@ -0,0 +1,10 @@
(defn test-rev-macro []
"NATIVE: test stararged native macros"
(defmacro rev [&rest body]
"Execute the `body` statements in reverse"
(+ (quote (do)) (list (reversed body))))
(setv x [])
(rev (.append x 1) (.append x 2) (.append x 3))
(assert (= x [3 2 1])))