blob: 14a7edb09aa6398dad5ba436322fd2472c506856 (
plain)
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
module FindDirSpecs
def self.mock_dir(dirs = ['find_specs_mock'])
@mock_dir ||= tmp("")
File.join @mock_dir, dirs
end
# The names of the fixture directories and files used by
# various Find specs.
def self.mock_dir_files
unless @mock_dir_files
@mock_dir_files = %w[
.dotfile
.dotsubdir/.dotfile
.dotsubdir/nondotfile
deeply/.dotfile
deeply/nested/.dotfile.ext
deeply/nested/directory/structure/.ext
deeply/nested/directory/structure/bar
deeply/nested/directory/structure/baz
deeply/nested/directory/structure/file_one
deeply/nested/directory/structure/file_one.ext
deeply/nested/directory/structure/foo
deeply/nondotfile
file_one.ext
file_two.ext
dir_filename_ordering
dir/filename_ordering
nondotfile
subdir_one/.dotfile
subdir_one/nondotfile
subdir_two/nondotfile
subdir_two/nondotfile.ext
brace/a
brace/a.js
brace/a.erb
brace/a.js.rjs
brace/a.html.erb
special/+
special/^
special/$
special/(
special/)
special/[
special/]
special/{
special/}
special/test{1}/file[1]
]
platform_is_not :windows do
@mock_dir_files += %w[
special/*
special/?
special/|
]
end
end
@mock_dir_files
end
def self.create_mock_dirs
umask = File.umask 0
mock_dir_files.each do |name|
file = File.join mock_dir, name
mkdir_p File.dirname(file)
touch file
end
File.umask umask
end
def self.delete_mock_dirs
rm_r mock_dir
end
def self.expected_paths
unless @expected_paths
@expected_paths = %w[
.dotfile
.dotsubdir
.dotsubdir/.dotfile
.dotsubdir/nondotfile
deeply
deeply/.dotfile
deeply/nested
deeply/nested/.dotfile.ext
deeply/nested/directory
deeply/nested/directory/structure
deeply/nested/directory/structure/.ext
deeply/nested/directory/structure/bar
deeply/nested/directory/structure/baz
deeply/nested/directory/structure/file_one
deeply/nested/directory/structure/file_one.ext
deeply/nested/directory/structure/foo
deeply/nondotfile
file_one.ext
file_two.ext
dir_filename_ordering
dir
dir/filename_ordering
nondotfile
subdir_one
subdir_one/.dotfile
subdir_one/nondotfile
subdir_two
subdir_two/nondotfile
subdir_two/nondotfile.ext
brace
brace/a
brace/a.js
brace/a.erb
brace/a.js.rjs
brace/a.html.erb
special
special/+
special/^
special/$
special/(
special/)
special/[
special/]
special/{
special/}
special/test{1}
special/test{1}/file[1]
]
platform_is_not :windows do
@expected_paths += %w[
special/*
special/?
special/|
]
end
@expected_paths.map! do |file|
File.join(mock_dir, file)
end
@expected_paths << mock_dir
@expected_paths.sort!
end
@expected_paths
end
end
|