diff --git a/tests/__init__.py b/tests/__init__.py index 3290f8c..5a88209 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -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 diff --git a/tests/native_tests/native_macros.hy b/tests/native_tests/native_macros.hy new file mode 100644 index 0000000..7d4789a --- /dev/null +++ b/tests/native_tests/native_macros.hy @@ -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]))) +