-
Notifications
You must be signed in to change notification settings - Fork 7
/
test.js
45 lines (43 loc) · 1.4 KB
/
test.js
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
var test = require('tape')
var exec = require('child_process').exec
test('function', function (t) {
var truth = [
'#### `apple(self, parameter=10, another=1000)`',
'Example docstring.',
'- **`paramter`** `int` `optional` `default = 10`',
' Description of parameter.',
'Includes multiple lines.',
'A lot of multiple lines.',
'- **`another`** `int` `optional` `default = 1000`',
' Another description.',
'#### `pear(self, parameter=10)`',
'More docstring.',
'- **`paramter`** `int` `optional` `default = 10`',
' Description of parameter'
]
exec('./index.js example.py', function (err, stdout, stderr) {
if (err) console.log(err)
t.equal(stdout.split('\n').join(''), truth.join(''))
t.end()
})
})
test('class', function (t) {
var truth = [
'#### `cow(parameter=10, another=1000)`',
'Example docstring.',
'- **`paramter`** `int` `optional` `default = 10`',
' Description of parameter.',
'Includes multiple lines.',
'- **`another`** `int` `optional` `default = 1000`',
' Another description.',
'#### `pig(parameter=10)`',
'More docstring.',
'- **`paramter`** `int` `optional` `default = 10`',
' Description of parameter'
]
exec('./index.js example.py -c Animals', function (err, stdout, stderr) {
if (err) console.log(err)
t.equal(stdout.split('\n').join(''), truth.join(''))
t.end()
})
})