GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — test: fix invalid output TAP if there newline in test name by pulkit-30 · Pull Request #45742 · nodejs/node Conversation
|
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
What about \r, \v, \b, and \f?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Hey @aduh95 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const assert = require('node:assert'); | ||
| const { TapParser } = require('internal/test_runner/tap_parser'); | ||
| const { TapChecker } = require('internal/test_runner/tap_checker'); | ||
| const { tapEscape } = require('internal/test_runner/tap_stream'); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
So, I don't think this file is the best place for testing this. This file is more about the TAP parser.
I would test this by doing the following:
tapEscape export that this PR adds to lib/internal/test_runner/tap_stream.js.test/message/test_runner_output.js that uses \n, \r, etc (# and \ are already tested IIRC).test/message/test_runner_output.out to reflect the changes in the test output.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
updating this 👍🏽 🚀
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| return StringPrototypeReplaceAll( | ||
| StringPrototypeReplaceAll(input, '\\', '\\\\'), '#', '\\#' | ||
| ); | ||
| [{ escapeChar: '\\', tappedEscape: '\\\\' }, |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Even though the resulting code will not look as nice as this, I'm inclined to use a series of StringPrototypeReplaceAll() calls here instead.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@cjihrig like this... right?
return StringPrototypeReplaceAll(StringPrototypeReplaceAll( StringPrototypeReplaceAll(StringPrototypeReplaceAll( StringPrototypeReplaceAll(StringPrototypeReplaceAll( StringPrototypeReplaceAll(StringPrototypeReplaceAll(input, '\\', '\\\\'), '#', '\\#'), '\b', '\\b'), '\f', '\\f'), '\t', '\\t'), '\n', '\\n'), '\r', '\\r'), '\v', '\\v');
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
You could do it that way. You could also do something like this to maintain more readability:
let result = StringPrototypeReplaceAll(...); result = StringPrototypeReplaceAll(...); result = StringPrototypeReplaceAll(...); return result;
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Got it 👍🏽
Thanks
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| ); | ||
| let result = StringPrototypeReplaceAll(input, '\\', '\\\\'); | ||
| result = StringPrototypeReplaceAll(result, '#', '\\#'); | ||
| result = StringPrototypeReplaceAll(result,'\b', '\\b'); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Same change on the following lines. Other than that, I think this looks good.
| result = StringPrototypeReplaceAll(result,'\b', '\\b'); | |
| result = StringPrototypeReplaceAll(result, '\b', '\\b'); |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, didn't notice that 😞
fixed 🚀
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Landed in 22dc987 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
PR-URL: #45742 Fixes: #45396 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: #45742 Fixes: #45396 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: #45742 Fixes: #45396 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: #45742 Fixes: #45396 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: #45742 Fixes: #45396 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: nodejs/node#45742 Fixes: nodejs/node#45396 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> (cherry picked from commit 22dc987fde29734c5bcbb7c33da20d184ff61627)
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
node:test outputs invalid TAP if there is a newline in the test name
There was an error while loading. Please reload this page.