Initial commit
[yaffs-website] / node_modules / globule / node_modules / glob / test / mark.js
1 var test = require("tap").test
2 var glob = require('../')
3 process.chdir(__dirname)
4
5 test("mark, no / on pattern", function (t) {
6   glob("a/*", {mark: true}, function (er, results) {
7     if (er)
8       throw er
9     var expect = [ 'a/abcdef/',
10                    'a/abcfed/',
11                    'a/b/',
12                    'a/bc/',
13                    'a/c/',
14                    'a/cb/' ]
15
16     if (process.platform !== "win32")
17       expect.push('a/symlink/')
18
19     t.same(results, expect)
20     t.end()
21   })
22 })
23
24 test("mark=false, no / on pattern", function (t) {
25   glob("a/*", function (er, results) {
26     if (er)
27       throw er
28     var expect = [ 'a/abcdef',
29                    'a/abcfed',
30                    'a/b',
31                    'a/bc',
32                    'a/c',
33                    'a/cb' ]
34
35     if (process.platform !== "win32")
36       expect.push('a/symlink')
37     t.same(results, expect)
38     t.end()
39   })
40 })
41
42 test("mark=true, / on pattern", function (t) {
43   glob("a/*/", {mark: true}, function (er, results) {
44     if (er)
45       throw er
46     var expect = [ 'a/abcdef/',
47                     'a/abcfed/',
48                     'a/b/',
49                     'a/bc/',
50                     'a/c/',
51                     'a/cb/' ]
52     if (process.platform !== "win32")
53       expect.push('a/symlink/')
54     t.same(results, expect)
55     t.end()
56   })
57 })
58
59 test("mark=false, / on pattern", function (t) {
60   glob("a/*/", function (er, results) {
61     if (er)
62       throw er
63     var expect = [ 'a/abcdef/',
64                    'a/abcfed/',
65                    'a/b/',
66                    'a/bc/',
67                    'a/c/',
68                    'a/cb/' ]
69     if (process.platform !== "win32")
70       expect.push('a/symlink/')
71     t.same(results, expect)
72     t.end()
73   })
74 })