From 371548150618d5b3501f388972077b5d035f7d8a Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 21 Sep 2017 00:10:26 -0700 Subject: Another overhaul, this time pulling all the chunks of the core lib into their own files. --- lib/testing.nom | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 lib/testing.nom (limited to 'lib/testing.nom') diff --git a/lib/testing.nom b/lib/testing.nom new file mode 100644 index 0000000..48b311f --- /dev/null +++ b/lib/testing.nom @@ -0,0 +1,14 @@ +require "lib/metaprogramming.nom" + +# For unit testing +macro block [test %code yields %expected] =: + %generated =: lua expr "compiler.utils.repr(compiler:stringify_tree(vars.code.value))" + %expected =: %expected as lua expr + if (%generated != %expected): + say "Test failed!" + say "Expected:" + say %expected + say "But got:" + say %generated + error! + return "" -- cgit v1.2.3