-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
os: make EOL configurable and read only
PR-URL: #14622 Fixes: #14619 Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Alexey Orlenko <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rod Vagg <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
- Loading branch information
Showing
2 changed files
with
40 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const os = require('os'); | ||
|
||
const eol = common.isWindows ? '\r\n' : '\n'; | ||
|
||
assert.strictEqual(os.EOL, eol); | ||
|
||
common.expectsError(function() { | ||
os.EOL = 123; | ||
}, { | ||
type: TypeError, | ||
message: /^Cannot assign to read only property 'EOL' of object '#<Object>'$/ | ||
}); | ||
|
||
const foo = 'foo'; | ||
Object.defineProperties(os, { | ||
EOL: { | ||
configurable: true, | ||
enumerable: true, | ||
writable: false, | ||
value: foo | ||
} | ||
}); | ||
assert.strictEqual(os.EOL, foo); |