Enable linting for the test directory. A number of changes was made so all tests conform the current rules used by lib and src directories. The only exception for tests is that unreachable (dead) code is allowed. test-fs-non-number-arguments-throw had to be excluded from the changes because of a weird issue on Windows CI. PR-URL: https://github.com/nodejs/io.js/pull/1721 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
22 lines
504 B
JavaScript
22 lines
504 B
JavaScript
'use strict';
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
var path = require('path');
|
|
var fs = require('fs');
|
|
var fn = path.join(common.tmpDir, 'write.txt');
|
|
|
|
|
|
var foo = 'foo';
|
|
var fd = fs.openSync(fn, 'w');
|
|
|
|
var written = fs.writeSync(fd, '');
|
|
assert.strictEqual(0, written);
|
|
|
|
fs.writeSync(fd, foo);
|
|
|
|
var bar = 'bár';
|
|
written = fs.writeSync(fd, new Buffer(bar), 0, Buffer.byteLength(bar));
|
|
assert.ok(written > 3);
|
|
fs.closeSync(fd);
|
|
|
|
assert.equal(fs.readFileSync(fn), 'foobár');
|