summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/function-tosource-getset.js
blob: c8e800751370ef78cb6410b74efb929ad126bc18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
var o = {get prop() { a + b; }, set prop(x) { a + b; }};
var prop = Object.getOwnPropertyDescriptor(o, "prop");
assertEq(prop.get.toString(), "get prop() { a + b; }");
if (Function.prototype.toSource) {
    assertEq(prop.get.toSource(), "get prop() { a + b; }");
}
assertEq(prop.set.toString(), "set prop(x) { a + b; }");
if (Function.prototype.toSource) {
    assertEq(prop.set.toSource(), "set prop(x) { a + b; }");
}
if (Object.prototype.toSource) {
    assertEq(o.toSource(), "({get prop() { a + b; }, set prop(x) { a + b; }})");
}