Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
test: fixing test_constructor
Browse files Browse the repository at this point in the history
Upstream changes had made test_constructor depend on specific error
messages, so this change adds support for ChakraCore's error messages.
  • Loading branch information
MSLaguana committed Aug 18, 2017
1 parent 40abd9c commit 2f9535c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test/addons-napi/test_constructor/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ test_object.readwriteValue = 2;
assert.strictEqual(test_object.readwriteValue, 2);

assert.throws(() => { test_object.readonlyValue = 3; },
/^TypeError: Cannot assign to read only property 'readonlyValue' of object '#<MyObject>'$/);
common.engineSpecificMessage({
v8: /^TypeError: Cannot assign to read only property 'readonlyValue' of object '#<MyObject>'$/,
chakracore: /^TypeError: Assignment to read-only properties is not allowed in strict mode$/}));

assert.ok(test_object.hiddenValue);

Expand All @@ -37,12 +39,16 @@ test_object.readwriteAccessor1 = 1;
assert.strictEqual(test_object.readwriteAccessor1, 1);
assert.strictEqual(test_object.readonlyAccessor1, 1);
assert.throws(() => { test_object.readonlyAccessor1 = 3; },
/^TypeError: Cannot assign to read only property 'readonlyAccessor1' of object '#<MyObject>'$/);
common.engineSpecificMessage({
v8: /^TypeError: Cannot assign to read only property 'readonlyAccessor1' of object '#<MyObject>'$/,
chakracore: /^TypeError: Assignment to read-only properties is not allowed in strict mode$/}));
test_object.readwriteAccessor2 = 2;
assert.strictEqual(test_object.readwriteAccessor2, 2);
assert.strictEqual(test_object.readonlyAccessor2, 2);
assert.throws(() => { test_object.readonlyAccessor2 = 3; },
/^TypeError: Cannot assign to read only property 'readonlyAccessor2' of object '#<MyObject>'$/);
common.engineSpecificMessage({
v8: /^TypeError: Cannot assign to read only property 'readonlyAccessor2' of object '#<MyObject>'$/,
chakracore: /^TypeError: Assignment to read-only properties is not allowed in strict mode$/}));

// validate that static properties are on the class as opposed
// to the instance
Expand Down

0 comments on commit 2f9535c

Please sign in to comment.