PageRenderTime 13ms CodeModel.GetById 9ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/js/src/jit-test/tests/debug/Object-getOwnPropertyNames-01.js

http://github.com/zpao/v8monkey
JavaScript | 28 lines | 24 code | 3 blank | 1 comment | 0 complexity | a437f914be4ecaa5bd33706200a4014c MD5 | raw file
 1// Basic getOwnPropertyNames tests.
 2
 3var g = newGlobal('new-compartment');
 4var dbg = Debugger();
 5var gobj = dbg.addDebuggee(g);
 6
 7function test(code) {
 8    code = "(" + code + ");";
 9    var expected = Object.getOwnPropertyNames(eval(code));
10    g.eval("obj = " + code);
11    var actual = gobj.getOwnPropertyDescriptor("obj").value.getOwnPropertyNames();
12    assertEq(JSON.stringify(actual.sort()), JSON.stringify(expected.sort()));
13}
14
15test("{}");
16test("{a: 0, b: 1}");
17test("{'name with space': 0}");
18test("{get x() {}, set y(v) {}}");
19test("{get x() { throw 'fit'; }}");
20test("Object.create({a: 1})");
21test("Object.create({get a() {}, set a(v) {}})");
22test("(function () { var x = {a: 0, b: 1}; delete a; return x; })()");
23test("Object.create(null, {x: {value: 0}})");
24test("[]");
25test("[0, 1, 2]");
26test("[,,,,,]");
27test("/a*a/");
28test("function () {}");