Skip to content

Commit

Permalink
Make a few tests pass on windows, make test failure messages more hel…
Browse files Browse the repository at this point in the history
…pful

Refs #4844
  • Loading branch information
J-Fields committed May 17, 2020
1 parent 1ea49a4 commit c204f51
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion test/cmd_line/tabCompletion.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ suite('cmd_line tabComplete', () => {
await modeHandler.handleKeyEvent('<tab>');
statusBarAfterTab = StatusBar.getText().trim();
await modeHandler.handleKeyEvent('<Esc>');
assert.strictEqual(statusBarAfterTab, `:e ././${baseName}|`, `${failMsg} (w ././)`);
assert.strictEqual(statusBarAfterTab, `:e .${sep}.${sep}${baseName}|`, `${failMsg} (w ././)`);

// With full path excluding the last space portion
cmd = `:e ${fullPathExcludeSpace}`.split('');
Expand Down
5 changes: 5 additions & 0 deletions test/configuration/validators/neovimValidator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ suite('Neovim Validator', () => {
configuration.enableNeovim = true;
configuration.neovimPath = '';

const oldPath = process.env.PATH?.slice();
process.env.PATH = "";

// test
const validator = new NeovimValidator();
const actual = await validator.validate(configuration);
validator.disable(configuration);

process.env.PATH = oldPath;

// assert
assert.strictEqual(actual.numErrors, 1);
assert.strictEqual(actual.hasError, true);
Expand Down
11 changes: 5 additions & 6 deletions test/testSimplifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,12 @@ async function testIt(modeHandler: ModeHandler, testObj: ITestObject): Promise<v
assertEqualLines(lines);

// Check final cursor position
const actualPosition = Position.FromVSCodePosition(TextEditor.getSelection().start);
const actualPosition = TextEditor.getSelection().start;
const expectedPosition = helper.endPosition;
assert.strictEqual(actualPosition.line, expectedPosition.line, 'Cursor LINE position is wrong.');
assert.strictEqual(
actualPosition.character,
expectedPosition.character,
'Cursor CHARACTER position is wrong.'
assert.deepStrictEqual(
{ line: actualPosition.line, character: actualPosition.character },
{ line: expectedPosition.line, character: expectedPosition.character },
'Cursor position is wrong.'
);

// endMode: check end mode is correct if given
Expand Down
16 changes: 5 additions & 11 deletions test/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,11 @@ export async function WaitForEditorsToClose(numExpectedEditors: number = 0): Pro
}

export function assertEqualLines(expectedLines: string[]) {
for (let i = 0; i < expectedLines.length; i++) {
const expected = expectedLines[i];
const actual = TextEditor.readLineAt(i);
assert.strictEqual(
actual,
expected,
`Content does not match; Expected=${expected}. Actual=${actual}.`
);
}

assert.strictEqual(TextEditor.getLineCount(), expectedLines.length, 'Line count does not match.');
assert.strictEqual(
TextEditor.getText(),
expectedLines.join(os.EOL),
'Document content does not match.'
);
}

export function assertStatusBarEqual(
Expand Down

0 comments on commit c204f51

Please sign in to comment.