diff options
Diffstat (limited to 'Tools/LuaMacro/tests/test-case.lua')
-rw-r--r-- | Tools/LuaMacro/tests/test-case.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Tools/LuaMacro/tests/test-case.lua b/Tools/LuaMacro/tests/test-case.lua new file mode 100644 index 0000000..4f7eb25 --- /dev/null +++ b/Tools/LuaMacro/tests/test-case.lua @@ -0,0 +1,21 @@ +def_ OF_ def_ (of elseif _value ==)
+def_ case(x) do OF_ local _value = x if false then _END_END_
+
+function test(n)
+ local res
+ case(n)
+ of 10 then
+ res = 1
+ of 20 then
+ res = 2
+ else
+ res = 3
+ end
+ return res
+end
+
+assert(test(10)==1)
+assert(test(20)==2)
+assert(test(30)==3)
+
+
|