diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2018-11-19 17:21:08 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2018-11-19 17:21:17 -0800 |
| commit | acd1191fb06a51f70f553c1dc8b47cf245a1c913 (patch) | |
| tree | 993bb69cc050426644b98d10fb1a3133b3623be6 /tools/test.nom | |
| parent | 7f47d4204039258cec78c767f489b7809b4257ff (diff) | |
Tweaks and API cleanup.
Diffstat (limited to 'tools/test.nom')
| -rwxr-xr-x | tools/test.nom | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/tools/test.nom b/tools/test.nom index f9ed2cb..32c9b7a 100755 --- a/tools/test.nom +++ b/tools/test.nom @@ -13,30 +13,32 @@ if (%args.1 == "-v"): %args::remove index 1 %verbose = (yes) +%to_run = [..] + : + for %path in (command line args): + for %filename in (files for %path): + if (%filename == "-"): %filename = "stdin" + if ((%filename::matches "%.nom$") or (%filename == "stdin")): + add %filename # Make sure all the files get run -for %path in (command line args): - for file %filename in %path: - if (%filename::matches "%.nom$"): use %filename -for %path in (command line args): use %path +for %filename in %to_run: use %filename %tests = {: for %s = %t in (tests): add (=lua "Source:from_string(\%s)") = %t} -for %path in (command line args): - for file %filename in %path: - unless (%filename::matches "%.nom$"): do next %filename - %file_tests = [] - for %src = %test in %tests: - if (%src.filename == %filename): - %file_tests::add {test: %test, source: %src} - - unless (%file_tests is empty): - sort %file_tests by % -> %.source - lua> "io.write('[ .. ] ', \%filename); io.flush()" - if %verbose: say "" - for % in %file_tests: - if %verbose: - say " \(yellow (%.test::with "\n" -> "\n "))" - run %.test - +for %filename in %to_run: + %file_tests = [] + for %src = %test in %tests: + if (%src.filename == %filename): + %file_tests::add {test: %test, source: %src} + + unless (%file_tests is empty): + sort %file_tests by % -> %.source + lua> "io.write('[ .. ] ', \%filename); io.flush()" + if %verbose: say "" + for % in %file_tests: if %verbose: - say (green "PASS") - ..else: - say "\r[\(green "PASS")" + say " \(yellow (%.test::with "\n" -> "\n "))" + run %.test + + if %verbose: + say (green "PASS") + ..else: + say "\r[\(green "PASS")" |
