summaryrefslogtreecommitdiff
path: root/test/sequential/test-stream2-fs.js
diff options
context:
space:
mode:
authorTobias Nießen <tniessen@tnie.de>2017-11-10 19:18:12 +0100
committerJames M Snell <jasnell@gmail.com>2017-11-12 10:29:45 -0800
commit3fe165ace6723b1446994574a5197bb70d9a6c72 (patch)
treebec4ec690231e7c71a3d5a9dacbf10ff9b7e189e /test/sequential/test-stream2-fs.js
parentc5a49e148d3293eb9e8c17a15cb8c876977f76af (diff)
downloadandroid-node-v8-3fe165ace6723b1446994574a5197bb70d9a6c72.tar.gz
android-node-v8-3fe165ace6723b1446994574a5197bb70d9a6c72.tar.bz2
android-node-v8-3fe165ace6723b1446994574a5197bb70d9a6c72.zip
test: use ES6 classes instead of util.inherits
PR-URL: https://github.com/nodejs/node/pull/16938 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Diffstat (limited to 'test/sequential/test-stream2-fs.js')
-rw-r--r--test/sequential/test-stream2-fs.js33
1 files changed, 16 insertions, 17 deletions
diff --git a/test/sequential/test-stream2-fs.js b/test/sequential/test-stream2-fs.js
index e2da2dca64..3d06abc921 100644
--- a/test/sequential/test-stream2-fs.js
+++ b/test/sequential/test-stream2-fs.js
@@ -34,27 +34,26 @@ const size = fs.statSync(file).size;
const expectLengths = [1024];
-const util = require('util');
const Stream = require('stream');
-util.inherits(TestWriter, Stream);
+class TestWriter extends Stream {
+ constructor() {
+ super();
+ this.buffer = [];
+ this.length = 0;
+ }
-function TestWriter() {
- Stream.apply(this);
- this.buffer = [];
- this.length = 0;
-}
-
-TestWriter.prototype.write = function(c) {
- this.buffer.push(c.toString());
- this.length += c.length;
- return true;
-};
+ write(c) {
+ this.buffer.push(c.toString());
+ this.length += c.length;
+ return true;
+ }
-TestWriter.prototype.end = function(c) {
- if (c) this.buffer.push(c.toString());
- this.emit('results', this.buffer);
-};
+ end(c) {
+ if (c) this.buffer.push(c.toString());
+ this.emit('results', this.buffer);
+ }
+}
const r = new FSReadable(file);
const w = new TestWriter();