Skip to content

Commit

Permalink
Fix tests on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
MattIrv committed Mar 9, 2018
1 parent 49e7337 commit 26621b5
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions test/queryRunner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ suite('Query Runner tests', () => {
);
queryRunner.uri = testuri;
return queryRunner.copyResults(testRange, 0, 0).then(() => {
let pasteContents = ncp.paste();
let pasteContents = pasteCopiedString();
assert.equal(pasteContents, finalStringNoHeader);
});
});
Expand All @@ -594,7 +594,7 @@ suite('Query Runner tests', () => {
// Call handleResult to ensure column header info is seeded
queryRunner.handleQueryComplete(result);
return queryRunner.copyResults(testRange, 0, 0).then(() => {
let pasteContents = ncp.paste();
let pasteContents = pasteCopiedString();
assert.equal(pasteContents, finalStringWithHeader);
});
});
Expand All @@ -619,7 +619,7 @@ suite('Query Runner tests', () => {

// call copyResults with additional parameter indicating to include headers
return queryRunner.copyResults(testRange, 0, 0, true).then(() => {
let pasteContents = ncp.paste();
let pasteContents = pasteCopiedString();
assert.equal(pasteContents, finalStringWithHeader);
});
});
Expand All @@ -644,7 +644,7 @@ suite('Query Runner tests', () => {

// call copyResults with additional parameter indicating to not include headers
return queryRunner.copyResults(testRange, 0, 0, false).then(() => {
let pasteContents = ncp.paste();
let pasteContents = pasteCopiedString();
assert.equal(pasteContents, finalStringNoHeader);
});
});
Expand Down Expand Up @@ -677,3 +677,16 @@ function setupStandardQueryNotificationHandlerMock(testQueryNotificationHandler:
assert.equal(u, standardUri);
});
}

function pasteCopiedString(): string {
let oldLang: string;
if (process.platform === 'darwin') {
oldLang = process.env['LANG'];
process.env['LANG'] = 'en_US.UTF-8';
}
let pastedString = ncp.paste();
if (process.platform === 'darwin') {
process.env['LANG'] = oldLang;
}
return pastedString;
}

0 comments on commit 26621b5

Please sign in to comment.