mirror of
https://github.com/nodejs/node.git
synced 2025-05-10 20:34:33 +00:00

PR-URL: https://github.com/nodejs/node/pull/22506 Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
25 lines
556 B
JavaScript
25 lines
556 B
JavaScript
'use strict';
|
|
const { isWindows } = require('../common');
|
|
const assert = require('assert');
|
|
const url = require('url');
|
|
|
|
{
|
|
const fileURL = url.pathToFileURL('test/').href;
|
|
assert.ok(fileURL.startsWith('file:///'));
|
|
assert.ok(fileURL.endsWith('/'));
|
|
}
|
|
|
|
{
|
|
const fileURL = url.pathToFileURL('test\\').href;
|
|
assert.ok(fileURL.startsWith('file:///'));
|
|
if (isWindows)
|
|
assert.ok(fileURL.endsWith('/'));
|
|
else
|
|
assert.ok(fileURL.endsWith('%5C'));
|
|
}
|
|
|
|
{
|
|
const fileURL = url.pathToFileURL('test/%').href;
|
|
assert.ok(fileURL.includes('%25'));
|
|
}
|