Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8a45c9d

Browse filesBrowse files
pulkit-30ruyadorno
authored andcommitted
test: fix tap escaping with and without --test
PR-URL: #46311 Fixes: #45836 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
1 parent 367dc41 commit 8a45c9d
Copy full SHA for 8a45c9d

File tree

Expand file treeCollapse file tree

3 files changed

+9
-9
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+9
-9
lines changed
Open diff view settings
Collapse file

‎lib/internal/test_runner/reporter/tap.js‎

Copy file name to clipboardExpand all lines: lib/internal/test_runner/reporter/tap.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ function indent(nesting) {
9494

9595
// In certain places, # and \ need to be escaped as \# and \\.
9696
function tapEscape(input) {
97-
let result = StringPrototypeReplaceAll(input, '\\', '\\\\');
98-
result = StringPrototypeReplaceAll(result, '#', '\\#');
99-
result = StringPrototypeReplaceAll(result, '\b', '\\b');
97+
let result = StringPrototypeReplaceAll(input, '\b', '\\b');
10098
result = StringPrototypeReplaceAll(result, '\f', '\\f');
10199
result = StringPrototypeReplaceAll(result, '\t', '\\t');
102100
result = StringPrototypeReplaceAll(result, '\n', '\\n');
103101
result = StringPrototypeReplaceAll(result, '\r', '\\r');
104102
result = StringPrototypeReplaceAll(result, '\v', '\\v');
103+
result = StringPrototypeReplaceAll(result, '\\', '\\\\');
104+
result = StringPrototypeReplaceAll(result, '#', '\\#');
105105
return result;
106106
}
107107

Collapse file

‎test/message/test_runner_output.out‎

Copy file name to clipboardExpand all lines: test/message/test_runner_output.out
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,8 @@ ok 36 - functionAndOptions # SKIP
346346
---
347347
duration_ms: *
348348
...
349-
# Subtest: escaped description \\ \# \\\#\\ \n \t \f \v \b \r
350-
ok 37 - escaped description \\ \# \\\#\\ \n \t \f \v \b \r
349+
# Subtest: escaped description \\ \# \\\#\\ \\n \\t \\f \\v \\b \\r
350+
ok 37 - escaped description \\ \# \\\#\\ \\n \\t \\f \\v \\b \\r
351351
---
352352
duration_ms: *
353353
...
Collapse file

‎test/message/test_runner_output_cli.out‎

Copy file name to clipboardExpand all lines: test/message/test_runner_output_cli.out
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ TAP version 13
122122
failureType: 'testCodeFailure'
123123
error: |-
124124
Expected values to be strictly equal:
125-
125+
126126
true !== false
127-
127+
128128
code: 'ERR_ASSERTION'
129129
expected: false
130130
actual: true
@@ -345,8 +345,8 @@ TAP version 13
345345
---
346346
duration_ms: *
347347
...
348-
# Subtest: escaped description \\ \# \\\#\\ n \\t f \\v b \\r
349-
ok 37 - escaped description \\ \# \\\#\\ n \\t f \\v b \\r
348+
# Subtest: escaped description \\ \# \\\#\\ \\n \\t \\f \\v \\b \\r
349+
ok 37 - escaped description \\ \# \\\#\\ \\n \\t \\f \\v \\b \\r
350350
---
351351
duration_ms: *
352352
...

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.