-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: modernize JS in some test-fs-*.js #23031
Changes from 9 commits
b3adea2
c91bacd
a8826dc
3b3f2bf
52efdf3
90d5f02
1721b43
29ba8b5
be96501
f45ead2
3b9a133
7e2ee7b
7f6555e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,15 +29,9 @@ const assert = require('assert'); | |
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const O_APPEND = fs.constants.O_APPEND || 0; | ||
const O_CREAT = fs.constants.O_CREAT || 0; | ||
const O_EXCL = fs.constants.O_EXCL || 0; | ||
const O_RDONLY = fs.constants.O_RDONLY || 0; | ||
const O_RDWR = fs.constants.O_RDWR || 0; | ||
const O_SYNC = fs.constants.O_SYNC || 0; | ||
const O_DSYNC = fs.constants.O_DSYNC || 0; | ||
const O_TRUNC = fs.constants.O_TRUNC || 0; | ||
const O_WRONLY = fs.constants.O_WRONLY || 0; | ||
// 0 if not found in fs.constants | ||
const { O_APPEND = 0, O_CREAT = 0, O_EXCL = 0, O_RDONLY = 0, O_RDWR = 0, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you keep these each on separate lines? const {
O_APPEND = 0,
O_CREAT = 0,
...
} = fs.constants; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok for readability : I will change |
||
O_SYNC = 0, O_DSYNC = 0, O_TRUNC = 0, O_WRONLY = 0 } = fs.constants; | ||
|
||
const { stringToFlags } = require('internal/fs/utils'); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,34 +30,10 @@ function verifyStats(bigintStats, numStats) { | |
`Number version ${time}, BigInt version ${time2}n`); | ||
} else if (key === 'mode') { | ||
assert.strictEqual(bigintStats[key], BigInt(val)); | ||
assert.strictEqual( | ||
bigintStats.isBlockDevice(), | ||
numStats.isBlockDevice() | ||
); | ||
assert.strictEqual( | ||
bigintStats.isCharacterDevice(), | ||
numStats.isCharacterDevice() | ||
); | ||
assert.strictEqual( | ||
bigintStats.isDirectory(), | ||
numStats.isDirectory() | ||
); | ||
assert.strictEqual( | ||
bigintStats.isFIFO(), | ||
numStats.isFIFO() | ||
); | ||
assert.strictEqual( | ||
bigintStats.isFile(), | ||
numStats.isFile() | ||
); | ||
assert.strictEqual( | ||
bigintStats.isSocket(), | ||
numStats.isSocket() | ||
); | ||
assert.strictEqual( | ||
bigintStats.isSymbolicLink(), | ||
numStats.isSymbolicLink() | ||
); | ||
['isBlockDevice', 'isCharacterDevice', 'isDirectory', 'isFIFO', 'isFile', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. separate lines There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mean one line for each item of the array ? Sure if you want |
||
'isFile', 'isSocket', 'isSymbolicLink' ].forEach( | ||
(fct) => assert.strictEqual(bigintStats[fct](), numStats[fct]())); | ||
|
||
} else if (common.isWindows && (key === 'blksize' || key === 'blocks')) { | ||
assert.strictEqual(bigintStats[key], undefined); | ||
assert.strictEqual(numStats[key], undefined); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
separate lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same that above : I will change