diff options
author | cjihrig <cjihrig@gmail.com> | 2016-03-10 21:08:35 -0500 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2016-03-12 09:56:29 -0500 |
commit | 10bc673123f29692b7dae5e306a155ed0210e413 (patch) | |
tree | ccea8918306489c6e7fdfe870b7305f807bc53e1 /test/known_issues | |
parent | 4daab7f8edf4176dc9be2e7051fc11588fd971c2 (diff) | |
download | android-node-v8-10bc673123f29692b7dae5e306a155ed0210e413.tar.gz android-node-v8-10bc673123f29692b7dae5e306a155ed0210e413.tar.bz2 android-node-v8-10bc673123f29692b7dae5e306a155ed0210e413.zip |
test: add batch of known issue tests
This commit adds tests for several known issues.
Refs: https://github.com/nodejs/node/issues/1901
Refs: https://github.com/nodejs/node/issues/728
Refs: https://github.com/nodejs/node/issues/4778
Refs: https://github.com/nodejs/node/issues/947
Refs: https://github.com/nodejs/node/issues/2734
PR-URL: https://github.com/nodejs/node/pull/5653
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'test/known_issues')
-rw-r--r-- | test/known_issues/test-child-process-max-buffer.js | 16 | ||||
-rw-r--r-- | test/known_issues/test-events-known-properties.js | 12 | ||||
-rw-r--r-- | test/known_issues/test-module-deleted-extensions.js | 17 | ||||
-rw-r--r-- | test/known_issues/test-process-external-stdio-close.js | 23 | ||||
-rw-r--r-- | test/known_issues/test-vm-getters.js | 19 |
5 files changed, 87 insertions, 0 deletions
diff --git a/test/known_issues/test-child-process-max-buffer.js b/test/known_issues/test-child-process-max-buffer.js new file mode 100644 index 0000000000..14a344c706 --- /dev/null +++ b/test/known_issues/test-child-process-max-buffer.js @@ -0,0 +1,16 @@ +'use strict'; +// Refs: https://github.com/nodejs/node/issues/1901 +const common = require('../common'); +const assert = require('assert'); +const cp = require('child_process'); +const unicode = '中文测试'; // Length = 4, Byte length = 13 + +if (process.argv[2] === 'child') { + console.log(unicode); +} else { + const cmd = `${process.execPath} ${__filename} child`; + + cp.exec(cmd, { maxBuffer: 10 }, common.mustCall((err, stdout, stderr) => { + assert.strictEqual(err.message, 'stdout maxBuffer exceeded'); + })); +} diff --git a/test/known_issues/test-events-known-properties.js b/test/known_issues/test-events-known-properties.js new file mode 100644 index 0000000000..944fa3da2b --- /dev/null +++ b/test/known_issues/test-events-known-properties.js @@ -0,0 +1,12 @@ +'use strict'; +// Refs: https://github.com/nodejs/node/issues/728 +const common = require('../common'); +const assert = require('assert'); +const EventEmitter = require('events'); +const ee = new EventEmitter(); + +ee.on('__proto__', common.mustCall((data) => { + assert.strictEqual(data, 42); +})); + +ee.emit('__proto__', 42); diff --git a/test/known_issues/test-module-deleted-extensions.js b/test/known_issues/test-module-deleted-extensions.js new file mode 100644 index 0000000000..45ec41ad60 --- /dev/null +++ b/test/known_issues/test-module-deleted-extensions.js @@ -0,0 +1,17 @@ +'use strict'; +// Refs: https://github.com/nodejs/node/issues/4778 +const common = require('../common'); +const assert = require('assert'); +const fs = require('fs'); +const path = require('path'); +const file = path.join(common.tmpDir, 'test-extensions.foo.bar'); + +common.refreshTmpDir(); +fs.writeFileSync(file, '', 'utf8'); +require.extensions['.foo.bar'] = (module, path) => {}; +delete require.extensions['.foo.bar']; +require.extensions['.bar'] = common.mustCall((module, path) => { + assert.strictEqual(module.id, file); + assert.strictEqual(path, file); +}); +require(path.join(common.tmpDir, 'test-extensions')); diff --git a/test/known_issues/test-process-external-stdio-close.js b/test/known_issues/test-process-external-stdio-close.js new file mode 100644 index 0000000000..79e3641bdf --- /dev/null +++ b/test/known_issues/test-process-external-stdio-close.js @@ -0,0 +1,23 @@ +'use strict'; +// Refs: https://github.com/nodejs/node/issues/947 +const common = require('../common'); +const assert = require('assert'); +const cp = require('child_process'); + +if (process.argv[2] === 'child') { + process.on('message', common.mustCall((msg) => { + assert.strictEqual(msg, 'go'); + console.log('logging should not cause a crash'); + process.disconnect(); + })); +} else { + const child = cp.fork(__filename, ['child'], {silent: true}); + + child.on('close', common.mustCall((exitCode, signal) => { + assert.strictEqual(exitCode, 0); + assert.strictEqual(signal, null); + })); + + child.stdout.destroy(); + child.send('go'); +} diff --git a/test/known_issues/test-vm-getters.js b/test/known_issues/test-vm-getters.js new file mode 100644 index 0000000000..f815e6d658 --- /dev/null +++ b/test/known_issues/test-vm-getters.js @@ -0,0 +1,19 @@ +'use strict'; +// Refs: https://github.com/nodejs/node/issues/2734 +require('../common'); +const assert = require('assert'); +const vm = require('vm'); +const sandbox = {}; + +Object.defineProperty(sandbox, 'prop', { + get() { + return 'foo'; + } +}); + +const descriptor = Object.getOwnPropertyDescriptor(sandbox, 'prop'); +const context = vm.createContext(sandbox); +const code = 'Object.getOwnPropertyDescriptor(this, "prop");'; +const result = vm.runInContext(code, context); + +assert.strictEqual(result, descriptor); |