-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathreadme.js
39 lines (35 loc) · 860 Bytes
/
readme.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
// TODO: Need to fix reamde first
// make it parse markdown properly
var fs = require('fs')
, path = require('path')
, test = require('tape')
, reamde = require('reamde')
, asynckit = require('../')
, parallel = require('../parallel.js')
, content = fs.readFileSync(path.join(__dirname, '../README.md'), 'utf-8')
, examples
;
examples = reamde(content, {
runtime:
[
'callback'
],
replace:
{
'require(\'asynckit\')' : asynckit,
'require(\'asynckit/parallel\')' : parallel,
'assert.deepEqual(' : 'callback('
}
});
// Run tests
test('readme', function(t)
{
t.plan(5);
examples.forEach(function(ex)
{
ex(function(actual, expected)
{
t.deepEqual(actual, expected, 'expecting readme examples to match: ' + actual + ' vs ' + expected + '.');
});
});
});