mirror of
https://github.com/flynx/test.js.git
synced 2025-10-28 10:20:09 +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:
|
||||
* 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 */
|
||||
((typeof define)[0]=='u'?function(f){module.exports=f(require)}:define)
|
||||
(function(require){ var module={} // make module AMD/node compatible...
|
||||
@ -30,23 +19,29 @@ var tests = require('./test')
|
||||
|
||||
tests.Setup('setup',
|
||||
function(assert){
|
||||
assert(true)
|
||||
assert(true, 'assert')
|
||||
return {} })
|
||||
|
||||
tests.Setups({
|
||||
setup2: function(assert){
|
||||
assert(true)
|
||||
assert(true, 'assert')
|
||||
return {} },
|
||||
setup3: function(assert){
|
||||
assert(true)
|
||||
assert(true, 'assert')
|
||||
return {} },
|
||||
})
|
||||
|
||||
// XXX for some reason this is run twice....
|
||||
tests.Test('dummy',
|
||||
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...
|
||||
// for the number of members use:
|
||||
// <constructor>.members.length
|
||||
get length(){
|
||||
return this.members.keys().length },
|
||||
// XXX for some reason this is shadowed by .length set on the
|
||||
// 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){
|
||||
this.members.push(member)
|
||||
@ -243,13 +248,16 @@ module.Modifier =
|
||||
module.Modifiers =
|
||||
object.Constructor('Modifiers', Merged, {})
|
||||
// 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 =
|
||||
module.Test =
|
||||
module.Tests =
|
||||
object.Constructor('Tests', Merged, {})
|
||||
// XXX should this be here or should each setup be run alone...
|
||||
.add({ '-': function(_, s){ return s } })
|
||||
|
||||
|
||||
var Cases =
|
||||
@ -260,7 +268,7 @@ object.Constructor('Cases', Merged, {})
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Test runner...
|
||||
// Test runner/combinator...
|
||||
//
|
||||
// runner(spec)
|
||||
// runner(spec, '*')
|
||||
@ -284,6 +292,7 @@ object.Constructor('Cases', Merged, {})
|
||||
// NOTE: chaining more than one modifier is not yet supported (XXX)
|
||||
//
|
||||
// XXX make Assert optional...
|
||||
// XXX is this a good name???
|
||||
var runner =
|
||||
module.runner =
|
||||
function(spec, chain, stats){
|
||||
@ -363,6 +372,7 @@ function(spec, chain, stats){
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// CLI...
|
||||
//
|
||||
var parser =
|
||||
module.parser =
|
||||
argv.Parser({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user