Skip to content

Commit f229753

Browse files
Remove new lines to validate tests across platforms better (windows specifically)
1 parent ef61771 commit f229753

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

src/test/extension.test.ts

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type StringTransformationTest = [
1919
let editor: vscode.TextEditor;
2020
let document: vscode.TextDocument;
2121
const originalShowInputBox = vscode.window.showInputBox;
22+
const removeNewLines = (str: string) => str.replace(/[\n\r]/g, "");
2223

2324
suite("Extension Test Suite", () => {
2425
beforeEach(async () => {
@@ -375,8 +376,8 @@ suite("Extension Test Suite", () => {
375376
);
376377

377378
assert.strictEqual(output1, "a2 b3 c4 5d 6e 7f 13x y24 35z46");
378-
assert.strictEqual(output2, "a2 b3 c4 5d 6e\n7f 13x y24 35z46");
379-
assert.strictEqual(output3, "a-3 b-2 c-1 0d 1e\n7f 13x y24 35z46");
379+
assert.strictEqual(output2, "a2 b3 c4 5d 6e7f 13x y24 35z46");
380+
assert.strictEqual(output3, "a-3 b-2 c-1 0d 1e7f 13x y24 35z46");
380381
});
381382

382383
test("decrement", async () => {
@@ -399,8 +400,14 @@ suite("Extension Test Suite", () => {
399400
);
400401

401402
assert.strictEqual(output1, "a0 b1 c2 3d 4e 5f 11x y22 33z44");
402-
assert.strictEqual(output2, "a0 b1 c2 3d\n4e 5f 11x y22 33z44");
403-
assert.strictEqual(output3, "a-4 b-3 c-2 -1d\n0e 5f 11x y22 33z44");
403+
assert.strictEqual(
404+
removeNewLines(output2),
405+
"a0 b1 c2 3d4e 5f 11x y22 33z44"
406+
);
407+
assert.strictEqual(
408+
removeNewLines(output3),
409+
"a-4 b-3 c-2 -1d0e 5f 11x y22 33z44"
410+
);
404411
});
405412

406413
test("duplicateAndIncrement", async () => {
@@ -415,8 +422,8 @@ suite("Extension Test Suite", () => {
415422
);
416423

417424
assert.strictEqual(
418-
output,
419-
"a1 b2 c3 4d 5e 6f 12x y23 34z45a2 b3 c4 5d 6e 7f 13x y24 35z46\n"
425+
removeNewLines(output),
426+
"a1 b2 c3 4d 5e 6f 12x y23 34z45a2 b3 c4 5d 6e 7f 13x y24 35z46"
420427
);
421428
});
422429

@@ -432,8 +439,8 @@ suite("Extension Test Suite", () => {
432439
);
433440

434441
assert.strictEqual(
435-
output,
436-
"a1 b2 c3 4d 5e 6f 12x y23 34z45a0 b1 c2 3d 4e 5f 11x y22 33z44\n"
442+
removeNewLines(output),
443+
"a1 b2 c3 4d 5e 6f 12x y23 34z45a0 b1 c2 3d 4e 5f 11x y22 33z44"
437444
);
438445
});
439446

@@ -453,7 +460,10 @@ suite("Extension Test Suite", () => {
453460
);
454461

455462
assert.strictEqual(output1, "a1 b2 c3 4d 5e 6f 7x y8 9z10");
456-
assert.strictEqual(output2, "a11 b12 c13\n14d 15e 16f 17x y18 19z20");
463+
assert.strictEqual(
464+
removeNewLines(output2),
465+
"a11 b12 c1314d 15e 16f 17x y18 19z20"
466+
);
457467
});
458468

459469
test("utf8ToChar", async () => {

0 commit comments

Comments
 (0)