~ubuntu-branches/ubuntu/saucy/mozjs17/saucy

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Rico Tzschichholz
  • Date: 2013-05-25 12:24:23 UTC
  • Revision ID: package-import@ubuntu.com-20130525122423-zmxucrhtensw90xy
Tags: upstream-17.0.0
ImportĀ upstreamĀ versionĀ 17.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Basic getOwnPropertyNames tests.
 
2
 
 
3
var g = newGlobal('new-compartment');
 
4
var dbg = Debugger();
 
5
var gobj = dbg.addDebuggee(g);
 
6
 
 
7
function 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
 
 
15
test("{}");
 
16
test("{a: 0, b: 1}");
 
17
test("{'name with space': 0}");
 
18
test("{get x() {}, set y(v) {}}");
 
19
test("{get x() { throw 'fit'; }}");
 
20
test("Object.create({a: 1})");
 
21
test("Object.create({get a() {}, set a(v) {}})");
 
22
test("(function () { var x = {a: 0, b: 1}; delete a; return x; })()");
 
23
test("Object.create(null, {x: {value: 0}})");
 
24
test("[]");
 
25
test("[0, 1, 2]");
 
26
test("[,,,,,]");
 
27
test("/a*a/");
 
28
test("function () {}");