| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8a9de1b commit 0ff19b0
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,7 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | const common = require('../../common'); | |
| 3 | 3 | const assert = require('assert'); | |
| 4 | + const readonlyErrorRE = /^TypeError: Cannot assign to read only property '.*' of object '#<Object>'$/; | ||
| 4 | 5 | ||
| 5 | 6 | // Testing api calls for defining properties | |
| 6 | 7 | const test_object = require(`./build/${common.buildType}/test_properties`); | |
@@ -12,7 +13,7 @@ assert.strictEqual(test_object.readwriteValue, 1); | |||
| 12 | 13 | test_object.readwriteValue = 2; | |
| 13 | 14 | assert.strictEqual(test_object.readwriteValue, 2); | |
| 14 | 15 | ||
| 15 | - assert.throws(() => { test_object.readonlyValue = 3; }, TypeError); | ||
| 16 | + assert.throws(() => { test_object.readonlyValue = 3; }, readonlyErrorRE); | ||
| 16 | 17 | ||
| 17 | 18 | assert.ok(test_object.hiddenValue); | |
| 18 | 19 | ||
@@ -42,11 +43,11 @@ assert.strictEqual(symbolDescription, 'NameKeySymbol'); | |||
| 42 | 43 | test_object.readwriteAccessor1 = 1; | |
| 43 | 44 | assert.strictEqual(test_object.readwriteAccessor1, 1); | |
| 44 | 45 | assert.strictEqual(test_object.readonlyAccessor1, 1); | |
| 45 | - assert.throws(() => { test_object.readonlyAccessor1 = 3; }, TypeError); | ||
| 46 | + assert.throws(() => { test_object.readonlyAccessor1 = 3; }, readonlyErrorRE); | ||
| 46 | 47 | test_object.readwriteAccessor2 = 2; | |
| 47 | 48 | assert.strictEqual(test_object.readwriteAccessor2, 2); | |
| 48 | 49 | assert.strictEqual(test_object.readonlyAccessor2, 2); | |
| 49 | - assert.throws(() => { test_object.readonlyAccessor2 = 3; }, TypeError); | ||
| 50 | + assert.throws(() => { test_object.readonlyAccessor2 = 3; }, readonlyErrorRE); | ||
| 50 | 51 | ||
| 51 | 52 | assert.strictEqual(test_object.hasNamedProperty(test_object, 'echo'), true); | |
| 52 | 53 | assert.strictEqual(test_object.hasNamedProperty(test_object, 'hiddenValue'), | |
| Back | FazBrowse Home | New Git URL |
0 commit comments