forked from shelljs/shelljs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathecho.js
More file actions
59 lines (51 loc) · 1.4 KB
/
Copy pathecho.js
File metadata and controls
59 lines (51 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import test from 'ava';
import shell from '..';
import utils from './utils/utils';
shell.config.silent = true;
//
// Valids
//
test.cb('simple test with defaults', t => {
const script = 'require(\'../global.js\'); echo("hello", "world");';
utils.runScript(script, (err, stdout, stderr) => {
t.falsy(err);
t.is(stdout, 'hello world\n');
t.is(stderr, '');
t.end();
});
});
test.cb('allow arguments to begin with a hyphen', t => {
// see issue #20
const script = 'require(\'../global.js\'); echo("-asdf", "111");';
utils.runScript(script, (err, stdout, stderr) => {
t.falsy(err);
t.is(stdout, '-asdf 111\n');
t.is(stderr, '');
t.end();
});
});
test.cb("using null as an explicit argument doesn't crash the function", t => {
const script = 'require(\'../global.js\'); echo(null);';
utils.runScript(script, (err, stdout, stderr) => {
t.falsy(err);
t.is(stdout, 'null\n');
t.is(stderr, '');
t.end();
});
});
test.cb('simple test with silent(true)', t => {
const script = 'require(\'../global.js\'); config.silent=true; echo(555);';
utils.runScript(script, (err, stdout) => {
t.falsy(err);
t.is(stdout, '555\n');
t.end();
});
});
test.cb('-e option', t => {
const script = "require('../global.js'); echo('-e', '\\tmessage');";
utils.runScript(script, (err, stdout) => {
t.falsy(err);
t.is(stdout, '\tmessage\n');
t.end();
});
});