From 0f1b7582e134190bd214c7791802a3eb0424c976 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Tue, 2 Jun 2020 19:26:14 +0300 Subject: [PATCH] minor rework of test.js commandline opts + minor fix... Signed-off-by: Alex A. Naanou --- test.js | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/test.js b/test.js index e609a0d..794e70a 100755 --- a/test.js +++ b/test.js @@ -389,6 +389,9 @@ function(chain, stats){ var setup = chain.shift() || '*' var test = chain.pop() || '*' var mod = chain.pop() || '*' + mod = chain_length == 2 ? + 'as-is' + : mod // stats... stats = stats || {} @@ -466,6 +469,27 @@ if(typeof(__filename) != 'undefined' if(arg == 'v' || arg == 'verbose'){ module.VERBOSE=true + // list... + } else if(arg == 'l' || arg == 'list'){ + console.log(object.normalizeTextIndent( + `Setups: + ${ Object.keys(setups) + .join('\n\t\t\t\t\t\t') } + + Modifiers: + ${ Object.keys(modifiers) + .join('\n\t\t\t\t\t\t') } + + Tests: + ${ Object.keys(tests) + .join('\n\t\t\t\t\t\t') } + + Standalone test cases: + ${ Object.keys(cases) + .join('\n\t\t\t\t\t\t') } + `)) + process.exit() + // help... // XXX format the lists better... word-wrap?? } else if(arg == 'h' || arg == 'help'){ @@ -480,19 +504,10 @@ if(typeof(__filename) != 'undefined' Each item can either be a specific item name or '*' to indicate any/all items. - Setups: - ${ Object.keys(setups).join(', ') } - - Modifiers: - ${ Object.keys(modifiers).join(', ') } - - Tests: - ${ Object.keys(tests).join(', ') } - Options: -h | --help print this message and exit -v | --verbose verbose mode - + -l | --list list available tests `)) process.exit() }