]>
git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/ex-mode/node_modules/fs-plus/node_modules/mkdirp/test/chmod.js
1 var mkdirp
= require('../').mkdirp
;
2 var path
= require('path');
3 var fs
= require('fs');
4 var test
= require('tap').test
;
6 var ps
= [ '', 'tmp' ];
8 for (var i
= 0; i
< 25; i
++) {
9 var dir
= Math
.floor(Math
.random() * Math
.pow(16,4)).toString(16);
13 var file
= ps
.join('/');
15 test('chmod-pre', function (t
) {
17 mkdirp(file
, mode
, function (er
) {
18 t
.ifError(er
, 'should not error');
19 fs
.stat(file
, function (er
, stat
) {
20 t
.ifError(er
, 'should exist');
21 t
.ok(stat
&& stat
.isDirectory(), 'should be directory');
22 t
.equal(stat
&& stat
.mode
& 0777, mode
, 'should be 0744');
28 test('chmod', function (t
) {
30 mkdirp(file
, mode
, function (er
) {
31 t
.ifError(er
, 'should not error');
32 fs
.stat(file
, function (er
, stat
) {
33 t
.ifError(er
, 'should exist');
34 t
.ok(stat
&& stat
.isDirectory(), 'should be directory');