81c7f28b031eb6df51a2f06bbd18c44e3c91b98b.svn-base
1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
var exists = require('./')
var t = require('tap')
var touch = require('touch')
var rimraf = require('rimraf')
t.test('setup', function (t) {
touch.sync('one')
touch.sync('two')
touch.sync('three')
touch.sync('four')
t.end()
})
t.test('existing file same way', function (t) {
t.plan(4)
t.ok(exists.sync('one'))
t.ok(exists.sync('one'))
exists('two', function (e) {
t.ok(e)
exists('two', t.ok)
})
})
t.test('existing file different ways', function (t) {
t.plan(4)
t.ok(exists.sync('three'))
t.ok(exists.sync('four'))
exists('three', function (e) {
t.ok(e)
exists('four', t.ok)
})
})
t.test('non-existing file same way', function (t) {
t.plan(4)
t.notOk(exists.sync('one-no'))
t.notOk(exists.sync('one-no'))
exists('two-no', function (e) {
t.notOk(e)
exists('two-no', t.notOk)
})
})
t.test('non-existing file different ways', function (t) {
t.plan(4)
t.notOk(exists.sync('three-no'))
t.notOk(exists.sync('four-no'))
exists('three-no', function (e) {
t.notOk(e)
exists('four-no', t.notOk)
})
})
t.test('cleanup', function (t) {
rimraf.sync('one')
rimraf.sync('two')
rimraf.sync('three')
rimraf.sync('four')
t.end()
})