aboutsummaryrefslogtreecommitdiff
path: root/tests/metaprogramming.nom
diff options
context:
space:
mode:
Diffstat (limited to 'tests/metaprogramming.nom')
-rw-r--r--tests/metaprogramming.nom15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/metaprogramming.nom b/tests/metaprogramming.nom
index 9a4c9b2..26a750a 100644
--- a/tests/metaprogramming.nom
+++ b/tests/metaprogramming.nom
@@ -36,7 +36,20 @@ immediately
parse [V] as: five
assume ((V) = 5) or barf "Parse as compile action failed."
-remove action "foo %"
+immediately
+ parse [swap %x and %y] as
+ do
+ %tmp <- %x
+ %x <- %y
+ %y <- %tmp
+<- {%1:1, %2:2}
+swap %1 and %2
+assume ((%1 = 2) and (%2 = 1)) or barf "'parse % as %' failed on 'swap % and %'"
+<- {%tmp:1, %tmp2:2}
+swap %tmp and %tmp2
+assume ((%tmp = 2) and (%tmp2 = 1)) or barf "'parse % as %' variable mangling failed."
+
+remove action (foo %)
try: foo 99
..and if it succeeds: barf "Failed to delete action"