From 2bbc035f5dcc3ecd62724b9d1de0e7e3ea902379 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 20 Nov 2018 14:52:59 -0800 Subject: Simplifying the filesystem code (no longer entangled with nomsupath) and using that to simplify the tools. Now the tools directly take lists of file paths rather than things that might go through nomsupath or directories or get processed by filetype. Use your shell for globbing stuff like `nomsu tools/test.nom core/*.nom` --- tools/test.nom | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'tools/test.nom') diff --git a/tools/test.nom b/tools/test.nom index bdbec54..52e548f 100755 --- a/tools/test.nom +++ b/tools/test.nom @@ -8,24 +8,10 @@ use "lib/consolecolor.nom" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -%args = (command line args) -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 %filename in %to_run: - use %filename +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 %to_run: +for %filename in (command line args).extra_args: %file_tests = [] for %src = %test in %tests: if (%src.filename == %filename): @@ -34,13 +20,13 @@ for %filename in %to_run: unless (%file_tests is empty): sort %file_tests by % -> %.source lua> "io.write('[ .. ] ', \%filename); io.flush()" - if %verbose: say "" + if (command line args)."-v": say "" for % in %file_tests: - if %verbose: + if (command line args)."-v": say " \(yellow (%.test::with "\n" -> "\n "))" run %.test - if %verbose: + if (command line args)."-v": say (green "PASS") ..else: say "\r[\(green "PASS")" -- cgit v1.2.3