GT2/Ejectable/node_modules/absolute-path/test/index.js

20 lines
731 B
JavaScript
Raw Normal View History

2021-08-16 00:14:59 +00:00
var assert = require('assert');
var isAbsolute = require('../');
isAbsolute.setPlatform('win32');
assert.equal(isAbsolute('//server/file'), true);
assert.equal(isAbsolute('\\\\server\\file'), true);
assert.equal(isAbsolute('C:/Users/'), true);
assert.equal(isAbsolute('C:\\Users\\'), true);
assert.equal(isAbsolute('C:cwd/another'), false);
assert.equal(isAbsolute('C:cwd\\another'), false);
assert.equal(isAbsolute('directory/directory'), false);
assert.equal(isAbsolute('directory\\directory'), false);
isAbsolute.setPlatform('');
assert.equal(isAbsolute('/home/foo'), true);
assert.equal(isAbsolute('/home/foo/..'), true);
assert.equal(isAbsolute('bar/'), false);
assert.equal(isAbsolute('./baz'), false);