summaryrefslogtreecommitdiff
path: root/test/parallel/test-os-eol.js
diff options
context:
space:
mode:
authorXadillaX <admin@xcoder.in>2017-08-17 11:52:30 +0800
committerRefael Ackermann <refack@gmail.com>2017-08-21 00:23:24 -0400
commitf6caeb952605ffa9968ccd88eb330829f980a536 (patch)
tree7c2275a00651e5f6f90d11e932bcae6c86c71356 /test/parallel/test-os-eol.js
parent3a886ffa2431ac984a1e19dae51049d956d29249 (diff)
downloadnode-new-f6caeb952605ffa9968ccd88eb330829f980a536.tar.gz
os: make EOL configurable and read only
PR-URL: https://github.com/nodejs/node/pull/14622 Fixes: https://github.com/nodejs/node/issues/14619 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'test/parallel/test-os-eol.js')
-rw-r--r--test/parallel/test-os-eol.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/parallel/test-os-eol.js b/test/parallel/test-os-eol.js
new file mode 100644
index 0000000000..7a7a300717
--- /dev/null
+++ b/test/parallel/test-os-eol.js
@@ -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);