xref: /third_party/node/test/parallel/test-os-eol.js (revision 1cb0ef41)
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciconst common = require('../common');
41cb0ef41Sopenharmony_ciconst assert = require('assert');
51cb0ef41Sopenharmony_ciconst os = require('os');
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciconst eol = common.isWindows ? '\r\n' : '\n';
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ciassert.strictEqual(os.EOL, eol);
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_ci// Test that the `Error` is a `TypeError` but do not check the message as it
121cb0ef41Sopenharmony_ci// varies between different JavaScript engines.
131cb0ef41Sopenharmony_ciassert.throws(function() { os.EOL = 123; }, TypeError);
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ciconst foo = 'foo';
161cb0ef41Sopenharmony_ciObject.defineProperties(os, {
171cb0ef41Sopenharmony_ci  EOL: {
181cb0ef41Sopenharmony_ci    configurable: true,
191cb0ef41Sopenharmony_ci    enumerable: true,
201cb0ef41Sopenharmony_ci    writable: false,
211cb0ef41Sopenharmony_ci    value: foo
221cb0ef41Sopenharmony_ci  }
231cb0ef41Sopenharmony_ci});
241cb0ef41Sopenharmony_ciassert.strictEqual(os.EOL, foo);
25

Indexes created Thu Nov 07 10:32:03 CST 2024