Files: e9d9dec1d00ff365112ca0f981bbda15e3682528 / test / test-50-ast-parsing / main.js
953 bytesRaw
1 | |
2 | |
3 | 'use strict'; |
4 | |
5 | const fs = require('fs'); |
6 | const path = require('path'); |
7 | const assert = require('assert'); |
8 | const utils = require('../utils.js'); |
9 | |
10 | assert(!module.parent); |
11 | assert(__dirname === process.cwd()); |
12 | |
13 | const host = 'node' + process.version.match(/^v(\d+)/)[1]; |
14 | const target = process.argv[2] || host; |
15 | const input = './test-x-index.js'; |
16 | const output = './test-output.exe'; |
17 | const data = './test-y-data.txt'; |
18 | |
19 | if (/^(node|v)?0/.test(target)) return; |
20 | if (/^(node|v)?4/.test(target)) return; |
21 | |
22 | let left, right; |
23 | |
24 | left = fs.readFileSync( |
25 | data, 'utf8' |
26 | ).split('\n').filter(function (line) { |
27 | return line.indexOf('/***/ ') >= 0; |
28 | }).map(function (line) { |
29 | return line.split('/***/ ')[1]; |
30 | }).join('\n') + '\n'; |
31 | |
32 | utils.pkg.sync([ |
33 | '--target', target, |
34 | '--output', output, input |
35 | ]); |
36 | |
37 | right = utils.spawn.sync( |
38 | './' + path.basename(output), [], |
39 | { cwd: path.dirname(output) } |
40 | ); |
41 | |
42 | assert.equal(left, right); |
43 | utils.vacuum.sync(output); |
44 |
Built with git-ssb-web