]>
git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/ex-mode/node_modules/fs-plus/node_modules/mkdirp/test/rel.js
79858243ab97d08480e28a3fdc804fcbd79c4c6c
1 var mkdirp
= require('../');
2 var path
= require('path');
3 var fs
= require('fs');
4 var test
= require('tap').test
;
6 test('rel', function (t
) {
8 var x
= Math
.floor(Math
.random() * Math
.pow(16,4)).toString(16);
9 var y
= Math
.floor(Math
.random() * Math
.pow(16,4)).toString(16);
10 var z
= Math
.floor(Math
.random() * Math
.pow(16,4)).toString(16);
12 var cwd
= process
.cwd();
13 process
.chdir('/tmp');
15 var file
= [x
,y
,z
].join('/');
17 mkdirp(file
, 0755, function (err
) {
19 else path
.exists(file
, function (ex
) {
20 if (!ex
) t
.fail('file not created')
21 else fs
.stat(file
, function (err
, stat
) {
25 t
.equal(stat
.mode
& 0777, 0755);
26 t
.ok(stat
.isDirectory(), 'target not a directory');