| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4d43607 commit 5c0983e
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -63,22 +63,25 @@ let w = {}; | |||
| 63 | 63 | test_general.wrap(w); | |
| 64 | 64 | w = null; | |
| 65 | 65 | global.gc(); | |
| 66 | - assert.strictEqual(test_general.derefItemWasCalled(), true, | ||
| 66 | + const derefItemWasCalled = test_general.derefItemWasCalled(); | ||
| 67 | + assert.strictEqual(derefItemWasCalled, true, | ||
| 67 | 68 | 'deref_item() was called upon garbage collecting a ' + | |
| 68 | - 'wrapped object'); | ||
| 69 | + 'wrapped object. test_general.derefItemWasCalled() ' + | ||
| 70 | + `returned ${derefItemWasCalled}`); | ||
| 71 | + | ||
| 69 | 72 | ||
| 70 | 73 | // Assert that wrapping twice fails. | |
| 71 | 74 | const x = {}; | |
| 72 | 75 | test_general.wrap(x); | |
| 73 | - assert.throws(() => test_general.wrap(x), Error); | ||
| 76 | + common.expectsError(() => test_general.wrap(x), | ||
| 77 | + { type: Error, message: 'Invalid argument' }); | ||
| 74 | 78 | ||
| 75 | 79 | // Ensure that wrapping, removing the wrap, and then wrapping again works. | |
| 76 | 80 | const y = {}; | |
| 77 | 81 | test_general.wrap(y); | |
| 78 | 82 | test_general.removeWrap(y); | |
| 79 | - assert.doesNotThrow(() => test_general.wrap(y), Error, | ||
| 80 | - 'Wrapping twice succeeds if a remove_wrap()' + | ||
| 81 | - ' separates the instances'); | ||
| 83 | + // Wrapping twice succeeds if a remove_wrap() separates the instances | ||
| 84 | + assert.doesNotThrow(() => test_general.wrap(y)); | ||
| 82 | 85 | ||
| 83 | 86 | // Ensure that removing a wrap and garbage collecting does not fire the | |
| 84 | 87 | // finalize callback. | |
@@ -87,8 +90,11 @@ test_general.testFinalizeWrap(z); | |||
| 87 | 90 | test_general.removeWrap(z); | |
| 88 | 91 | z = null; | |
| 89 | 92 | global.gc(); | |
| 90 | - assert.strictEqual(test_general.finalizeWasCalled(), false, | ||
| 91 | - 'finalize callback was not called upon garbage collection'); | ||
| 93 | + const finalizeWasCalled = test_general.finalizeWasCalled(); | ||
| 94 | + assert.strictEqual(finalizeWasCalled, false, | ||
| 95 | + 'finalize callback was not called upon garbage collection.' + | ||
| 96 | + ' test_general.finalizeWasCalled() ' + | ||
| 97 | + `returned ${finalizeWasCalled}`); | ||
| 92 | 98 | ||
| 93 | 99 | // test napi_adjust_external_memory | |
| 94 | 100 | const adjustedValue = test_general.testAdjustExternalMemory(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments