mirror of
https://github.com/flynx/object.js.git
synced 2025-10-29 10:30:08 +00:00
more testing + cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
7e787fe028
commit
4167536a77
63
test.js
63
test.js
@ -321,23 +321,48 @@ var ArgvParser = function(spec){
|
||||
var setups =
|
||||
module.setups = {
|
||||
// basic constructor and inheritance...
|
||||
//
|
||||
// X
|
||||
// Y <- A <- B <- C
|
||||
//
|
||||
basic: function(assert){
|
||||
var X, Y, A, B, C
|
||||
return {
|
||||
X: X = assert(object.Constructor('A'), `Constructor`),
|
||||
Y: Y = assert(object.C('Y', { }), `C`),
|
||||
|
||||
A: A = assert(object.C('A', Y, { }), `inherit (gen1)`),
|
||||
B: B = assert(object.C('B', A, { }, { }), `inherit (gen2) with constructor mixin`),
|
||||
C: C = assert(object.C('C', B, { }), `inherit (gen3)`),
|
||||
} },
|
||||
|
||||
/*/ XXX constructor methods or add this to basic...
|
||||
methods: function(assert){
|
||||
return {
|
||||
}
|
||||
X: X = assert(object.Constructor('X'), `.Constructor(..)`),
|
||||
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, {
|
||||
method: function(){
|
||||
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)`),
|
||||
} },
|
||||
|
||||
// initialization...
|
||||
init: function(assert){
|
||||
@ -438,18 +463,6 @@ module.setups = {
|
||||
return res
|
||||
}, {}) },
|
||||
|
||||
/*/ XXX methods (instance/constructor)...
|
||||
methods: function(assert){
|
||||
return {} },
|
||||
//*/
|
||||
|
||||
/*/ XXX mixins...
|
||||
mixin: function(assert){
|
||||
return {
|
||||
|
||||
} },
|
||||
//*/
|
||||
|
||||
// compatibility: native constructors...
|
||||
js_constructors: function(assert){
|
||||
var X, Y, Z, a, b, c, d
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user