-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Adds assertions to zero length buffer slice test #8729
Conversation
I guess the reason to not use |
f5ccde9
to
018ce08
Compare
Thanks, @lpinca! Updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Hi, the CI failures do not seem related to the changes in the PR. Any insights? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -52,7 +52,8 @@ assert.equal(buf.slice('0', '-111'), ''); | |||
|
|||
// try to slice a zero length Buffer | |||
// see https://github.com/joyent/node/issues/5881 | |||
Buffer.alloc(0).slice(0, 1); | |||
assert.doesNotThrow(() => { Buffer.alloc(0).slice(0, 1) }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can drop the block and simply write this as
assert.doesNotThrow(() => Buffer.alloc(0).slice(0, 1));
@LaurenSpiegel as you said CI failures seem to not be related to this change. Nothing to worry about IMHO. |
There is actually a lint error, a missing semicolon on the first assertion. If you follow @thefourtheye's suggestion that will be fixed. |
1) Add missing assertion that slicing a 0 length buffer does not throw 2) Add assertion that slicing a 0 length buffer has a length of 0
018ce08
to
ef85c9f
Compare
Thanks, lint error fixed and @thefourtheye's change incorporated. |
1) Add missing assertion that slicing a 0 length buffer does not throw 2) Add assertion that slicing a 0 length buffer has a length of 0 PR-URL: #8729 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Landed in 927661f. |
1) Add missing assertion that slicing a 0 length buffer does not throw 2) Add assertion that slicing a 0 length buffer has a length of 0 PR-URL: #8729 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1) Add missing assertion that slicing a 0 length buffer does not throw 2) Add assertion that slicing a 0 length buffer has a length of 0 PR-URL: #8729 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Checklist
Affected core subsystem(s)
buffer
Description of change
Existing test to show that slicing a 0 length buffer does not throw was missing the actual doesNotThrow assertion.