Skip to content

Commit 69e4f83

Browse files
pulkit-30MoLow
authored andcommitted
test: fix tap escaping with and without --test
PR-URL: nodejs/node#46311 Fixes: nodejs/node#45836 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> (cherry picked from commit 2f38c74e263ed2e7f3b087efb9adee2442dd25c4)
1 parent dc45ff3 commit 69e4f83

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

lib/internal/test_runner/reporter/tap.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// https://github.com/nodejs/node/blob/a1b27b25bb01aadd3fd2714e4b136db11b7eb85a/lib/internal/test_runner/tap_stream.js
1+
// https://github.com/nodejs/node/blob/2f38c74e263ed2e7f3b087efb9adee2442dd25c4/lib/internal/test_runner/tap_stream.js
22

33
'use strict'
44

@@ -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

test/message/test_runner_output.out

Lines 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
...

test/message/test_runner_output_cli.out

Lines 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)