Skip to content

Commit

Permalink
test: use default assertion messages
Browse files Browse the repository at this point in the history
The string literal messages in addons-napi/test_buffer/test.js are less
helpful than the default messages, so use the default messages.

Backport-PR-URL: #19447
PR-URL: #16808
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
trootski authored and MylesBorins committed Apr 16, 2018
1 parent 087d213 commit d31792f
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions test/addons-napi/test_buffer/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,17 @@ const common = require('../../common');
const binding = require(`./build/${common.buildType}/test_buffer`);
const assert = require('assert');

assert.strictEqual(binding.newBuffer().toString(), binding.theText,
'buffer returned by newBuffer() has wrong contents');
assert.strictEqual(binding.newExternalBuffer().toString(), binding.theText,
'buffer returned by newExternalBuffer() has wrong contents');
assert.strictEqual(binding.newBuffer().toString(), binding.theText);
assert.strictEqual(binding.newExternalBuffer().toString(), binding.theText);
console.log('gc1');
global.gc();
assert.strictEqual(binding.getDeleterCallCount(), 1, 'deleter was not called');
assert.strictEqual(binding.copyBuffer().toString(), binding.theText,
'buffer returned by copyBuffer() has wrong contents');
assert.strictEqual(binding.copyBuffer().toString(), binding.theText);

let buffer = binding.staticBuffer();
assert.strictEqual(binding.bufferHasInstance(buffer), true,
'buffer type checking fails');
assert.strictEqual(binding.bufferInfo(buffer), true, 'buffer data is accurate');
assert.strictEqual(binding.bufferInfo(buffer), true);
buffer = null;
global.gc();
console.log('gc2');
Expand Down

0 comments on commit d31792f

Please sign in to comment.