aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2018-11-21 13:56:25 -0800
committerBruce Hill <bruce@bruce-hill.com>2018-11-21 13:56:25 -0800
commitfa967247daae4fec8c42efe73fd16c615b4fb7d5 (patch)
tree441712eef0663fb28c3ee0063ef184e149a4c1e2
parent2bbc035f5dcc3ecd62724b9d1de0e7e3ea902379 (diff)
Fixed tests to work better with different syntax versions.
-rw-r--r--core/metaprogramming.nom7
-rwxr-xr-xtools/test.nom6
2 files changed, 10 insertions, 3 deletions
diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom
index 67219ac..0223e17 100644
--- a/core/metaprogramming.nom
+++ b/core/metaprogramming.nom
@@ -370,9 +370,10 @@ externally (type of %) means:
test:
assume ((run "return (2 + 99)") == 101)
- external %passed = (no)
- run "external %passed = (yes)"
- assume %passed
+ %x = 0
+ externally (set to %) means: external %x = %
+ run "set to 1"
+ assume %x == 1
assume (run \(return \(\(5) + \(5)))) == 10
(run %nomsu_code) compiles to "run_1_in(\(%nomsu_code as lua expr), _ENV)"
[compile %block, compiled %block, %block compiled] all compile to "\
diff --git a/tools/test.nom b/tools/test.nom
index 52e548f..1fd5ee3 100755
--- a/tools/test.nom
+++ b/tools/test.nom
@@ -12,9 +12,15 @@ use "lib/consolecolor.nom"
for %filename in (command line args).extra_args: use %filename
%tests = {: for %s = %t in (tests): add (=lua "Source:from_string(\%s)") = %t}
for %filename in (command line args).extra_args:
+ %file = (read file %filename)
+ %version = (%file::matching "#![^\n]* nomsu %-V[ ]*([^\n]*)")
%file_tests = []
for %src = %test in %tests:
if (%src.filename == %filename):
+ if %version:
+ %test = "\
+ ..#!/usr/bin/env nomsu -V\(%version)
+ \%test"
%file_tests::add {test: %test, source: %src}
unless (%file_tests is empty):