Skip to content

Commit

Permalink
test: fix more Windows tests.
Browse files Browse the repository at this point in the history
This fixes some tests on Windows, some of which I actually broke in a
previous PR. This focuses on newlines: we need `\n` when comparing
against JavaScript strings, but `os.EOL` when comparing something from
the file system or the system's stdio.

Issue #7
  • Loading branch information
nfischer committed Mar 17, 2018
1 parent f67126b commit 892a1dc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ describe('proxy', () => {
const ret2 = shell.exec(`du ${fname}`);
assertShellStringEqual(ret1, ret2);
// Don't assert the file size, since that may be OS dependent.
ret1.stdout.should.endWith(`\t${fname}${os.EOL}`);
// Note: newline should be '\n', because we're checking a JS string, not
// something from the file system.
ret1.stdout.should.endWith(`\t${fname}\n`);
} else {
console.log('skipping test');
}
Expand Down Expand Up @@ -223,7 +225,9 @@ describe('proxy', () => {
it('runs very long subcommand chains', (done) => {
const fun = (unix() ? shell.$output : shell['%output%']);
const ret = fun.one.two.three.four.five.six('seven');
ret.stdout.should.equal(`one two three four five six seven${os.EOL}`);
// Note: newline should be '\n', because we're checking a JS string, not
// something from the file system.
ret.stdout.should.equal('one two three four five six seven\n');
ret.stderr.should.equal('');
ret.code.should.equal(0);
done();
Expand All @@ -240,6 +244,7 @@ describe('proxy', () => {
shell.exec('echo hello world').to(fname);

shell[delVarName](fname);
// TODO(nfischer): this line fails on Windows
fs.existsSync(fname).should.equal(false);
shell.cat(fa).toString().should.equal(`hello world${os.EOL}`);

Expand Down

0 comments on commit 892a1dc

Please sign in to comment.