corrade-nucleus-nucleons – Blame information for rev 20

Subversion Repositories:
Rev:
Rev Author Line No. Line
20 office 1 var mkdirp = require('../').mkdirp;
2 var path = require('path');
3 var fs = require('fs');
4 var test = require('tap').test;
5 var _0777 = parseInt('0777', 8);
6 var _0755 = parseInt('0755', 8);
7 var _0744 = parseInt('0744', 8);
8  
9 var ps = [ '', 'tmp' ];
10  
11 for (var i = 0; i < 25; i++) {
12 var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16);
13 ps.push(dir);
14 }
15  
16 var file = ps.join('/');
17  
18 test('chmod-pre', function (t) {
19 var mode = _0744
20 mkdirp(file, mode, function (er) {
21 t.ifError(er, 'should not error');
22 fs.stat(file, function (er, stat) {
23 t.ifError(er, 'should exist');
24 t.ok(stat && stat.isDirectory(), 'should be directory');
25 t.equal(stat && stat.mode & _0777, mode, 'should be 0744');
26 t.end();
27 });
28 });
29 });
30  
31 test('chmod', function (t) {
32 var mode = _0755
33 mkdirp(file, mode, function (er) {
34 t.ifError(er, 'should not error');
35 fs.stat(file, function (er, stat) {
36 t.ifError(er, 'should exist');
37 t.ok(stat && stat.isDirectory(), 'should be directory');
38 t.end();
39 });
40 });
41 });