mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
2ef0f007a4
Create one file for testing each function of the path module. Keep general error tests and tests for constant properties in test-path.js. PR-URL: https://github.com/nodejs/node/pull/15093 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
29 lines
1.4 KiB
JavaScript
29 lines
1.4 KiB
JavaScript
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
const path = require('path');
|
|
|
|
assert.strictEqual(path.win32.isAbsolute('/'), true);
|
|
assert.strictEqual(path.win32.isAbsolute('//'), true);
|
|
assert.strictEqual(path.win32.isAbsolute('//server'), true);
|
|
assert.strictEqual(path.win32.isAbsolute('//server/file'), true);
|
|
assert.strictEqual(path.win32.isAbsolute('\\\\server\\file'), true);
|
|
assert.strictEqual(path.win32.isAbsolute('\\\\server'), true);
|
|
assert.strictEqual(path.win32.isAbsolute('\\\\'), true);
|
|
assert.strictEqual(path.win32.isAbsolute('c'), false);
|
|
assert.strictEqual(path.win32.isAbsolute('c:'), false);
|
|
assert.strictEqual(path.win32.isAbsolute('c:\\'), true);
|
|
assert.strictEqual(path.win32.isAbsolute('c:/'), true);
|
|
assert.strictEqual(path.win32.isAbsolute('c://'), true);
|
|
assert.strictEqual(path.win32.isAbsolute('C:/Users/'), true);
|
|
assert.strictEqual(path.win32.isAbsolute('C:\\Users\\'), true);
|
|
assert.strictEqual(path.win32.isAbsolute('C:cwd/another'), false);
|
|
assert.strictEqual(path.win32.isAbsolute('C:cwd\\another'), false);
|
|
assert.strictEqual(path.win32.isAbsolute('directory/directory'), false);
|
|
assert.strictEqual(path.win32.isAbsolute('directory\\directory'), false);
|
|
|
|
assert.strictEqual(path.posix.isAbsolute('/home/foo'), true);
|
|
assert.strictEqual(path.posix.isAbsolute('/home/foo/..'), true);
|
|
assert.strictEqual(path.posix.isAbsolute('bar/'), false);
|
|
assert.strictEqual(path.posix.isAbsolute('./baz'), false);
|