-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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: ensure stream preprocessing order #7741
test: ensure stream preprocessing order #7741
Conversation
Sometimes it is necessary to preprocess some initial bit of a stream data before giving the entire stream to the main processing function. Sometimes this bit should be extracted from the stream before the main processing; sometimes it should be returned to the stream. This test checks an order of stream modes, methods and events for a possible preprocessing algorithm. Stream BOM stripping is selected as a use case. See nodejs/help#221 as the prehistory.
Sorry, this is my first test at all, and I am not sure if I have not done some stupid things. |
The actual test file should be in Also, I'm not sure a |
@mscdex So should I delete Should I also rename the |
I'd leave the text files in The changes look good now, although you will need to fix your paths. |
I've fixed them before moving, also |
const fs = require('fs'); | ||
const path = require('path'); | ||
const rl = require('readline'); | ||
/******************************************************************************/ |
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.
This is a minor nit, but in keeping with the style of most of the other tests, it's probably best to just replace this line with a blank line and remove the other two earlier asterisk lines completely.
|
||
// get the data by a non-stream way to compare with the streamed data | ||
const modelData = fs.readFileSync( | ||
path.join(__dirname, '..', 'fixtures', 'file-to-read-without-bom.txt'), 'utf8' |
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.
path.join(common.fixturesDir, 'file-to-read-without-bom.txt')
(and below where appropriate)?
|
||
const BOM = '\uFEFF'; | ||
|
||
// get the data by a non-stream way to compare with the streamed data |
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.
nit: Comments should be capitalized and punctuated; also, maybe using
is better than by
?
@addaleax Thank you. |
LGTM with CI: https://ci.nodejs.org/job/node-test-commit/4243/ (Edit: is green.) |
Landed in ea725ed, thanks! |
Sometimes it is necessary to preprocess some initial bit of a stream data before giving the entire stream to the main processing function. Sometimes this bit should be extracted from the stream before the main processing; sometimes it should be returned to the stream. This test checks an order of stream modes, methods and events for a possible preprocessing algorithm. Stream BOM stripping is selected as a use case. See nodejs/help#221 as the prehistory. PR-URL: #7741 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Sometimes it is necessary to preprocess some initial bit of a stream data before giving the entire stream to the main processing function. Sometimes this bit should be extracted from the stream before the main processing; sometimes it should be returned to the stream. This test checks an order of stream modes, methods and events for a possible preprocessing algorithm. Stream BOM stripping is selected as a use case. See nodejs/help#221 as the prehistory. PR-URL: #7741 Reviewed-By: Anna Henningsen <anna@addaleax.net>
This test fails on node v0.8, v0.10, v0.12 for I'm not sure if this is something @nodejs/lts wants to look into for v0.12. |
Sometimes it is necessary to preprocess some initial bit of a stream data before giving the entire stream to the main processing function. Sometimes this bit should be extracted from the stream before the main processing; sometimes it should be returned to the stream. This test checks an order of stream modes, methods and events for a possible preprocessing algorithm. Stream BOM stripping is selected as a use case. See nodejs/help#221 as the prehistory. PR-URL: #7741 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Sometimes it is necessary to preprocess some initial bit of a stream data before giving the entire stream to the main processing function. Sometimes this bit should be extracted from the stream before the main processing; sometimes it should be returned to the stream. This test checks an order of stream modes, methods and events for a possible preprocessing algorithm. Stream BOM stripping is selected as a use case. See nodejs/help#221 as the prehistory. PR-URL: #7741 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Sometimes it is necessary to preprocess some initial bit of a stream data before giving the entire stream to the main processing function. Sometimes this bit should be extracted from the stream before the main processing; sometimes it should be returned to the stream. This test checks an order of stream modes, methods and events for a possible preprocessing algorithm. Stream BOM stripping is selected as a use case. See nodejs/help#221 as the prehistory. PR-URL: #7741 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Checklist
make -j4 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
test
Description of change
Sometimes it is necessary to preprocess some initial bit of a stream data before giving the entire stream to the main processing function. Sometimes this bit should be extracted from the stream before the main processing; sometimes it should be returned to the stream. This test checks an order of stream modes, methods and events for a possible preprocessing algorithm. Stream BOM stripping is selected as a use case.
See nodejs/help#221 as the prehistory.