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: buffer read functions tests for noAssert in one file #10713

Closed
wants to merge 1 commit into from

Conversation

larissayvette
Copy link
Contributor

@larissayvette larissayvette commented Jan 9, 2017

Checklist
  • commit message follows commit guidelines
Affected core subsystem(s)

test

noAssert tested in buffer.read() functions

@nodejs-github-bot nodejs-github-bot added test Issues and PRs related to the tests. lts-watch-v6.x labels Jan 9, 2017
@mscdex mscdex added the buffer Issues and PRs related to the buffer subsystem. label Jan 9, 2017
@mscdex
Copy link
Contributor

mscdex commented Jan 9, 2017

-1 We already have tests that cover the buffer.read*()/buffer.write*() functions:

  • test-readuint.js
  • test-readint.js
  • test-buffer-readuintle.js
  • test-buffer-readuintbe.js
  • test-readdouble.js
  • test-readfloat.js
  • test-writeuint.js
  • test-writedouble.js
  • test-writefloat.js

etc. ...

If anything, we should at least be combining these tests into two files: one for reads (e.g. 'test-buffer-read-numbers') and one for writes (e.g. 'test-buffer-write-numbers'). Perhaps we might even combine them all into one file (e.g. 'test-buffer-read-write-numbers').

@Trott
Copy link
Member

Trott commented Jan 9, 2017

-1 We already have tests that cover the buffer.read*()/buffer.write*() functions:

None of the existing tests cover noAssert functionality. This test covers it for all the functions.

I think we can use this as a starting point and combine the other read* tests into it. Either that or rename this test to add noAssert into the file name. I think either of those options are better than the alternatives that I can think of, which are:

  • do nothing and leave code surface area uncovered
  • add 12 separate files, one for each function, with all but one or two lines identical in each file
  • add these tests to the existing somewhat-disorganized test files, copy/pasting nearly idential code in all of them
  • etc....

@Trott
Copy link
Member

Trott commented Jan 9, 2017

(My vote would be add noAssert to the file name and leaving the other tests alone. Perhaps test-buffer-read-noassert.js or something like that.)

@larissayvette The commit message (and the PR description) don't contain any useful information. Can you please provide a description of the change? Perhaps something like this?: "This change tests the functionality of buffer.read*() functions when using the noAssert option."

Copy link
Member

@Trott Trott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with nits addressed (file name, commit message) and green CI


assert.doesNotThrow(
() => assert.strictEqual(buff[funx](...args, true), expected),
'noAssert does not change return value'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This would probably be better as something like: noAssert should not change return value for valid ranges

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright doing those changes

@larissayvette larissayvette changed the title test: buffer read functions tests in one file test: buffer read functions tests for noAssert in one file Jan 10, 2017
@larissayvette
Copy link
Contributor Author

@Trott I have updated the PR

@Trott
Copy link
Member

Trott commented Jan 10, 2017

@mscdex Are you still opposed to this given what I wrote above? If so, do you have an opinion as to a better way to introduce testing for the noAssert option for these functions?

@mscdex
Copy link
Contributor

mscdex commented Jan 10, 2017

@Trott Additional code coverage is fine if that's really what this PR is doing, but at the same time I'm not keen on exacerbating the issue of test fragmentation for buffer.read*()/buffer.write*().

@Trott
Copy link
Member

Trott commented Jan 10, 2017

Trott pushed a commit to Trott/io.js that referenced this pull request Jan 11, 2017
PR-URL: nodejs#10713
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@Trott
Copy link
Member

Trott commented Jan 11, 2017

Landed in c8ed5f2. Thanks, @larissayvette! 🎉

Next steps:

  • similar test for noAssert in buf.write*()
  • refactor the buf.read*() and buf.write*() tests to at least have similar file names; might be good to combine some of them too

@Trott Trott closed this Jan 11, 2017
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 18, 2017
PR-URL: nodejs#10713
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 23, 2017
PR-URL: nodejs#10713
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 25, 2017
PR-URL: nodejs#10713
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 27, 2017
PR-URL: nodejs#10713
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@italoacasas italoacasas mentioned this pull request Jan 29, 2017
MylesBorins pushed a commit that referenced this pull request Mar 8, 2017
PR-URL: #10713
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Mar 9, 2017
PR-URL: #10713
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Mar 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buffer Issues and PRs related to the buffer subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants