File: Object.js

package info (click to toggle)
kjs 5.103.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,020 kB
  • sloc: cpp: 36,704; javascript: 5,079; yacc: 790; perl: 191; sh: 52; makefile: 7
file content (22 lines) | stat: -rw-r--r-- 1,075 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
shouldBe("typeof Object()", "'object'");
shouldBe("var o = Object(); o.x = 11; o.x;", "11");
shouldBeTrue("Object(undefined).__proto__ === Object.prototype");
shouldBeTrue("Object(null).__proto__ === Object.prototype");
shouldBe("Object(1).valueOf()", "1");
shouldBe("Object(true).valueOf()", "true");
shouldBe("Object('s').valueOf()", "'s'");
shouldBe("Object({x: 12}).x", "12");

shouldBe("typeof (new Object())", "'object'");
shouldBeTrue("(new Object(undefined)).__proto__ === Object.prototype");
shouldBeTrue("(new Object(null)).__proto__ === Object.prototype");
shouldBeTrue("(new Object(1)).__proto__ === Number.prototype");
shouldBe("(new Object(1)).valueOf()", "1");
shouldBeTrue("(new Object(true)).__proto__ === Boolean.prototype");
shouldBe("(new Object(true)).valueOf()", "true");
shouldBeTrue("(new Object('s')).__proto__ === String.prototype");
shouldBe("(new Object('s')).valueOf()", "'s'");

shouldBe("String(Object())", "'[object Object]'");
shouldBe("Object().toString()", "'[object Object]'");
shouldBe("String(Object().valueOf())", "'[object Object]'");