From f29762f4dd5811464684f820286f1c90a694bdff Mon Sep 17 00:00:00 2001 From: Roman Reiss Date: Tue, 19 May 2015 13:00:06 +0200 Subject: test: enable linting for tests 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 --- test/parallel/test-fs-chmod.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'test/parallel/test-fs-chmod.js') diff --git a/test/parallel/test-fs-chmod.js b/test/parallel/test-fs-chmod.js index 55056125da..a9d694adec 100644 --- a/test/parallel/test-fs-chmod.js +++ b/test/parallel/test-fs-chmod.js @@ -1,3 +1,4 @@ +'use strict'; var common = require('../common'); var assert = require('assert'); var path = require('path'); @@ -44,11 +45,11 @@ function closeSync() { // On Windows chmod is only able to manipulate read-only bit if (is_windows) { - mode_async = 0400; // read-only - mode_sync = 0600; // read-write + mode_async = 0o400; // read-only + mode_sync = 0o600; // read-write } else { - mode_async = 0777; - mode_sync = 0644; + mode_async = 0o777; + mode_sync = 0o644; } var file1 = path.join(common.fixturesDir, 'a.js'), @@ -61,16 +62,16 @@ fs.chmod(file1, mode_async.toString(8), function(err) { console.log(fs.statSync(file1).mode); if (is_windows) { - assert.ok((fs.statSync(file1).mode & 0777) & mode_async); + assert.ok((fs.statSync(file1).mode & 0o777) & mode_async); } else { - assert.equal(mode_async, fs.statSync(file1).mode & 0777); + assert.equal(mode_async, fs.statSync(file1).mode & 0o777); } fs.chmodSync(file1, mode_sync); if (is_windows) { - assert.ok((fs.statSync(file1).mode & 0777) & mode_sync); + assert.ok((fs.statSync(file1).mode & 0o777) & mode_sync); } else { - assert.equal(mode_sync, fs.statSync(file1).mode & 0777); + assert.equal(mode_sync, fs.statSync(file1).mode & 0o777); } success_count++; } @@ -89,16 +90,16 @@ fs.open(file2, 'a', function(err, fd) { console.log(fs.fstatSync(fd).mode); if (is_windows) { - assert.ok((fs.fstatSync(fd).mode & 0777) & mode_async); + assert.ok((fs.fstatSync(fd).mode & 0o777) & mode_async); } else { - assert.equal(mode_async, fs.fstatSync(fd).mode & 0777); + assert.equal(mode_async, fs.fstatSync(fd).mode & 0o777); } fs.fchmodSync(fd, mode_sync); if (is_windows) { - assert.ok((fs.fstatSync(fd).mode & 0777) & mode_sync); + assert.ok((fs.fstatSync(fd).mode & 0o777) & mode_sync); } else { - assert.equal(mode_sync, fs.fstatSync(fd).mode & 0777); + assert.equal(mode_sync, fs.fstatSync(fd).mode & 0o777); } success_count++; fs.close(fd); @@ -120,10 +121,10 @@ if (fs.lchmod) { got_error = true; } else { console.log(fs.lstatSync(link).mode); - assert.equal(mode_async, fs.lstatSync(link).mode & 0777); + assert.equal(mode_async, fs.lstatSync(link).mode & 0o777); fs.lchmodSync(link, mode_sync); - assert.equal(mode_sync, fs.lstatSync(link).mode & 0777); + assert.equal(mode_sync, fs.lstatSync(link).mode & 0o777); success_count++; } }); -- cgit v1.2.3