Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix tests after V8 6.0 GC changes #85

Merged
merged 1 commit into from
Aug 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions test/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Object', function () {
assert.deepEqual(obj, out)
})

it('should retain references to written Objects', function () {
it('should retain references to written Objects', function (done) {
var o_gc = false
var buf_gc = false
var o = { foo: 'bar' }
Expand All @@ -41,9 +41,12 @@ describe('Object', function () {

// now GC `buf`
buf = null
gc()
assert(buf_gc, '"buf" has not been garbage collected')
assert(o_gc, '"o" has not been garbage collected')
setImmediate(function () {
gc()
assert(buf_gc, '"buf" has not been garbage collected')
assert(o_gc, '"o" has not been garbage collected')
done()
});
})

it('should throw an Error when reading an Object from the NULL pointer', function () {
Expand Down
11 changes: 7 additions & 4 deletions test/pointer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('pointer', function () {
assert.strictEqual(ref.address(out), ref.address(test))
})

it('should retain references to a written pointer in a Buffer', function () {
it('should retain references to a written pointer in a Buffer', function (done) {
var child_gc = false
var parent_gc = false
var child = new Buffer('a pointer holding some data...')
Expand All @@ -40,9 +40,12 @@ describe('pointer', function () {

// now GC `parent`
parent = null
gc()
assert(parent_gc, '"parent" has not been garbage collected')
assert(child_gc, '"child" has not been garbage collected')
setImmediate(function () {
gc()
assert(parent_gc, '"parent" has not been garbage collected')
assert(child_gc, '"child" has not been garbage collected')
done()
});
})

it('should throw an Error when reading from the NULL pointer', function () {
Expand Down