<commit_before>var mkdirp = require('../')
var path = require('path')
var fs = require('fs')
var exists = fs.exists || path.exists
var test = require('tap').test

test('async perm', function (t) {
  t.plan(5)
  var file = '/tmp/' + (Math.random() * (1<<30)).toString(16)
  
  mkdirp(file, 0755, function (err) {
    t.ifError(err)
    exists(file, function (ex) {
      t.ok(ex, 'file created')
      fs.stat(file, function (err, stat) {
        t.ifError(err)
        t.equal(stat.mode & 0777, 0755)
        t.ok(stat.isDirectory(), 'target not a directory')
      })
    })
  })
})

test('async root perm', function (t) {
  mkdirp('/tmp', 0755, function (err) {
    if (err) t.fail(err)
    t.end()
  })
  t.end()
})<commit_msg>test/mkdirp/perm.test: converted from tap to assert<commit_after>var assert = require('assert')
var fs = require('fs')
var path = require('path')
var fse = require('../../')
var testutil = require('testutil')

describe('mkdirp / perm', function() {
  var TEST_DIR

  before(function() {
    TEST_DIR = testutil.createTestDir('fs-extra')
  })

  afterEach(function(done) {
    fse.remove(TEST_DIR, done)
  })

  it('async perm', function (done) {
    var file = path.join(TEST_DIR, (Math.random() * (1<<30)).toString(16))
    
    fse.mkdirp(file, 0755, function (err) {
      assert.ifError(err)
      fs.exists(file, function (ex) {
        assert.ok(ex, 'file created')
        fs.stat(file, function (err, stat) {
          assert.ifError(err)
          assert.equal(stat.mode & 0777, 0755)
          assert.ok(stat.isDirectory(), 'target not a directory')
          done()
        })
      })
    })
  })

  it('async root perm', function (done) {
    fse.mkdirp('/tmp', 0755, function (err) {
      assert.ifError(err)
      done()
    })
  })
})
{'fraction_non_alphanumeric': 0.18192026951151039, 'fraction_numerical': 0.024143739472206625, 'mean_word_length': 2.7754237288135593, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '629571', 'n_tokens_mistral': 665, 'n_tokens_neox': 624, 'n_words': 140}