summaryrefslogtreecommitdiff
path: root/test/parallel/test-os-eol.js
blob: 7a7a300717cfe816ce03893fa7849a3e423ea195 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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);