forked from linaGirl/ee-class
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.js
More file actions
87 lines (61 loc) · 1.99 KB
/
test.js
File metadata and controls
87 lines (61 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//
var Class = require("./lib/Class"),
util = require('util'),
assert = require("assert");
console.log(
util.inspect(
Class('visible string').Enumerable(),
{
showHidden: true,
depth: 500,
colors: true
}
)
);
/*
var y = Object.create(null, {id:{value:4, enumerable:true}, go: {value: function(){console.dir(1212)}}})
, x = Object.create(y, {name:{value:9, enumerable:true}});
console.log(util.inspect(Object.getPrototypeOf(x), { showHidden: true, depth: 500, colors: true }));
x.go();
return;
*/
var LifeForm = new Class({
inherits: Array,
isAlive: false,
age: 0,
name: 'ficken',
init: function lifeform(options) {
this.isAlive = !!options.isAlive;
this.age = options.age;
this.name = options.name;
//console.log(util.inspect(this, { showHidden: true, depth: null, colors: true }));
}
});
var Human = new Class({
inherits: LifeForm/*,
init: function human( options ){
console.log('human', options);
human.super.call(this, options);
console.log(util.inspect(this, { showHidden: true, depth: null, colors: true }));
}*/
});
var Boy = new Class({
inherits: Human,
init: function boy(options) {
boy.super.call(this, options);
//console.log(util.inspect(this, { showHidden: true, depth: null, colors: true }));
},
describe: function() {
console.log("Hi, my name is %s, i'm %s years old and i'm " + (this.isAlive ? "alive :)" : "dead :("), this.name, this.age);
//assert.equal( this.age, 15, "The «age» property was not set!");
//assert.equal( this.name, "fabian", "The «fabian» property was not set!");
//assert.equal( this.isAlive, true, "The «alive» property was not set!");
}
});
var fabian = new Boy({
name: "fabian",
age: 15,
isAlive: true
});
fabian.describe();
//console.log(util.inspect(fabian.__proto__.__proto__.__proto__, { showHidden: true, depth: 50, colors: true }));