git ssb

0+

cel-desktop / ssb-pkg



Tree: cfc8d49135488f7554210234b3a503c2dbd6c6a5

Files: cfc8d49135488f7554210234b3a503c2dbd6c6a5 / test / test-50-ast-parsing / main.js

953 bytesRaw
1#!/usr/bin/env node
2
3'use strict';
4
5const fs = require('fs');
6const path = require('path');
7const assert = require('assert');
8const utils = require('../utils.js');
9
10assert(!module.parent);
11assert(__dirname === process.cwd());
12
13const host = 'node' + process.version.match(/^v(\d+)/)[1];
14const target = process.argv[2] || host;
15const input = './test-x-index.js';
16const output = './test-output.exe';
17const data = './test-y-data.txt';
18
19if (/^(node|v)?0/.test(target)) return;
20if (/^(node|v)?4/.test(target)) return;
21
22let left, right;
23
24left = 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
32utils.pkg.sync([
33 '--target', target,
34 '--output', output, input
35]);
36
37right = utils.spawn.sync(
38 './' + path.basename(output), [],
39 { cwd: path.dirname(output) }
40);
41
42assert.equal(left, right);
43utils.vacuum.sync(output);
44

Built with git-ssb-web