index.js 731 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
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);