@@ -99,7 +99,7 @@ syntaxArgs.forEach(function(args) {
|
99 | 99 | assert.strictEqual(c.status, 0, 'code === ' + c.status); |
100 | 100 | }); |
101 | 101 | |
102 | | -// should should throw if code piped from stdin with --check has bad syntax |
| 102 | +// should throw if code piped from stdin with --check has bad syntax |
103 | 103 | // loop each possible option, `-c` or `--check` |
104 | 104 | syntaxArgs.forEach(function(args) { |
105 | 105 | const stdin = 'var foo bar;'; |
@@ -117,3 +117,18 @@ syntaxArgs.forEach(function(args) {
|
117 | 117 | |
118 | 118 | assert.strictEqual(c.status, 1, 'code === ' + c.status); |
119 | 119 | }); |
| 120 | + |
| 121 | +// should throw if -c and -e flags are both passed |
| 122 | +['-c', '--check'].forEach(function(checkFlag) { |
| 123 | +['-e', '--eval'].forEach(function(evalFlag) { |
| 124 | +const args = [checkFlag, evalFlag, 'foo']; |
| 125 | +const c = spawnSync(node, args, {encoding: 'utf8'}); |
| 126 | + |
| 127 | +assert.strictEqual( |
| 128 | +c.stderr, |
| 129 | +`${node}: either --check or --eval can be used, not both\n` |
| 130 | +); |
| 131 | + |
| 132 | +assert.strictEqual(c.status, 9, 'code === ' + c.status); |
| 133 | +}); |
| 134 | +}); |