xref: /third_party/node/test/es-module/test-esm-url-extname.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/es-module/
11cb0ef41Sopenharmony_ci// Flags: --expose-internals
21cb0ef41Sopenharmony_ci'use strict';
31cb0ef41Sopenharmony_cirequire('../common');
41cb0ef41Sopenharmony_ciconst assert = require('node:assert');
51cb0ef41Sopenharmony_ciconst path = require('node:path');
61cb0ef41Sopenharmony_ciconst { extname } = require('node:internal/modules/esm/get_format');
71cb0ef41Sopenharmony_ciconst { fileURLToPath } = require('node:url');
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci[
101cb0ef41Sopenharmony_ci  'file:///c:/path/to/file',
111cb0ef41Sopenharmony_ci  'file:///c:/path/to/file.ext',
121cb0ef41Sopenharmony_ci  'file:///c:/path.to/file.ext',
131cb0ef41Sopenharmony_ci  'file:///c:/path.to/file',
141cb0ef41Sopenharmony_ci  'file:///c:/path.to/.file',
151cb0ef41Sopenharmony_ci  'file:///c:/path.to/.file.ext',
161cb0ef41Sopenharmony_ci  'file:///c:/path/to/f.ext',
171cb0ef41Sopenharmony_ci  'file:///c:/path/to/..ext',
181cb0ef41Sopenharmony_ci  'file:///c:/path/to/..',
191cb0ef41Sopenharmony_ci  'file:///c:/file',
201cb0ef41Sopenharmony_ci  'file:///c:/file.ext',
211cb0ef41Sopenharmony_ci  'file:///c:/.file',
221cb0ef41Sopenharmony_ci  'file:///c:/.file.ext',
231cb0ef41Sopenharmony_ci].forEach((input) => {
241cb0ef41Sopenharmony_ci  const inputAsURL = new URL(input);
251cb0ef41Sopenharmony_ci  const inputAsPath = fileURLToPath(inputAsURL);
261cb0ef41Sopenharmony_ci  assert.strictEqual(extname(inputAsURL), path.extname(inputAsPath));
271cb0ef41Sopenharmony_ci});
28

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