|
1 | 1 | 'use strict';
|
2 |
| -var common = require('../common'); |
3 |
| -var assert = require('assert'); |
4 |
| -var path = require('path'); |
5 |
| -var fs = require('fs'); |
| 2 | +const common = require('../common'); |
| 3 | +const assert = require('assert'); |
| 4 | +const path = require('path'); |
| 5 | +const fs = require('fs'); |
6 | 6 |
|
7 |
| -var emptyFile = path.join(common.fixturesDir, 'empty.txt'); |
| 7 | +const emptyFile = path.join(common.fixturesDir, 'empty.txt'); |
8 | 8 |
|
9 |
| -fs.open(emptyFile, 'r', function(error, fd) { |
| 9 | +fs.open(emptyFile, 'r', common.mustCall((error, fd) => { |
10 | 10 | assert.ifError(error);
|
11 | 11 |
|
12 |
| - var read = fs.createReadStream(emptyFile, { 'fd': fd }); |
| 12 | + const read = fs.createReadStream(emptyFile, { 'fd': fd }); |
13 | 13 |
|
14 |
| - read.once('data', function() { |
| 14 | + read.once('data', () => { |
15 | 15 | throw new Error('data event should not emit');
|
16 | 16 | });
|
17 | 17 |
|
18 | 18 | read.once('end', common.mustCall(function endEvent1() {}));
|
19 |
| -}); |
| 19 | +})); |
20 | 20 |
|
21 |
| -fs.open(emptyFile, 'r', function(error, fd) { |
| 21 | +fs.open(emptyFile, 'r', common.mustCall((error, fd) => { |
22 | 22 | assert.ifError(error);
|
23 | 23 |
|
24 |
| - var read = fs.createReadStream(emptyFile, { 'fd': fd }); |
| 24 | + const read = fs.createReadStream(emptyFile, { 'fd': fd }); |
25 | 25 | read.pause();
|
26 | 26 |
|
27 |
| - read.once('data', function() { |
| 27 | + read.once('data', () => { |
28 | 28 | throw new Error('data event should not emit');
|
29 | 29 | });
|
30 | 30 |
|
31 | 31 | read.once('end', function endEvent2() {
|
32 | 32 | throw new Error('end event should not emit');
|
33 | 33 | });
|
34 | 34 |
|
35 |
| - setTimeout(function() { |
36 |
| - assert.equal(read.isPaused(), true); |
37 |
| - }, common.platformTimeout(50)); |
38 |
| -}); |
| 35 | + setTimeout(common.mustCall(() => { |
| 36 | + assert.strictEqual(read.isPaused(), true); |
| 37 | + }), common.platformTimeout(50)); |
| 38 | +})); |
0 commit comments