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: refactor buffer tests #8256

Closed
wants to merge 12 commits into
base: master
from

Conversation

Projects
None yet
5 participants
@jasnell
Member

jasnell commented Aug 24, 2016

Checklist
  • make -j4 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
Affected core subsystem(s)

buffer,test

Description of change

Refactor the Buffer tests, eliminate duplication, move certain tests out to the own test files, updated and modernize, prefer use of strictEqual where appropriate.

@jasnell

This comment has been minimized.

Show comment
Hide comment
@targos

View changes

Show outdated Hide outdated test/parallel/test-buffer-failed-alloc-typed-arrays.js
for (const size of sizes) {
try {
// These allocations are known to fail. If they do,
// Uin32Array should still produce a zeroed out result.

This comment has been minimized.

@targos

targos Aug 24, 2016

Member

typo: Uint32Array

@targos

targos Aug 24, 2016

Member

typo: Uint32Array

This comment has been minimized.

@jasnell

jasnell Aug 24, 2016

Member

Fixed

@jasnell

jasnell Aug 24, 2016

Member

Fixed

@targos

This comment has been minimized.

Show comment
Hide comment
@targos

targos Aug 24, 2016

Member

LGTM. Thanks for keeping a lot of separate commits!

Member

targos commented Aug 24, 2016

LGTM. Thanks for keeping a lot of separate commits!

var b = Buffer.allocUnsafe(1024);
console.log('b.length == %d', b.length);
const b = Buffer.allocUnsafe(1024);
assert.strictEqual(1024, b.length);

This comment has been minimized.

@Trott

Trott Aug 24, 2016

Member

The API for assert.strictEqual() and friends indicates that the actual value received should be the first parameter and the expected value should be second but it's backwards here and below. Feel free to leave it as is (since this isn't code you wrote, it's just an adjacent line), but if you want to swap them, hey, go for it.

@Trott

Trott Aug 24, 2016

Member

The API for assert.strictEqual() and friends indicates that the actual value received should be the first parameter and the expected value should be second but it's backwards here and below. Feel free to leave it as is (since this isn't code you wrote, it's just an adjacent line), but if you want to swap them, hey, go for it.

This comment has been minimized.

@Trott

Trott Aug 24, 2016

Member

(And yes, I'm going for the most useless nit I can imagine here. Like I said, feel free to ignore.)

@Trott

Trott Aug 24, 2016

Member

(And yes, I'm going for the most useless nit I can imagine here. Like I said, feel free to ignore.)

This comment has been minimized.

@jasnell

jasnell Aug 26, 2016

Member

There are many places in the tests where they are in the wrong order. For now, I'm inclined to leave these as they are. It would be a good first contribution for someone tho :-)

@jasnell

jasnell Aug 26, 2016

Member

There are many places in the tests where they are in the wrong order. For now, I'm inclined to leave these as they are. It would be a good first contribution for someone tho :-)

jasnell added a commit that referenced this pull request Aug 26, 2016

test: clean up / refactor buffer tests, remove duplication
Remove duplication of buffer tests, separate out into separate
files, update and cleanup code, move to using strictEqual where
possible.

PR-URL: #8256
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
@jasnell

This comment has been minimized.

Show comment
Hide comment
@jasnell

jasnell Aug 26, 2016

Member

Landed in 7053922!

Member

jasnell commented Aug 26, 2016

Landed in 7053922!

@jasnell jasnell closed this Aug 26, 2016

@Fishrock123 Fishrock123 referenced this pull request Sep 6, 2016

Closed

v6.6.0 pre-proposal #8428

@Fishrock123

This comment has been minimized.

Show comment
Hide comment
@Fishrock123

Fishrock123 Sep 7, 2016

Member

Having lots of conflicts on this into v6.

Member

Fishrock123 commented Sep 7, 2016

Having lots of conflicts on this into v6.

Fishrock123 added a commit to Fishrock123/node that referenced this pull request Sep 8, 2016

test: clean up / refactor buffer tests, remove duplication
Remove duplication of buffer tests, separate out into separate
files, update and cleanup code, move to using strictEqual where
possible.

PR-URL: nodejs#8256
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>

 Conflicts:
	test/parallel/test-buffer-alloc.js
	test/parallel/test-buffer.js
	test/parallel/test-buffer-no-negative-allocation.js

Fishrock123 added a commit that referenced this pull request Sep 9, 2016

test: clean up / refactor buffer tests, remove duplication
Remove duplication of buffer tests, separate out into separate
files, update and cleanup code, move to using strictEqual where
possible.

PR-URL: #8256
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>

 Conflicts:
	test/parallel/test-buffer-alloc.js
	test/parallel/test-buffer.js
	test/parallel/test-buffer-no-negative-allocation.js
@MylesBorins

This comment has been minimized.

Show comment
Hide comment
@MylesBorins

MylesBorins Sep 30, 2016

Member

this is not landing on v4.x please feel free to backport

Member

MylesBorins commented Sep 30, 2016

this is not landing on v4.x please feel free to backport

@targos targos referenced this pull request Oct 7, 2016

Merged

Improve buffer test coverage #8552

3 of 3 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment