mirror of
https://github.com/flynx/argv.js.git
synced 2025-10-28 18:30:07 +00:00
reworking tests...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
2641f377d0
commit
889007f85a
69
test.js
69
test.js
@ -15,42 +15,27 @@ var test = require('ig-test')
|
|||||||
var argv = require('./argv')
|
var argv = require('./argv')
|
||||||
|
|
||||||
|
|
||||||
var bare = module.bare = require('./examples/bare').parser
|
|
||||||
var options = module.options = require('./examples/options').parser
|
|
||||||
var lang = module.lang = require('./examples/lang').parser
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
test.Setups({
|
|
||||||
bare: require('./examples/bare').parser,
|
|
||||||
options: require('./examples/options').parser,
|
|
||||||
lang: require('./examples/lang').parser,
|
|
||||||
})
|
|
||||||
|
|
||||||
test.Modifiers({
|
|
||||||
})
|
|
||||||
|
|
||||||
test.Tests({
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
test.Cases({
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
argv.Parser.typeHandlers.error = function(){
|
argv.Parser.typeHandlers.error = function(){
|
||||||
throw new argv.ParserTypeError('type error') }
|
throw new argv.ParserTypeError('type error') }
|
||||||
|
|
||||||
|
|
||||||
var p =
|
|
||||||
module.p =
|
//---------------------------------------------------------------------
|
||||||
argv.Parser({
|
|
||||||
|
var setups =
|
||||||
|
test.Setups({
|
||||||
|
bare: function(){
|
||||||
|
return require('./examples/bare').parser },
|
||||||
|
options: function(){
|
||||||
|
return require('./examples/options').parser },
|
||||||
|
lang: function(){
|
||||||
|
return require('./examples/lang').parser },
|
||||||
|
|
||||||
|
// NOTE: this will also load .bare, .options and .lang
|
||||||
|
basic: function(assert){
|
||||||
|
return argv.Parser({
|
||||||
// disable exit on error...
|
// disable exit on error...
|
||||||
handleErrorExit: false,
|
handleErrorExit: false,
|
||||||
|
|
||||||
@ -185,10 +170,9 @@ argv.Parser({
|
|||||||
'-m': '-k',
|
'-m': '-k',
|
||||||
|
|
||||||
|
|
||||||
'@bare': bare,
|
'@bare': setups.bare(assert),
|
||||||
'@opts': options,
|
'@opts': setups.options(assert),
|
||||||
|
'@lang': setups.lang(assert),
|
||||||
'@lang': lang,
|
|
||||||
|
|
||||||
|
|
||||||
// collision test...
|
// collision test...
|
||||||
@ -204,8 +188,17 @@ argv.Parser({
|
|||||||
.stop(function(){
|
.stop(function(){
|
||||||
console.log('STOP', ...arguments) })
|
console.log('STOP', ...arguments) })
|
||||||
.error(function(){
|
.error(function(){
|
||||||
console.log('ERROR', ...arguments) })
|
console.log('ERROR', ...arguments) }) }
|
||||||
|
})
|
||||||
|
|
||||||
|
test.Modifiers({
|
||||||
|
})
|
||||||
|
|
||||||
|
test.Tests({
|
||||||
|
})
|
||||||
|
|
||||||
|
test.Cases({
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -224,10 +217,12 @@ p(['test', 'nested', '-h'])
|
|||||||
p(['test', '-h'])
|
p(['test', '-h'])
|
||||||
//*/
|
//*/
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
typeof(__filename) != 'undefined'
|
typeof(__filename) != 'undefined'
|
||||||
&& __filename == (require.main || {}).filename
|
&& __filename == (require.main || {}).filename
|
||||||
&& console.log(p())
|
&& console.log(setups.basic()())
|
||||||
//&& console.log(lang())
|
|
||||||
//&& test.run()
|
//&& test.run()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user