summaryrefslogtreecommitdiff
path: root/test/parallel/test-os-eol.js
blob: 412751a151b9a27f793939df9ff5b83f6caeef03 (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
'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);

// Test that the `Error` is a `TypeError` but do not check the message as it
// varies between different JavaScript engines.
assert.throws(function() { os.EOL = 123; }, TypeError);

const foo = 'foo';
Object.defineProperties(os, {
  EOL: {
    configurable: true,
    enumerable: true,
    writable: false,
    value: foo
  }
});
assert.strictEqual(os.EOL, foo);