mirror of
https://github.com/flynx/object.js.git
synced 2025-10-29 18:40:08 +00:00
docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
4b0a26e6f7
commit
890fdde887
49
test.js
49
test.js
@ -226,9 +226,10 @@ var ArgvParser = function(spec){
|
|||||||
__doc_prefix__: '- ',
|
__doc_prefix__: '- ',
|
||||||
|
|
||||||
// these is run in the same context as the handlers... (XXX ???)
|
// these is run in the same context as the handlers... (XXX ???)
|
||||||
__align__: function(a, b){
|
__align__: function(a, b, ...rest){
|
||||||
var opts_width = this.__opts_width__ || 4
|
var opts_width = this.__opts_width__ || 4
|
||||||
var prefix = this.__doc_prefix__ || ''
|
var prefix = this.__doc_prefix__ || ''
|
||||||
|
b = [b, ...rest].join('\n'+ ('\t'.repeat(opts_width+1) + ' '.repeat(prefix.length)))
|
||||||
return b ?
|
return b ?
|
||||||
(a.raw.length < opts_width*8 ?
|
(a.raw.length < opts_width*8 ?
|
||||||
[a +'\t'.repeat(opts_width - Math.floor(a.raw.length/8))+ prefix + b]
|
[a +'\t'.repeat(opts_width - Math.floor(a.raw.length/8))+ prefix + b]
|
||||||
@ -753,17 +754,39 @@ if(typeof(__filename) != 'undefined'
|
|||||||
ArgvParser({
|
ArgvParser({
|
||||||
// doc...
|
// doc...
|
||||||
__usage__: `$scriptname [OPTIONS] [CHAIN] ...`,
|
__usage__: `$scriptname [OPTIONS] [CHAIN] ...`,
|
||||||
__doc__: 'Run tests on object.js module.',
|
__doc__: object.normalizeTextIndent(
|
||||||
|
`Run tests on object.js module.
|
||||||
|
|
||||||
|
Tests run by $scriptname can be specified in one of the
|
||||||
|
following formats:
|
||||||
|
|
||||||
|
<case>
|
||||||
|
<setup>:<test>
|
||||||
|
<setup>:<modifier>:<test>
|
||||||
|
|
||||||
|
Each of the items in the test spec can be a "*" indicating
|
||||||
|
that all relevant items should be used, for example:
|
||||||
|
|
||||||
|
${ '$ ./$scriptname basic:*:*'.gray }
|
||||||
|
|
||||||
|
Here $scriptname is instructed to run all tests and modifiers
|
||||||
|
only on the basic setup.
|
||||||
|
|
||||||
|
Zero or more sets of tests can be specified.
|
||||||
|
|
||||||
|
When no tests specified $scriptname will run all tests.
|
||||||
|
`),
|
||||||
__examples__: [
|
__examples__: [
|
||||||
['$ ./$scriptname',
|
['$ ./$scriptname'.gray,
|
||||||
'run all tests.'],
|
'run all tests.'],
|
||||||
['$ ./$scriptname basic:*:*',
|
['$ ./$scriptname basic:*:*'.gray,
|
||||||
'run all tests and modifiers on "basic" setup.'],
|
'run all tests and modifiers on "basic" setup.',
|
||||||
['$ ./$scriptname -v example',
|
'(see '+ '$scriptname -l'.gray +' for more info)'],
|
||||||
|
['$ ./$scriptname -v example'.gray,
|
||||||
'run "example" test in verbose mode.'],
|
'run "example" test in verbose mode.'],
|
||||||
['$ ./$scriptname native:gen3:methods init:gen3:methods',
|
['$ ./$scriptname native:gen3:methods init:gen3:methods'.gray,
|
||||||
'run two tests/patterns.'],
|
'run two tests/patterns.'],
|
||||||
['$ export VERBOSE=1 && ./$scriptname',
|
['$ export VERBOSE=1 && ./$scriptname'.gray,
|
||||||
'set verbose mode globally and run tests.'],
|
'set verbose mode globally and run tests.'],
|
||||||
],
|
],
|
||||||
// options...
|
// options...
|
||||||
@ -772,7 +795,13 @@ if(typeof(__filename) != 'undefined'
|
|||||||
doc: 'list available tests.',
|
doc: 'list available tests.',
|
||||||
handler: function(){
|
handler: function(){
|
||||||
console.log(object.normalizeTextIndent(
|
console.log(object.normalizeTextIndent(
|
||||||
`Setups:
|
`Test run by %s can be of the following forms:
|
||||||
|
|
||||||
|
<case>
|
||||||
|
<setup>:<test>
|
||||||
|
<setup>:<modifier>:<test>
|
||||||
|
|
||||||
|
Setups:
|
||||||
${ Object.keys(setups).join('\n\
|
${ Object.keys(setups).join('\n\
|
||||||
') }
|
') }
|
||||||
|
|
||||||
@ -787,7 +816,7 @@ if(typeof(__filename) != 'undefined'
|
|||||||
Standalone test cases:
|
Standalone test cases:
|
||||||
${ Object.keys(cases).join('\n\
|
${ Object.keys(cases).join('\n\
|
||||||
') }
|
') }
|
||||||
`))
|
`), this.scriptname)
|
||||||
process.exit() }},
|
process.exit() }},
|
||||||
v: 'verbose',
|
v: 'verbose',
|
||||||
verbose: {
|
verbose: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user