Skip to content

Commit f490363

Browse files
committed
test: add whitespace-only and CRLF edge cases for logResult
- Whitespace-only stdout/stderr should be omitted (same as empty) - Windows-style CRLF line endings should split correctly Tests: 154 -> 156 Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
1 parent 7e5b78e commit f490363

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

test/unit/outputChannel.test.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,35 @@ test("setPatchloomLog and getPatchloomLog round-trip module state", () => {
123123
}
124124
});
125125

126+
test("logResult omits whitespace-only stdout and stderr", () => {
127+
const lines: string[] = [];
128+
const log = createPatchloomLog(() => ({
129+
appendLine(value: string) { lines.push(value); },
130+
show() {},
131+
dispose() {}
132+
}));
133+
134+
log.logResult(0, " \n ", " \n ");
135+
136+
assert.equal(lines.length, 1);
137+
assert.ok(lines[0].includes("Exit code: 0"));
138+
});
139+
140+
test("logResult splits Windows-style CRLF line endings", () => {
141+
const lines: string[] = [];
142+
const log = createPatchloomLog(() => ({
143+
appendLine(value: string) { lines.push(value); },
144+
show() {},
145+
dispose() {}
146+
}));
147+
148+
log.logResult(0, "line1\r\nline2\r\n", "");
149+
150+
assert.ok(lines.some(l => l === "line1"));
151+
assert.ok(lines.some(l => l === "line2"));
152+
assert.ok(lines.some(l => l.includes("Exit code: 0")));
153+
});
154+
126155
test("logResult handles multiline stderr", () => {
127156
const lines: string[] = [];
128157
const log = createPatchloomLog(() => ({

0 commit comments

Comments
 (0)