From 7ff64301cbe4f044d30c0db659663db03a5d57e7 Mon Sep 17 00:00:00 2001 From: IgorKlopov Date: Sun, 8 Dec 2019 00:05:13 +0300 Subject: [PATCH] test: test-50-bakery-4 for baking non-v8 options --- test/test-50-bakery-4/main.js | 44 +++++++++++++++++++++++++++ test/test-50-bakery-4/test-x-index.js | 3 ++ 2 files changed, 47 insertions(+) create mode 100644 test/test-50-bakery-4/main.js create mode 100644 test/test-50-bakery-4/test-x-index.js diff --git a/test/test-50-bakery-4/main.js b/test/test-50-bakery-4/main.js new file mode 100644 index 000000000..0ce36bc2b --- /dev/null +++ b/test/test-50-bakery-4/main.js @@ -0,0 +1,44 @@ +#!/usr/bin/env node + +'use strict'; + +const path = require('path'); +const assert = require('assert'); +const utils = require('../utils.js'); + +assert(!module.parent); +assert(__dirname === process.cwd()); + +const target = process.argv[2] || 'host'; +const input = './test-x-index.js'; +const output = './run-time/test-output.exe'; + +let left; +utils.mkdirp.sync(path.dirname(output)); + +left = utils.spawn.sync( + 'node', [ '--v8-options' ], + { cwd: path.dirname(input) } +); + +for (const option of [ 'v8-options', 'v8_options' ]) { + let right; + + utils.pkg.sync([ + '--target', target, + '--options', option, + '--output', output, input + ]); + + right = utils.spawn.sync( + './' + path.basename(output), [], + { cwd: path.dirname(output) } + ); + + assert(left.indexOf('--expose_gc') >= 0 || + left.indexOf('--expose-gc') >= 0); + assert(right.indexOf('--expose_gc') >= 0 || + right.indexOf('--expose-gc') >= 0); +} + +utils.vacuum.sync(path.dirname(output)); diff --git a/test/test-50-bakery-4/test-x-index.js b/test/test-50-bakery-4/test-x-index.js new file mode 100644 index 000000000..fb7b00475 --- /dev/null +++ b/test/test-50-bakery-4/test-x-index.js @@ -0,0 +1,3 @@ +'use strict'; + +console.log('should not be executed');