FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
mathjs/test/node-tests/cli/cli.test.js at develop · samxcode/mathjs · GitHub
samxcode
/
mathjs
Public
forked from
josdejong/mathjs
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
mathjs
/
test
/
node-tests
/
cli
/
cli.test.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
43 lines (37 loc) · 1.11 KB
Breadcrumbs
mathjs
/
test
/
node-tests
/
cli
/
cli.test.js
Copy path
File metadata and controls
43 lines (37 loc) · 1.11 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
// Only use native node.js API's and references to ./lib here, this file is not transpiled!
const
assert
=
require
(
'assert'
)
const
path
=
require
(
'path'
)
const
cp
=
require
(
'child_process'
)
function
run
(
args
,
done
)
{
cp
.
exec
(
'node bin/cli.js '
+
args
,
function
(
e
,
r
)
{
done
(
e
,
r
.
replace
(
/
\n
$
/
g
,
''
)
)
}
)
}
describe
(
'command line interface'
,
function
(
)
{
it
(
'should sum numbers'
,
function
(
done
)
{
run
(
'"1+1"'
,
function
(
e
,
result
)
{
assert
.
strictEqual
(
result
,
'2'
)
done
(
)
}
)
}
)
it
(
'should multiply matrices'
,
function
(
done
)
{
run
(
'"[1,2] * [3,4]"'
,
function
(
e
,
result
)
{
assert
.
strictEqual
(
result
,
'11'
)
done
(
)
}
)
}
)
it
(
'should thow error'
,
function
(
done
)
{
run
(
'"y=x"'
,
function
(
e
,
result
)
{
assert
.
strictEqual
(
/
^
E
r
r
o
r
/
g
.
test
(
e
.
toString
(
)
)
,
true
)
done
(
)
}
)
}
)
it
(
'should interpret scripts'
,
function
(
done
)
{
const
path1
=
path
.
join
(
__dirname
,
'script1'
)
const
path2
=
path
.
join
(
__dirname
,
'script2'
)
run
(
'"'
+
path1
+
'" "'
+
path2
+
'"'
,
function
(
e
,
result
)
{
assert
.
strictEqual
(
result
,
'2\n8\n'
)
done
(
)
}
)
}
)
}
)
Back
|
FazBrowse Home
|
New Git URL