]>
git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/ex-mode/node_modules/space-pen/node_modules/grim/node_modules/coffeestack/node_modules/coffee-script/node_modules/mkdirp/test/umask.js
64ccafe22bc71f07b19050cbb595f9f60fcca29c
1 var mkdirp
= require('../');
2 var path
= require('path');
3 var fs
= require('fs');
4 var test
= require('tap').test
;
6 test('implicit mode from umask', 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 file
= '/tmp/' + [x
,y
,z
].join('/');
14 mkdirp(file
, function (err
) {
16 else path
.exists(file
, function (ex
) {
17 if (!ex
) t
.fail('file not created')
18 else fs
.stat(file
, function (err
, stat
) {
21 t
.equal(stat
.mode
& 0777, 0777 & (~process
.umask()));
22 t
.ok(stat
.isDirectory(), 'target not a directory');