
The PropertyName class able to match a number or an array can only accept positive numerical values. However, the computed_property_name method sometimes returned negative values. This commit also adds a basic object access test case.
17 lines
No EOL
437 B
JavaScript
17 lines
No EOL
437 B
JavaScript
try {
|
|
var o = { foo: "bar" };
|
|
assert(o.foo === "bar");
|
|
assert(o["foo"] === "bar");
|
|
o.baz = "test";
|
|
assert(o.baz === "test");
|
|
assert(o["baz"] === "test");
|
|
o[10] = "123";
|
|
assert(o[10] === "123");
|
|
assert(o["10"] === "123");
|
|
o[-1] = "hello friends";
|
|
assert(o[-1] === "hello friends");
|
|
assert(o["-1"] === "hello friends");
|
|
console.log("PASS");
|
|
} catch (e) {
|
|
console.log("FAIL: " + e);
|
|
} |