Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
test: make sure O_NOATIME is present only in Linux
As it is, the test checks if the return value is `undefined` in other
platforms. But it should also make sure that the `O_NOATIME` should be
found only in Linux.
  • Loading branch information
thefourtheye committed May 6, 2016
commit 629ce17e54ba8385f3d0195f545d3a8ff6ec6689
15 changes: 8 additions & 7 deletions test/parallel/test-process-constants-noatime.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

require('../common');
const assert = require('assert');

const isLinux = process.platform === 'linux';

const O_NOATIME = process.binding('constants').O_NOATIME;
const expected = isLinux ? 0x40000 : undefined;

assert.strictEqual(O_NOATIME, expected);
const constants = process.binding('constants');

if (process.platform === 'linux') {
assert(constants.hasOwnProperty('O_NOATIME'));
assert.strictEqual(constants.O_NOATIME, 0x40000);
} else {
assert(false === constants.hasOwnProperty('O_NOATIME'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use !('O_NOATIME' in constants), it will check the prototype as well (for the very unlikely case that we decide to move things to the prototype in the future.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

}