diff options
author | Alexey Orlenko <eaglexrlnk@gmail.com> | 2017-03-08 02:37:35 +0200 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-03-14 17:27:22 -0700 |
commit | 205f4e500654d38e12df38b0d45925a5850046bb (patch) | |
tree | 467a0bb2647279a420a92f292c6a37b9510f2011 /test/parallel/test-repl-function-definition-edge-case.js | |
parent | 27f4c9407f1b052512e2bbd8262a627ab785fa20 (diff) | |
download | android-node-v8-205f4e500654d38e12df38b0d45925a5850046bb.tar.gz android-node-v8-205f4e500654d38e12df38b0d45925a5850046bb.tar.bz2 android-node-v8-205f4e500654d38e12df38b0d45925a5850046bb.zip |
test: fix repl-function-redefinition-edge-case
`test/known_issues/test-repl-function-redefinition-edge-case.js` had
been introduced as a part of https://github.com/nodejs/node/pull/7624
but the meat of the test became fixed in
007386ee81ceeffd65c2248869717b0717db3e46. Despite that, the test
continued to fail since it was broken itself: there was a missing colon
in the expected output.
This commit adds the missing colon and moves the test from
`test/known_issues` to `test/parallel`.
PR-URL: https://github.com/nodejs/node/pull/11772
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'test/parallel/test-repl-function-definition-edge-case.js')
-rw-r--r-- | test/parallel/test-repl-function-definition-edge-case.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/parallel/test-repl-function-definition-edge-case.js b/test/parallel/test-repl-function-definition-edge-case.js new file mode 100644 index 0000000000..1e3063e3db --- /dev/null +++ b/test/parallel/test-repl-function-definition-edge-case.js @@ -0,0 +1,38 @@ +// Reference: https://github.com/nodejs/node/pull/7624 +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const repl = require('repl'); +const stream = require('stream'); + +common.globalCheck = false; + +const r = initRepl(); + +r.input.emit('data', 'function a() { return 42; } (1)\n'); +r.input.emit('data', 'a\n'); +r.input.emit('data', '.exit'); + +const expected = '1\n[Function: a]\n'; +const got = r.output.accumulator.join(''); +assert.strictEqual(got, expected); + +function initRepl() { + const input = new stream(); + input.write = input.pause = input.resume = () => {}; + input.readable = true; + + const output = new stream(); + output.writable = true; + output.accumulator = []; + + output.write = (data) => output.accumulator.push(data); + + return repl.start({ + input, + output, + useColors: false, + terminal: false, + prompt: '' + }); +} |