mirror of
https://github.com/flynx/test.js.git
synced 2025-10-29 19:00:07 +00:00
tweaking....
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
f9ca4d5d7c
commit
c438fa9275
25
test-test.js
25
test-test.js
@ -6,17 +6,6 @@
|
|||||||
* Repo and docs:
|
* Repo and docs:
|
||||||
* https://github.com/flynx/test.js
|
* https://github.com/flynx/test.js
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* XXX need an interface, preferably zero-config with command-line...
|
|
||||||
* something like:
|
|
||||||
* $ ig-test ./test.js base:*:* - test script...
|
|
||||||
* or:
|
|
||||||
* $ ig-test base:*:* - locate tests...
|
|
||||||
* XXX need a way to reuse the thing...
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
***********************************************/ /* c8 ignore next 2 */
|
***********************************************/ /* c8 ignore next 2 */
|
||||||
((typeof define)[0]=='u'?function(f){module.exports=f(require)}:define)
|
((typeof define)[0]=='u'?function(f){module.exports=f(require)}:define)
|
||||||
(function(require){ var module={} // make module AMD/node compatible...
|
(function(require){ var module={} // make module AMD/node compatible...
|
||||||
@ -30,23 +19,29 @@ var tests = require('./test')
|
|||||||
|
|
||||||
tests.Setup('setup',
|
tests.Setup('setup',
|
||||||
function(assert){
|
function(assert){
|
||||||
assert(true)
|
assert(true, 'assert')
|
||||||
return {} })
|
return {} })
|
||||||
|
|
||||||
tests.Setups({
|
tests.Setups({
|
||||||
setup2: function(assert){
|
setup2: function(assert){
|
||||||
assert(true)
|
assert(true, 'assert')
|
||||||
return {} },
|
return {} },
|
||||||
setup3: function(assert){
|
setup3: function(assert){
|
||||||
assert(true)
|
assert(true, 'assert')
|
||||||
return {} },
|
return {} },
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// XXX for some reason this is run twice....
|
||||||
tests.Test('dummy',
|
tests.Test('dummy',
|
||||||
function(assert, setup){
|
function(assert, setup){
|
||||||
assert(true)
|
assert(true, 'assert')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
console.log('>>>>', tests.Tests.members)
|
||||||
|
console.log('>>>>', tests.Tests.keys())
|
||||||
|
// XXX this does not call the Merged.length for some reason...
|
||||||
|
console.log('>>>>', tests.Tests.size)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
18
test.js
18
test.js
@ -197,8 +197,13 @@ object.Constructor('Merged', {
|
|||||||
// of members...
|
// of members...
|
||||||
// for the number of members use:
|
// for the number of members use:
|
||||||
// <constructor>.members.length
|
// <constructor>.members.length
|
||||||
get length(){
|
// XXX for some reason this is shadowed by .length set on the
|
||||||
return this.members.keys().length },
|
// constructor....
|
||||||
|
// poked around a bit, .length seems to be the number of arguments
|
||||||
|
// in a function, so we should use something differernt here...
|
||||||
|
// ...should rename this to something else...
|
||||||
|
get size(){
|
||||||
|
return this.keys().length },
|
||||||
|
|
||||||
add: function(member){
|
add: function(member){
|
||||||
this.members.push(member)
|
this.members.push(member)
|
||||||
@ -243,13 +248,16 @@ module.Modifier =
|
|||||||
module.Modifiers =
|
module.Modifiers =
|
||||||
object.Constructor('Modifiers', Merged, {})
|
object.Constructor('Modifiers', Merged, {})
|
||||||
// a basic default...
|
// a basic default...
|
||||||
.add({ 'as-is': function(_, s){ return s } })
|
// XXX should this be here or should each setup be run alone...
|
||||||
|
.add({ '-': function(_, s){ return s } })
|
||||||
|
|
||||||
|
|
||||||
var Tests =
|
var Tests =
|
||||||
module.Test =
|
module.Test =
|
||||||
module.Tests =
|
module.Tests =
|
||||||
object.Constructor('Tests', Merged, {})
|
object.Constructor('Tests', Merged, {})
|
||||||
|
// XXX should this be here or should each setup be run alone...
|
||||||
|
.add({ '-': function(_, s){ return s } })
|
||||||
|
|
||||||
|
|
||||||
var Cases =
|
var Cases =
|
||||||
@ -260,7 +268,7 @@ object.Constructor('Cases', Merged, {})
|
|||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
// Test runner...
|
// Test runner/combinator...
|
||||||
//
|
//
|
||||||
// runner(spec)
|
// runner(spec)
|
||||||
// runner(spec, '*')
|
// runner(spec, '*')
|
||||||
@ -284,6 +292,7 @@ object.Constructor('Cases', Merged, {})
|
|||||||
// NOTE: chaining more than one modifier is not yet supported (XXX)
|
// NOTE: chaining more than one modifier is not yet supported (XXX)
|
||||||
//
|
//
|
||||||
// XXX make Assert optional...
|
// XXX make Assert optional...
|
||||||
|
// XXX is this a good name???
|
||||||
var runner =
|
var runner =
|
||||||
module.runner =
|
module.runner =
|
||||||
function(spec, chain, stats){
|
function(spec, chain, stats){
|
||||||
@ -363,6 +372,7 @@ function(spec, chain, stats){
|
|||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
// CLI...
|
// CLI...
|
||||||
|
//
|
||||||
var parser =
|
var parser =
|
||||||
module.parser =
|
module.parser =
|
||||||
argv.Parser({
|
argv.Parser({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user