diff options
author | cjihrig <cjihrig@gmail.com> | 2015-11-25 16:38:01 -0500 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2015-11-26 21:16:08 -0500 |
commit | f2e319b7578326b0f5adb5c986533d3136404cbd (patch) | |
tree | 65711638400d72e0468ef2df38b7b376c0c79051 /test/parallel/test-repl-autolibs.js | |
parent | 1c8584997346d549dd5ff4bb787f48f52440a9cb (diff) | |
download | android-node-v8-f2e319b7578326b0f5adb5c986533d3136404cbd.tar.gz android-node-v8-f2e319b7578326b0f5adb5c986533d3136404cbd.tar.bz2 android-node-v8-f2e319b7578326b0f5adb5c986533d3136404cbd.zip |
test: move ArrayStream to common
A number of REPL tests define the same ArrayStream object. This
commit moves the repeated code into common.js.
PR-URL: https://github.com/nodejs/node/pull/4027
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'test/parallel/test-repl-autolibs.js')
-rw-r--r-- | test/parallel/test-repl-autolibs.js | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/test/parallel/test-repl-autolibs.js b/test/parallel/test-repl-autolibs.js index e37f2d036e..05cc299f56 100644 --- a/test/parallel/test-repl-autolibs.js +++ b/test/parallel/test-repl-autolibs.js @@ -1,25 +1,13 @@ -/* eslint-disable required-modules */ 'use strict'; +const common = require('../common'); var assert = require('assert'); var util = require('util'); var repl = require('repl'); -// A stream to push an array into a REPL -function ArrayStream() { - this.run = function(data) { - var self = this; - data.forEach(function(line) { - self.emit('data', line + '\n'); - }); - }; -} -util.inherits(ArrayStream, require('stream').Stream); -ArrayStream.prototype.readable = true; -ArrayStream.prototype.writable = true; -ArrayStream.prototype.resume = function() {}; -ArrayStream.prototype.write = function() {}; +// This test adds global variables +common.globalCheck = false; -var putIn = new ArrayStream(); +const putIn = new common.ArrayStream(); var testMe = repl.start('', putIn, null, true); test1(); |