eae26e508b7ee9ddbcbf0a4c5e7bd2af5176adcf.svn-base
1.2 KB
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
/**
* Temporary - The lord of tmp.
*
* Author: Veselin Todorov <hi@vesln.com>
* Licensed under the MIT License.
*/
/**
* Dependencies.
*/
var detector = require('../lib/detector');
var should = require('chai').should();
describe('detector', function() {
describe('tmp', function() {
it('should return the tmp dir of the system', function() {
var tmp = process.env.TMPDIR
|| process.env.TMP
|| process.env.TEMP
|| (process.platform === "win32" ? "c:\\windows\\temp\\" : "/tmp/");
detector.tmp().should.eql(tmp);
});
it('should normalize windows paths correctly', function () {
var platform_noConflict = detector.platform;
detector.platform = function() {
return 'win32';
};
detector._normalize('c:\\windows\\foo\\bar\\')
.should.eql('c:\\windows\\foo\\bar\\/');
detector._normalize('c:/windows/foo/bar/')
.should.eql('c:/windows/foo/bar//');
detector._normalize('c:/windows/foo/bar')
.should.eql('c:/windows/foo/bar/');
detector._normalize('c:\\windows\\foo\\bar')
.should.eql('c:\\windows\\foo\\bar/');
detector.platform = platform_noConflict;
});
});
});