-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
test.js
46 lines (38 loc) · 1.79 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
'use strict';
require('mocha');
var assert = require('assert');
var unixify = require('./');
describe('unixify', function() {
it('should convert backslashes to forward slashes', function() {
assert.equal(unixify('one\\two\\three'), 'one/two/three');
});
it('should strip trailing slashes', function() {
assert.equal(unixify('one/two/three/'), 'one/two/three');
assert.equal(unixify('one\\two\\three\\'), 'one/two/three');
});
it('should not strip trailing slashes when disabled', function() {
assert.equal(unixify('one\\two\\three\\', false), 'one/two/three/');
assert.equal(unixify('one/two/three/', false), 'one/two/three/');
});
it('should strip leading `./`', function() {
assert.equal(unixify('.\\one\\two\\three\\'), 'one/two/three');
assert.equal(unixify('./one/two/three/'), 'one/two/three');
});
it('should condense multiple slashes to one', function() {
assert.equal(unixify('one\\two\\//three'), 'one/two/three');
assert.equal(unixify('one//two//////three'), 'one/two/three');
});
it('should strip windows drive letters', function() {
assert.equal(unixify('C:////one//two//three'), '/one/two/three');
assert.equal(unixify('C:////one//two//three'), '/one/two/three');
assert.equal(unixify('C://one//two//three'), '/one/two/three');
assert.equal(unixify('C:/one/two/three'), '/one/two/three');
assert.equal(unixify('C:\\//one\\//two\\//three'), '/one/two/three');
assert.equal(unixify('C:\\//one\\two\\three'), '/one/two/three');
assert.equal(unixify('C:\\\\one\\two\\three'), '/one/two/three');
assert.equal(unixify('C:\\one\\two\\three'), '/one/two/three');
});
it('should condense multiple slashes following drive letter', function() {
assert.equal(unixify('C:\\//one\\two\\//three'), '/one/two/three');
});
});