more testing + cleanup...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-06-08 04:54:40 +03:00
parent 7e787fe028
commit 4167536a77

61
test.js
View File

@ -321,24 +321,49 @@ var ArgvParser = function(spec){
var setups = var setups =
module.setups = { module.setups = {
// basic constructor and inheritance... // basic constructor and inheritance...
//
// X
// Y <- A <- B <- C
//
basic: function(assert){ basic: function(assert){
var X, Y, A, B, C var X, Y, A, B, C
return { return {
X: X = assert(object.Constructor('A'), `Constructor`), X: X = assert(object.Constructor('X'), `.Constructor(..)`),
Y: Y = assert(object.C('Y', { }), `C`), Y: Y = assert(object.C('Y', {
method: function(){
var x
assert(
(x = object.parentCall(Y.prototype.method, this, ...arguments)) === undefined,
'y.method(..): expected:', undefined, 'got:', x)
return 'Y'
},
}), `.C(..)`),
A: A = assert(object.C('A', Y, { }), `inherit (gen1)`), A: A = assert(object.C('A', Y, {
B: B = assert(object.C('B', A, { }, { }), `inherit (gen2) with constructor mixin`), method: function(){
C: C = assert(object.C('C', B, { }), `inherit (gen3)`), var x
assert(
(x = object.parentCall(A.prototype.method, this, ...arguments)) == 'Y',
'a.method(..): expected:', 'Y', 'got:', x)
return 'A'
},
}), `inherit (gen1)`),
B: B = assert(object.C('B', A, {
// XXX constructor methods...
}, {
// XXX methods...
}), `inherit (gen2) with constructor mixin`),
C: C = assert(object.C('C', B, {
method: function(){
var x
assert(
(x = object.parentCall(C.prototype.method, this, ...arguments)) == 'A',
'c.method(..): expected:', 'A', 'got:', x)
return 'C'
},
}), `inherit (gen3)`),
} }, } },
/*/ XXX constructor methods or add this to basic...
methods: function(assert){
return {
}
},
//*/
// initialization... // initialization...
init: function(assert){ init: function(assert){
var A, B, C var A, B, C
@ -438,18 +463,6 @@ module.setups = {
return res return res
}, {}) }, }, {}) },
/*/ XXX methods (instance/constructor)...
methods: function(assert){
return {} },
//*/
/*/ XXX mixins...
mixin: function(assert){
return {
} },
//*/
// compatibility: native constructors... // compatibility: native constructors...
js_constructors: function(assert){ js_constructors: function(assert){
var X, Y, Z, a, b, c, d var X, Y, Z, a, b, c, d