var mkdirp=require("../"),path=require("path"),fs=require("fs"),exists=fs.exists||path.exists,test=require("tap").test,_0777=parseInt("0777",8),_0755=parseInt("0755",8);test("async perm",function(t){t.plan(5);var r="/tmp/"+(Math.random()*(1<<30)).toString(16);mkdirp(r,_0755,function(e){t.ifError(e),exists(r,function(e){t.ok(e,"file created"),fs.stat(r,function(r,e){t.ifError(r),t.equal(e.mode&_0777,_0755),t.ok(e.isDirectory(),"target not a directory")})})})}),test("async root perm",function(t){mkdirp("/tmp",_0755,function(r){r&&t.fail(r),t.end()}),t.end()});