Files: ca90b5ca0579ebdcc0635288bce4978e3fb200f5 / test / test-50-signature / main.js
1403 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 target = process.argv[2] || 'host'; |
14 | const input = './test-x-index.js'; |
15 | const output = './test-output.exe'; |
16 | |
17 | let right; |
18 | |
19 | utils.pkg.sync([ |
20 | '--target', target, |
21 | '--output', output, input |
22 | ]); |
23 | |
24 | let spoiler = fs.readFileSync(output); |
25 | spoiler = Buffer.concat([ spoiler, Buffer.from([ |
26 | 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, |
27 | 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfe, |
28 | 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, |
29 | 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfe, |
30 | 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, |
31 | 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfe, |
32 | 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, |
33 | 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfe, |
34 | 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, |
35 | 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfe, |
36 | 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, |
37 | 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xfe, |
38 | 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78, |
39 | 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef ]) ]); |
40 | fs.writeFileSync(output, spoiler); |
41 | |
42 | right = utils.spawn.sync( |
43 | './' + path.basename(output), [], |
44 | { cwd: path.dirname(output) } |
45 | ); |
46 | |
47 | assert.equal(right, 'ok\n'); |
48 | utils.vacuum.sync(output); |
49 |
Built with git-ssb-web