mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 09:02:40 +00:00

Replace var keyword with const or let. PR-URL: https://github.com/nodejs/io.js/pull/2286 Reviewed-By: Roman Reiss <me@silverwind.io>
26 lines
662 B
JavaScript
26 lines
662 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const path = require('path');
|
|
const fs = require('fs');
|
|
const filepath = path.join(common.fixturesDir, 'x.txt');
|
|
const fd = fs.openSync(filepath, 'r');
|
|
const expected = 'xyz\n';
|
|
let readCalled = 0;
|
|
|
|
fs.read(fd, expected.length, 0, 'utf-8', function(err, str, bytesRead) {
|
|
readCalled++;
|
|
|
|
assert.ok(!err);
|
|
assert.equal(str, expected);
|
|
assert.equal(bytesRead, expected.length);
|
|
});
|
|
|
|
var r = fs.readSync(fd, expected.length, 0, 'utf-8');
|
|
assert.equal(r[0], expected);
|
|
assert.equal(r[1], expected.length);
|
|
|
|
process.on('exit', function() {
|
|
assert.equal(readCalled, 1);
|
|
});
|