]>
git.r.bdr.sh - rbdr/dotfiles/blob - atom/packages/ex-mode/node_modules/fs-plus/node_modules/mkdirp/test/clobber.js
0eb709987002f0c718e3a439f4cae8fc091e5ecc
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('/');
16 var itw
= ps
.slice(0, 3).join('/');
19 test('clobber-pre', function (t
) {
20 console
.error("about to write to "+itw
)
21 fs
.writeFileSync(itw
, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.');
23 fs
.stat(itw
, function (er
, stat
) {
25 t
.ok(stat
&& stat
.isFile(), 'should be file')
30 test('clobber', function (t
) {
32 mkdirp(file
, 0755, function (err
) {
34 t
.equal(err
.code
, 'ENOTDIR');