Skip to content

Commit ed07938

Browse files
committed
Port test-path-isabsolute.
1 parent 2d4aab4 commit ed07938

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

test/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ require('./test-path');
22
require('./test-path-basename');
33
require('./test-path-dirname');
44
require('./test-path-extname');
5+
require('./test-path-isabsolute');
56
require('./test-path-join');
67
require('./test-path-relative');
78
require('./test-path-resolve');

test/test-path-isabsolute.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
'use strict';
2+
var tape = require('tape');
3+
var path = require('../');
4+
5+
tape('path.win32.isAbsolute', { skip: true }, function (t) {
6+
t.strictEqual(path.win32.isAbsolute('/'), true);
7+
t.strictEqual(path.win32.isAbsolute('//'), true);
8+
t.strictEqual(path.win32.isAbsolute('//server'), true);
9+
t.strictEqual(path.win32.isAbsolute('//server/file'), true);
10+
t.strictEqual(path.win32.isAbsolute('\\\\server\\file'), true);
11+
t.strictEqual(path.win32.isAbsolute('\\\\server'), true);
12+
t.strictEqual(path.win32.isAbsolute('\\\\'), true);
13+
t.strictEqual(path.win32.isAbsolute('c'), false);
14+
t.strictEqual(path.win32.isAbsolute('c:'), false);
15+
t.strictEqual(path.win32.isAbsolute('c:\\'), true);
16+
t.strictEqual(path.win32.isAbsolute('c:/'), true);
17+
t.strictEqual(path.win32.isAbsolute('c://'), true);
18+
t.strictEqual(path.win32.isAbsolute('C:/Users/'), true);
19+
t.strictEqual(path.win32.isAbsolute('C:\\Users\\'), true);
20+
t.strictEqual(path.win32.isAbsolute('C:cwd/another'), false);
21+
t.strictEqual(path.win32.isAbsolute('C:cwd\\another'), false);
22+
t.strictEqual(path.win32.isAbsolute('directory/directory'), false);
23+
t.strictEqual(path.win32.isAbsolute('directory\\directory'), false);
24+
t.end();
25+
});
26+
27+
tape('path.posix.isAbsolute', function (t) {
28+
t.strictEqual(path.posix.isAbsolute('/home/foo'), true);
29+
t.strictEqual(path.posix.isAbsolute('/home/foo/..'), true);
30+
t.strictEqual(path.posix.isAbsolute('bar/'), false);
31+
t.strictEqual(path.posix.isAbsolute('./baz'), false);
32+
t.end();
33+
});

0 commit comments

Comments
 (0)