mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
85301803e1
PR-URL: https://github.com/nodejs/node/pull/49869 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
28 lines
810 B
JavaScript
28 lines
810 B
JavaScript
// Flags: --expose-internals
|
|
'use strict';
|
|
require('../common');
|
|
const assert = require('node:assert');
|
|
const path = require('node:path');
|
|
const { extname } = require('node:internal/modules/esm/get_format');
|
|
const { fileURLToPath } = require('node:url');
|
|
|
|
[
|
|
'file:///c:/path/to/file',
|
|
'file:///c:/path/to/file.ext',
|
|
'file:///c:/path.to/file.ext',
|
|
'file:///c:/path.to/file',
|
|
'file:///c:/path.to/.file',
|
|
'file:///c:/path.to/.file.ext',
|
|
'file:///c:/path/to/f.ext',
|
|
'file:///c:/path/to/..ext',
|
|
'file:///c:/path/to/..',
|
|
'file:///c:/file',
|
|
'file:///c:/file.ext',
|
|
'file:///c:/.file',
|
|
'file:///c:/.file.ext',
|
|
].forEach((input) => {
|
|
const inputAsURL = new URL(input);
|
|
const inputAsPath = fileURLToPath(inputAsURL);
|
|
assert.strictEqual(extname(inputAsURL), path.extname(inputAsPath));
|
|
});
|