recls-ruby 2.11.0 → 2.11.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE +27 -24
- data/README.md +242 -1
- data/examples/find_files_and_directories.md +33 -30
- data/examples/find_files_and_directories.recursive.md +255 -254
- data/examples/show_hidden_files.md +4 -1
- data/examples/show_hidden_files.rb +1 -1
- data/examples/show_readonly_files.md +4 -1
- data/examples/show_readonly_files.rb +1 -1
- data/lib/recls/api.rb +75 -73
- data/lib/recls/combine_paths_1.rb +25 -23
- data/lib/recls/combine_paths_2plus.rb +31 -29
- data/lib/recls/entry.rb +276 -273
- data/lib/recls/file_search.rb +195 -193
- data/lib/recls/flags.rb +46 -45
- data/lib/recls/foreach.rb +103 -98
- data/lib/recls/obsolete.rb +80 -79
- data/lib/recls/recls.rb +16 -15
- data/lib/recls/stat.rb +136 -134
- data/lib/recls/util.rb +94 -92
- data/lib/recls/version.rb +17 -17
- data/lib/recls/ximpl/os.rb +45 -43
- data/lib/recls/ximpl/unix.rb +38 -35
- data/lib/recls/ximpl/util.rb +597 -596
- data/lib/recls/ximpl/windows.rb +139 -136
- data/lib/recls.rb +10 -9
- data/test/scratch/test_display_parts.rb +33 -33
- data/test/scratch/test_entry.rb +6 -6
- data/test/scratch/test_files_and_directories.rb +8 -8
- data/test/scratch/test_foreach.rb +10 -10
- data/test/scratch/test_module_function.rb +33 -33
- data/test/scratch/test_pattern_arrays.rb +5 -5
- data/test/scratch/test_show_dev_and_ino.rb +1 -1
- data/test/scratch/test_show_hidden.rb +3 -3
- data/test/unit/tc_recls_entries.rb +31 -31
- data/test/unit/tc_recls_entry.rb +19 -19
- data/test/unit/tc_recls_file_search.rb +32 -32
- data/test/unit/tc_recls_module.rb +25 -25
- data/test/unit/tc_recls_util.rb +161 -161
- data/test/unit/tc_recls_ximpl_util.rb +676 -676
- data/test/unit/test_all_separately.sh +1 -1
- data/test/unit/ts_all.rb +4 -4
- metadata +6 -6
@@ -4,954 +4,954 @@
|
|
4
4
|
|
5
5
|
$:.unshift File.join(File.dirname(__FILE__), '../..', 'lib')
|
6
6
|
|
7
|
-
|
8
7
|
require 'recls'
|
9
8
|
|
10
9
|
require 'test/unit'
|
11
10
|
|
11
|
+
|
12
12
|
class Test_Recls_Ximpl_Util_get_windows_root < Test::Unit::TestCase
|
13
13
|
|
14
|
-
|
14
|
+
def test_nil
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
wr, rem = Recls::Ximpl::Util.get_windows_root(nil)
|
17
|
+
assert_nil(wr)
|
18
|
+
assert_nil(rem)
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_empty
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
wr, rem = Recls::Ximpl::Util.get_windows_root('')
|
25
|
+
assert_nil(wr)
|
26
|
+
assert_equal('', rem)
|
27
27
|
|
28
|
-
|
28
|
+
end
|
29
29
|
|
30
|
-
|
30
|
+
def test_dots_directories
|
31
31
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
wr, rem = Recls::Ximpl::Util.get_windows_root('.')
|
33
|
+
assert_nil(wr)
|
34
|
+
assert_not_nil(rem)
|
35
|
+
assert_equal('.', rem)
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
wr, rem = Recls::Ximpl::Util.get_windows_root('..')
|
38
|
+
assert_nil(wr)
|
39
|
+
assert_not_nil(rem)
|
40
|
+
assert_equal('..', rem)
|
41
41
|
|
42
|
-
|
42
|
+
end
|
43
43
|
|
44
|
-
|
44
|
+
def test_relative_paths
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
46
|
+
wr, rem = Recls::Ximpl::Util.get_windows_root('a')
|
47
|
+
assert_nil(wr)
|
48
|
+
assert_not_nil(rem)
|
49
|
+
assert_equal('a', rem)
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
wr, rem = Recls::Ximpl::Util.get_windows_root('dir1')
|
52
|
+
assert_nil(wr)
|
53
|
+
assert_not_nil(rem)
|
54
|
+
assert_equal('dir1', rem)
|
55
55
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
56
|
+
wr, rem = Recls::Ximpl::Util.get_windows_root('dir1/dir2')
|
57
|
+
assert_nil(wr)
|
58
|
+
assert_not_nil(rem)
|
59
|
+
assert_equal('dir1/dir2', rem)
|
60
60
|
|
61
|
-
|
61
|
+
end
|
62
62
|
|
63
|
-
|
63
|
+
def test_windows_paths
|
64
64
|
|
65
|
-
|
65
|
+
if Recls::Ximpl::OS::OS_IS_WINDOWS
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
67
|
+
# drive only
|
68
|
+
wr, rem = Recls::Ximpl::Util.get_windows_root('H:')
|
69
|
+
assert_not_nil(wr)
|
70
|
+
assert_equal('H:', wr)
|
71
|
+
assert_not_nil(rem)
|
72
|
+
assert_equal('', rem)
|
73
73
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
74
|
+
# drive and root directory
|
75
|
+
wr, rem = Recls::Ximpl::Util.get_windows_root('H:\\')
|
76
|
+
assert_not_nil(wr)
|
77
|
+
assert_equal('H:', wr)
|
78
|
+
assert_not_nil(rem)
|
79
|
+
assert_equal('\\', rem)
|
80
80
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
81
|
+
# drive and rooted sub-directory
|
82
|
+
wr, rem = Recls::Ximpl::Util.get_windows_root('H:\\dir1')
|
83
|
+
assert_not_nil(wr)
|
84
|
+
assert_equal('H:', wr)
|
85
|
+
assert_not_nil(rem)
|
86
|
+
assert_equal('\\dir1', rem)
|
87
87
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
88
|
+
# drive and unrooted sub-directory
|
89
|
+
wr, rem = Recls::Ximpl::Util.get_windows_root('H:dir1')
|
90
|
+
assert_not_nil(wr)
|
91
|
+
assert_equal('H:', wr)
|
92
|
+
assert_not_nil(rem)
|
93
|
+
assert_equal('dir1', rem)
|
94
94
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
95
|
+
# UNC with server only
|
96
|
+
wr, rem = Recls::Ximpl::Util.get_windows_root('\\\\server')
|
97
|
+
assert_not_nil(wr)
|
98
|
+
assert_equal('\\\\server', wr)
|
99
|
+
assert_nil(rem)
|
100
100
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
101
|
+
# UNC with server and slash
|
102
|
+
wr, rem = Recls::Ximpl::Util.get_windows_root('\\\\server\\')
|
103
|
+
assert_not_nil(wr)
|
104
|
+
assert_equal('\\\\server\\', wr)
|
105
|
+
assert_nil(rem)
|
106
106
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
107
|
+
# UNC with server and drive only
|
108
|
+
wr, rem = Recls::Ximpl::Util.get_windows_root('\\\\server\\share')
|
109
|
+
assert_not_nil(wr)
|
110
|
+
assert_equal('\\\\server\\share', wr)
|
111
|
+
assert_nil(rem)
|
112
112
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
113
|
+
# UNC full drive with root directory
|
114
|
+
wr, rem = Recls::Ximpl::Util.get_windows_root('\\\\server\\share\\')
|
115
|
+
assert_not_nil(wr)
|
116
|
+
assert_equal('\\\\server\\share', wr)
|
117
|
+
assert_equal('\\', rem)
|
118
118
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
119
|
+
wr, rem = Recls::Ximpl::Util.get_windows_root('\\\\server\\share/')
|
120
|
+
assert_not_nil(wr)
|
121
|
+
assert_equal('\\\\server\\share', wr)
|
122
|
+
assert_equal('/', rem)
|
123
|
+
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
127
127
|
|
128
128
|
end
|
129
129
|
|
130
130
|
class Test_Recls_Ximpl_Util_split_path < Test::Unit::TestCase
|
131
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
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
132
|
+
def test_nil
|
133
|
+
|
134
|
+
wr, dir, bn, no, ex = Recls::Ximpl::Util::split_path(nil)
|
135
|
+
assert_nil(wr)
|
136
|
+
assert_nil(dir)
|
137
|
+
assert_nil(bn)
|
138
|
+
assert_nil(no)
|
139
|
+
assert_nil(ex)
|
140
|
+
|
141
|
+
end
|
142
|
+
|
143
|
+
def test_empty
|
144
|
+
|
145
|
+
wr, dir, bn, no, ex = Recls::Ximpl::Util::split_path('')
|
146
|
+
assert_nil(wr)
|
147
|
+
assert_nil(dir)
|
148
|
+
assert_nil(bn)
|
149
|
+
assert_nil(no)
|
150
|
+
assert_nil(ex)
|
151
|
+
|
152
|
+
end
|
153
|
+
|
154
|
+
def test_name_only
|
155
|
+
|
156
|
+
wr, dir, bn, no, ex = Recls::Ximpl::Util::split_path('a')
|
157
|
+
assert_nil(wr)
|
158
|
+
assert_nil(dir)
|
159
|
+
assert_equal('a', bn)
|
160
|
+
assert_equal('a', no)
|
161
|
+
assert_nil(ex)
|
162
|
+
|
163
|
+
wr, dir, bn, no, ex = Recls::Ximpl::Util::split_path('abc')
|
164
|
+
assert_nil(wr)
|
165
|
+
assert_nil(dir)
|
166
|
+
assert_equal('abc', bn)
|
167
|
+
assert_equal('abc', no)
|
168
|
+
assert_nil(ex)
|
169
|
+
|
170
|
+
wr, dir, bn, no, ex = Recls::Ximpl::Util::split_path('a_slightly-long_file-name')
|
171
|
+
assert_nil(wr)
|
172
|
+
assert_nil(dir)
|
173
|
+
assert_equal('a_slightly-long_file-name', bn)
|
174
|
+
assert_equal('a_slightly-long_file-name', no)
|
175
|
+
assert_nil(ex)
|
176
|
+
|
177
|
+
end
|
178
|
+
|
179
|
+
def test_name_and_extensions
|
180
|
+
|
181
|
+
wr, dir, bn, no, ex = Recls::Ximpl::Util::split_path('a.b')
|
182
|
+
assert_nil(wr)
|
183
|
+
assert_nil(dir)
|
184
|
+
assert_equal('a.b', bn)
|
185
|
+
assert_equal('a', no)
|
186
|
+
assert_equal('.b', ex)
|
187
|
+
|
188
|
+
wr, dir, bn, no, ex = Recls::Ximpl::Util::split_path('a.b.c')
|
189
|
+
assert_nil(wr)
|
190
|
+
assert_nil(dir)
|
191
|
+
assert_equal('a.b.c', bn)
|
192
|
+
assert_equal('a.b', no)
|
193
|
+
assert_equal('.c', ex)
|
194
|
+
|
195
|
+
end
|
196
|
+
|
197
|
+
def test_directory_only
|
198
|
+
|
199
|
+
wr, dir, bn, no, ex = Recls::Ximpl::Util::split_path('a.b/')
|
200
|
+
assert_nil(wr)
|
201
|
+
assert_equal('a.b/', dir)
|
202
|
+
assert_nil(bn)
|
203
|
+
assert_nil(no)
|
204
|
+
assert_nil(ex)
|
205
|
+
|
206
|
+
wr, dir, bn, no, ex = Recls::Ximpl::Util::split_path('a.b.c/')
|
207
|
+
assert_nil(wr)
|
208
|
+
assert_equal('a.b.c/', dir)
|
209
|
+
assert_nil(bn)
|
210
|
+
assert_nil(no)
|
211
|
+
assert_nil(ex)
|
212
|
+
|
213
|
+
wr, dir, bn, no, ex = Recls::Ximpl::Util::split_path('dir1/dir2/a.b/')
|
214
|
+
assert_nil(wr)
|
215
|
+
assert_equal('dir1/dir2/a.b/', dir)
|
216
|
+
assert_nil(bn)
|
217
|
+
assert_nil(no)
|
218
|
+
assert_nil(ex)
|
219
|
+
|
220
|
+
wr, dir, bn, no, ex = Recls::Ximpl::Util::split_path('/dir1/dir2/a.b/')
|
221
|
+
assert_nil(wr)
|
222
|
+
assert_equal('/dir1/dir2/a.b/', dir)
|
223
|
+
assert_nil(bn)
|
224
|
+
assert_nil(no)
|
225
|
+
assert_nil(ex)
|
226
|
+
|
227
|
+
wr, dir, bn, no, ex = Recls::Ximpl::Util::split_path('/')
|
228
|
+
assert_nil(wr)
|
229
|
+
assert_equal('/', dir)
|
230
|
+
assert_nil(bn)
|
231
|
+
assert_nil(no)
|
232
|
+
assert_nil(ex)
|
233
|
+
|
234
|
+
end
|
235
|
+
|
236
|
+
def test_directory_and_name_only
|
237
|
+
|
238
|
+
wr, dir, bn, no, ex = Recls::Ximpl::Util::split_path('dir1/dir2/file3')
|
239
|
+
assert_nil(wr)
|
240
|
+
assert_equal('dir1/dir2/', dir)
|
241
|
+
assert_equal('file3', bn)
|
242
|
+
assert_equal('file3', no)
|
243
|
+
assert_nil(ex)
|
244
|
+
|
245
|
+
wr, dir, bn, no, ex = Recls::Ximpl::Util::split_path('/dir1/dir2/file3')
|
246
|
+
assert_nil(wr)
|
247
|
+
assert_equal('/dir1/dir2/', dir)
|
248
|
+
assert_equal('file3', bn)
|
249
|
+
assert_equal('file3', no)
|
250
|
+
assert_nil(ex)
|
251
|
+
|
252
|
+
wr, dir, bn, no, ex = Recls::Ximpl::Util::split_path('/dir.1/dir.2/file.3')
|
253
|
+
assert_nil(wr)
|
254
|
+
assert_equal('/dir.1/dir.2/', dir)
|
255
|
+
assert_equal('file.3', bn)
|
256
|
+
assert_equal('file', no)
|
257
|
+
assert_equal('.3', ex)
|
258
|
+
|
259
|
+
end
|
260
|
+
|
261
|
+
if Recls::Ximpl::OS::OS_IS_WINDOWS
|
262
|
+
|
263
|
+
def test_Windows_root
|
264
|
+
|
265
|
+
wr, dir, bn, no, ex = Recls::Ximpl::Util::split_path('H:')
|
266
|
+
assert_equal('H:', wr)
|
267
|
+
assert_nil(dir)
|
268
|
+
assert_nil(bn)
|
269
|
+
assert_nil(no)
|
270
|
+
assert_nil(ex)
|
271
|
+
|
272
|
+
wr, dir, bn, no, ex = Recls::Ximpl::Util::split_path('H:\\')
|
273
|
+
assert_equal('H:', wr)
|
274
|
+
assert_equal('\\', dir)
|
275
|
+
assert_nil(bn)
|
276
|
+
assert_nil(no)
|
277
|
+
assert_nil(ex)
|
278
|
+
|
279
|
+
wr, dir, bn, no, ex = Recls::Ximpl::Util::split_path('H:/')
|
280
|
+
assert_equal('H:', wr)
|
281
|
+
assert_equal('/', dir)
|
282
|
+
assert_nil(bn)
|
283
|
+
assert_nil(no)
|
284
|
+
assert_nil(ex)
|
285
|
+
|
286
|
+
wr, dir, bn, no, ex = Recls::Ximpl::Util::split_path('H:/file.3')
|
287
|
+
assert_equal('H:', wr)
|
288
|
+
assert_equal('/', dir)
|
289
|
+
assert_equal('file.3', bn)
|
290
|
+
assert_equal('file', no)
|
291
|
+
assert_equal('.3', ex)
|
292
|
+
|
293
|
+
wr, dir, bn, no, ex = Recls::Ximpl::Util::split_path('H:file.3')
|
294
|
+
assert_equal('H:', wr)
|
295
|
+
assert_nil(dir)
|
296
|
+
assert_equal('file.3', bn)
|
297
|
+
assert_equal('file', no)
|
298
|
+
assert_equal('.3', ex)
|
299
|
+
|
300
|
+
wr, dir, bn, no, ex = Recls::Ximpl::Util::split_path('H:/dir.1\\dir.2/file.3')
|
301
|
+
assert_equal('H:', wr)
|
302
|
+
assert_equal('/dir.1\\dir.2/', dir)
|
303
|
+
assert_equal('file.3', bn)
|
304
|
+
assert_equal('file', no)
|
305
|
+
assert_equal('.3', ex)
|
306
|
+
|
307
|
+
wr, dir, bn, no, ex = Recls::Ximpl::Util::split_path('H:/dir.1\\dir.2/file.')
|
308
|
+
assert_equal('H:', wr)
|
309
|
+
assert_equal('/dir.1\\dir.2/', dir)
|
310
|
+
assert_equal('file.', bn)
|
311
|
+
assert_equal('file', no)
|
312
|
+
assert_equal('.', ex)
|
313
|
+
|
314
|
+
end
|
315
|
+
|
316
|
+
end
|
317
317
|
|
318
318
|
end
|
319
319
|
|
320
320
|
class Test_Recls_Ximpl_basename < Test::Unit::TestCase
|
321
321
|
|
322
|
-
|
322
|
+
def test_basename_with_paths_without_directories
|
323
323
|
|
324
|
-
|
325
|
-
|
326
|
-
|
324
|
+
assert_equal('a', Recls::Ximpl::basename('a'))
|
325
|
+
assert_equal('abc', Recls::Ximpl::basename('abc'))
|
326
|
+
assert_equal('abc.def', Recls::Ximpl::basename('abc.def'))
|
327
327
|
|
328
|
-
|
328
|
+
end # def test_basename_with_paths_without_directories
|
329
329
|
|
330
|
-
|
330
|
+
def test_basename_with_paths_with_only_directories
|
331
331
|
|
332
|
-
|
333
|
-
|
334
|
-
|
332
|
+
assert_equal('', Recls::Ximpl::basename('a/'))
|
333
|
+
assert_equal('', Recls::Ximpl::basename('abc/def/'))
|
334
|
+
assert_equal('', Recls::Ximpl::basename('dir.1/dir2./'))
|
335
335
|
|
336
|
-
|
336
|
+
if Recls::Ximpl::OS::OS_IS_WINDOWS
|
337
337
|
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
338
|
+
assert_equal('', Recls::Ximpl::basename('H:\\'))
|
339
|
+
assert_equal('', Recls::Ximpl::basename('H:/'))
|
340
|
+
assert_equal('', Recls::Ximpl::basename('H:\\dir1\\'))
|
341
|
+
assert_equal('', Recls::Ximpl::basename('H:/dir1/'))
|
342
342
|
|
343
|
-
|
344
|
-
|
343
|
+
assert_equal('', Recls::Ximpl::basename('\\\\server\\share\\dir1/dir2\\'))
|
344
|
+
assert_equal('', Recls::Ximpl::basename('\\\\server\\share/dir1\\dir2/'))
|
345
345
|
|
346
|
-
|
347
|
-
|
346
|
+
assert_equal('', Recls::Ximpl::basename('\\\\server\\share\\dir1/'))
|
347
|
+
assert_equal('', Recls::Ximpl::basename('\\\\server\\share/dir1\\'))
|
348
348
|
|
349
|
-
|
350
|
-
|
349
|
+
assert_equal('', Recls::Ximpl::basename('\\\\server\\share\\'))
|
350
|
+
assert_equal('', Recls::Ximpl::basename('\\\\server\\share/'))
|
351
351
|
|
352
|
-
|
353
|
-
|
352
|
+
assert_equal('', Recls::Ximpl::basename('\\\\server\\share'))
|
353
|
+
assert_equal('', Recls::Ximpl::basename('\\\\server\\share'))
|
354
354
|
|
355
|
-
|
356
|
-
|
355
|
+
assert_equal('', Recls::Ximpl::basename('\\\\server\\'))
|
356
|
+
assert_equal('', Recls::Ximpl::basename('\\\\server\\'))
|
357
357
|
|
358
|
-
|
359
|
-
|
358
|
+
assert_equal('', Recls::Ximpl::basename('\\\\server'))
|
359
|
+
assert_equal('', Recls::Ximpl::basename('\\\\server'))
|
360
360
|
|
361
|
-
|
361
|
+
end
|
362
362
|
|
363
|
-
|
363
|
+
end # def test_basename_with_paths_with_only_directories
|
364
364
|
|
365
|
-
|
365
|
+
def test_basename_with_paths_with_directories
|
366
366
|
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
367
|
+
assert_equal('file2', Recls::Ximpl::basename('dir1/file2'))
|
368
|
+
assert_equal('file.2', Recls::Ximpl::basename('dir.1/file.2'))
|
369
|
+
assert_equal('b.c', Recls::Ximpl::basename('a/b.c'))
|
370
|
+
assert_equal('ghi.jkl', Recls::Ximpl::basename('abc/def/ghi.jkl'))
|
371
|
+
assert_equal('file3.', Recls::Ximpl::basename('dir.1/dir2./file3.'))
|
372
372
|
|
373
|
-
|
373
|
+
if Recls::Ximpl::OS::OS_IS_WINDOWS
|
374
374
|
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
375
|
+
assert_equal('file1', Recls::Ximpl::basename('H:\\file1'))
|
376
|
+
assert_equal('file1', Recls::Ximpl::basename('H:/file1'))
|
377
|
+
assert_equal('file1', Recls::Ximpl::basename('H:\\dir1\\file1'))
|
378
|
+
assert_equal('file1', Recls::Ximpl::basename('H:/dir1/file1'))
|
379
379
|
|
380
|
-
|
381
|
-
|
380
|
+
assert_equal('file1', Recls::Ximpl::basename('\\\\server\\share\\dir1/dir2\\file1'))
|
381
|
+
assert_equal('file1', Recls::Ximpl::basename('\\\\server\\share/dir1\\dir2/file1'))
|
382
382
|
|
383
|
-
|
384
|
-
|
383
|
+
assert_equal('file1', Recls::Ximpl::basename('\\\\server\\share\\dir1/file1'))
|
384
|
+
assert_equal('file1', Recls::Ximpl::basename('\\\\server\\share/dir1\\file1'))
|
385
385
|
|
386
|
-
|
387
|
-
|
386
|
+
assert_equal('file1', Recls::Ximpl::basename('\\\\server\\share\\file1'))
|
387
|
+
assert_equal('file1', Recls::Ximpl::basename('\\\\server\\share/file1'))
|
388
388
|
|
389
|
-
|
389
|
+
end
|
390
390
|
|
391
|
-
|
391
|
+
end # def test_basename_with_paths_with_directories
|
392
392
|
|
393
393
|
end
|
394
394
|
|
395
395
|
class Test_Recls_Ximpl_file_ext < Test::Unit::TestCase
|
396
396
|
|
397
|
-
|
397
|
+
def test_paths_without_files
|
398
398
|
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
399
|
+
assert_equal('', Recls::Ximpl::file_ext(''))
|
400
|
+
assert_equal('', Recls::Ximpl::file_ext('/'))
|
401
|
+
assert_equal('', Recls::Ximpl::file_ext('/dir1/'))
|
402
|
+
assert_equal('', Recls::Ximpl::file_ext('/dir.1/'))
|
403
|
+
assert_equal('', Recls::Ximpl::file_ext('/dir1/dir2/'))
|
404
|
+
assert_equal('', Recls::Ximpl::file_ext('/dir.1/dir2/'))
|
405
405
|
|
406
|
-
|
406
|
+
if Recls::Ximpl::OS::OS_IS_WINDOWS
|
407
407
|
|
408
|
-
|
409
|
-
|
410
|
-
|
408
|
+
assert_equal('', Recls::Ximpl::file_ext('H:'))
|
409
|
+
assert_equal('', Recls::Ximpl::file_ext('H:/'))
|
410
|
+
assert_equal('', Recls::Ximpl::file_ext('H:\\'))
|
411
411
|
|
412
|
-
|
413
|
-
|
412
|
+
assert_equal('', Recls::Ximpl::file_ext('\\\\server\\share\\dir1/dir2\\'))
|
413
|
+
assert_equal('', Recls::Ximpl::file_ext('\\\\server\\share/dir1\\dir2/'))
|
414
414
|
|
415
|
-
|
415
|
+
end
|
416
416
|
|
417
|
-
|
417
|
+
end
|
418
418
|
|
419
|
-
|
419
|
+
def test_paths_with_files_but_no_extensions
|
420
420
|
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
421
|
+
assert_equal('', Recls::Ximpl::file_ext('file3'))
|
422
|
+
assert_equal('', Recls::Ximpl::file_ext('/file3'))
|
423
|
+
assert_equal('', Recls::Ximpl::file_ext('/dir1/file3'))
|
424
|
+
assert_equal('', Recls::Ximpl::file_ext('/dir.1/file3'))
|
425
|
+
assert_equal('', Recls::Ximpl::file_ext('/dir1/dir2/file3'))
|
426
|
+
assert_equal('', Recls::Ximpl::file_ext('/dir.1/dir2/file3'))
|
427
427
|
|
428
|
-
|
428
|
+
if Recls::Ximpl::OS::OS_IS_WINDOWS
|
429
429
|
|
430
|
-
|
431
|
-
|
432
|
-
|
430
|
+
assert_equal('', Recls::Ximpl::file_ext('H:file3'))
|
431
|
+
assert_equal('', Recls::Ximpl::file_ext('H:/file3'))
|
432
|
+
assert_equal('', Recls::Ximpl::file_ext('H:\\file3'))
|
433
433
|
|
434
|
-
|
435
|
-
|
434
|
+
assert_equal('', Recls::Ximpl::file_ext('\\\\server\\share\\dir1/dir2\\file3'))
|
435
|
+
assert_equal('', Recls::Ximpl::file_ext('\\\\server\\share/dir1\\dir2/file3'))
|
436
436
|
|
437
|
-
|
437
|
+
end
|
438
438
|
|
439
|
-
|
439
|
+
end
|
440
440
|
|
441
|
-
|
441
|
+
def test_paths_with_files_with_extensions
|
442
442
|
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
443
|
+
assert_equal('.ext', Recls::Ximpl::file_ext('file3.ext'))
|
444
|
+
assert_equal('.ext', Recls::Ximpl::file_ext('/file3.ext'))
|
445
|
+
assert_equal('.ext', Recls::Ximpl::file_ext('/dir1/file3.ext'))
|
446
|
+
assert_equal('.ext', Recls::Ximpl::file_ext('/dir.1/file3.ext'))
|
447
|
+
assert_equal('.ext', Recls::Ximpl::file_ext('/dir1/dir2/file3.ext'))
|
448
|
+
assert_equal('.ext', Recls::Ximpl::file_ext('/dir.1/dir2/file3.ext'))
|
449
449
|
|
450
|
-
|
450
|
+
if Recls::Ximpl::OS::OS_IS_WINDOWS
|
451
451
|
|
452
|
-
|
453
|
-
|
454
|
-
|
452
|
+
assert_equal('.ext', Recls::Ximpl::file_ext('H:file3.ext'))
|
453
|
+
assert_equal('.ext', Recls::Ximpl::file_ext('H:/file3.ext'))
|
454
|
+
assert_equal('.ext', Recls::Ximpl::file_ext('H:\\file3.ext'))
|
455
455
|
|
456
|
-
|
457
|
-
|
456
|
+
assert_equal('.ext', Recls::Ximpl::file_ext('\\\\server\\share\\dir1/dir2\\file3.ext'))
|
457
|
+
assert_equal('.ext', Recls::Ximpl::file_ext('\\\\server\\share/dir1\\dir2/file3.ext'))
|
458
458
|
|
459
|
-
|
459
|
+
end
|
460
460
|
|
461
|
-
|
461
|
+
end
|
462
462
|
|
463
463
|
end
|
464
464
|
|
465
465
|
class Test_Recls_Ximpl_directory_from_directory_path < Test::Unit::TestCase
|
466
466
|
|
467
|
-
|
467
|
+
def test_nil
|
468
468
|
|
469
|
-
|
469
|
+
assert_nil(Recls::Ximpl::directory_from_directory_path(nil))
|
470
470
|
|
471
|
-
|
471
|
+
end
|
472
472
|
|
473
|
-
|
473
|
+
def test_empty
|
474
474
|
|
475
|
-
|
475
|
+
assert_equal('', Recls::Ximpl::directory_from_directory_path(''))
|
476
476
|
|
477
|
-
|
477
|
+
end
|
478
478
|
|
479
|
-
|
479
|
+
def test_dots
|
480
480
|
|
481
|
-
|
481
|
+
assert_equal('.', Recls::Ximpl::directory_from_directory_path('.'))
|
482
482
|
|
483
|
-
|
483
|
+
end
|
484
484
|
|
485
|
-
|
485
|
+
def test_leaf_dir_only
|
486
486
|
|
487
|
-
|
488
|
-
|
489
|
-
|
487
|
+
assert_equal('dir', Recls::Ximpl::directory_from_directory_path('dir'))
|
488
|
+
assert_equal('dir.ext', Recls::Ximpl::directory_from_directory_path('dir.ext'))
|
489
|
+
assert_equal('dir.', Recls::Ximpl::directory_from_directory_path('dir.'))
|
490
490
|
|
491
|
-
|
491
|
+
end
|
492
492
|
|
493
|
-
|
493
|
+
def test_roots_only
|
494
494
|
|
495
|
-
|
495
|
+
assert_equal('/', Recls::Ximpl::directory_from_directory_path('/'))
|
496
496
|
|
497
|
-
|
497
|
+
if Recls::Ximpl::OS::OS_IS_WINDOWS
|
498
498
|
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
499
|
+
assert_equal('\\', Recls::Ximpl::directory_from_directory_path('H:\\'))
|
500
|
+
assert_equal('\\', Recls::Ximpl::directory_from_directory_path('\\\\server\\share\\'))
|
501
|
+
assert_equal('/', Recls::Ximpl::directory_from_directory_path('H:/'))
|
502
|
+
assert_equal('/', Recls::Ximpl::directory_from_directory_path('\\\\server\\share/'))
|
503
503
|
|
504
|
-
|
504
|
+
end
|
505
505
|
|
506
|
-
|
506
|
+
end
|
507
507
|
|
508
|
-
|
508
|
+
def test_rooted_paths
|
509
509
|
|
510
|
-
|
510
|
+
if Recls::Ximpl::OS::OS_IS_WINDOWS
|
511
511
|
|
512
|
-
|
513
|
-
|
512
|
+
assert_equal('\\dir.1\\dir.2', Recls::Ximpl::directory_from_directory_path('H:\\dir.1\\dir.2'))
|
513
|
+
assert_equal('\\dir.1\\dir.2\\', Recls::Ximpl::directory_from_directory_path('H:\\dir.1\\dir.2\\'))
|
514
514
|
|
515
|
-
|
515
|
+
end
|
516
516
|
|
517
|
-
|
517
|
+
end
|
518
518
|
|
519
519
|
end
|
520
520
|
|
521
521
|
class Test_Recls_Ximpl_canonicalise_path < Test::Unit::TestCase
|
522
522
|
|
523
|
-
|
523
|
+
def test_nil
|
524
524
|
|
525
|
-
|
525
|
+
assert_nil(Recls::Ximpl::canonicalise_path(nil))
|
526
526
|
|
527
|
-
|
527
|
+
end
|
528
528
|
|
529
|
-
|
529
|
+
def test_empty
|
530
530
|
|
531
|
-
|
531
|
+
assert_equal('', Recls::Ximpl::canonicalise_path(''))
|
532
532
|
|
533
|
-
|
533
|
+
end
|
534
534
|
|
535
|
-
|
535
|
+
def test_dots_directories
|
536
536
|
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
537
|
+
assert_equal('.', Recls::Ximpl::canonicalise_path('.'))
|
538
|
+
assert_equal('./', Recls::Ximpl::canonicalise_path('./'))
|
539
|
+
assert_equal('.', Recls::Ximpl::canonicalise_path('././.'))
|
540
|
+
assert_equal('./', Recls::Ximpl::canonicalise_path('./././'))
|
541
541
|
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
542
|
+
assert_equal('..', Recls::Ximpl::canonicalise_path('..'))
|
543
|
+
assert_equal('../', Recls::Ximpl::canonicalise_path('../'))
|
544
|
+
assert_equal('..', Recls::Ximpl::canonicalise_path('../.'))
|
545
|
+
assert_equal('../', Recls::Ximpl::canonicalise_path('.././'))
|
546
546
|
|
547
|
-
|
547
|
+
end
|
548
548
|
|
549
|
-
|
549
|
+
def test_files_only
|
550
550
|
|
551
|
-
|
552
|
-
|
553
|
-
|
551
|
+
assert_equal('a', Recls::Ximpl::canonicalise_path('a'))
|
552
|
+
assert_equal('file', Recls::Ximpl::canonicalise_path('file'))
|
553
|
+
assert_equal('file.ext', Recls::Ximpl::canonicalise_path('file.ext'))
|
554
554
|
|
555
|
-
|
555
|
+
end
|
556
556
|
|
557
|
-
|
557
|
+
def test_zero_parts
|
558
558
|
|
559
|
-
|
559
|
+
if Recls::Ximpl::OS::OS_IS_WINDOWS
|
560
560
|
|
561
|
-
|
561
|
+
assert_equal('H:', Recls::Ximpl::canonicalise_path('H:'))
|
562
562
|
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
563
|
+
assert_equal('\\\\server', Recls::Ximpl::canonicalise_path('\\\\server'))
|
564
|
+
assert_equal('\\\\server\\', Recls::Ximpl::canonicalise_path('\\\\server\\'))
|
565
|
+
assert_equal('\\\\server\\share', Recls::Ximpl::canonicalise_path('\\\\server\\share'))
|
566
|
+
assert_equal('\\\\server\\share/', Recls::Ximpl::canonicalise_path('\\\\server\\share/'))
|
567
567
|
|
568
|
-
|
568
|
+
end
|
569
569
|
|
570
|
-
|
570
|
+
end
|
571
571
|
|
572
|
-
|
572
|
+
def test_single_canonicalisation
|
573
573
|
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
574
|
+
assert_equal('dir.1/', Recls::Ximpl::canonicalise_path('dir.1/'))
|
575
|
+
assert_equal('dir.1/', Recls::Ximpl::canonicalise_path('dir.1/./'))
|
576
|
+
assert_equal('dir.1/', Recls::Ximpl::canonicalise_path('./dir.1/./'))
|
577
|
+
assert_equal('dir.1/', Recls::Ximpl::canonicalise_path('./dir.1/.'))
|
578
578
|
|
579
|
-
|
579
|
+
end
|
580
580
|
|
581
|
-
|
581
|
+
def test_double_canonicalisation
|
582
582
|
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
583
|
+
assert_equal('dir.1/dir.2/', Recls::Ximpl::canonicalise_path('dir.1/dir.2/'))
|
584
|
+
assert_equal('dir.1/dir.2/', Recls::Ximpl::canonicalise_path('dir.1/dir.2/dir.3/../'))
|
585
|
+
assert_equal('dir.1/dir.2/', Recls::Ximpl::canonicalise_path('dir.1/dir.2/dir.3/../'))
|
586
|
+
assert_equal('dir.1/dir.2/', Recls::Ximpl::canonicalise_path('dir.1/dir.3/../dir.2/'))
|
587
|
+
assert_equal('dir.1/dir.2/', Recls::Ximpl::canonicalise_path('dir.3/../dir.1/dir.2/'))
|
588
588
|
|
589
|
-
|
590
|
-
|
589
|
+
assert_equal('../dir.1/dir.2/', Recls::Ximpl::canonicalise_path('../dir.1/dir.2/'))
|
590
|
+
assert_equal('../dir.4/', Recls::Ximpl::canonicalise_path('../dir.1/../dir.4/'))
|
591
591
|
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
592
|
+
assert_equal('/dir.1/dir.2/', Recls::Ximpl::canonicalise_path('/dir.1/dir.2/'))
|
593
|
+
assert_equal('/dir.1/dir.2/', Recls::Ximpl::canonicalise_path('/dir.1/dir.2/dir.3/../'))
|
594
|
+
assert_equal('/dir.1/dir.2/', Recls::Ximpl::canonicalise_path('/dir.1/dir.2/dir.3/../'))
|
595
|
+
assert_equal('/dir.1/dir.2/', Recls::Ximpl::canonicalise_path('/dir.1/dir.3/../dir.2/'))
|
596
|
+
assert_equal('/dir.1/dir.2/', Recls::Ximpl::canonicalise_path('/dir.3/../dir.1/dir.2/'))
|
597
597
|
|
598
|
-
|
599
|
-
|
598
|
+
assert_equal('/dir.1/dir.2/', Recls::Ximpl::canonicalise_path('/../dir.1/dir.2/'))
|
599
|
+
assert_equal('/dir.4/', Recls::Ximpl::canonicalise_path('/../dir.1/../dir.4/'))
|
600
600
|
|
601
|
-
|
602
|
-
|
601
|
+
assert_equal('/dir.14/', Recls::Ximpl::canonicalise_path('/dir.14/dir.2/..'))
|
602
|
+
assert_equal('dir.14/', Recls::Ximpl::canonicalise_path('dir.14/dir.2/..'))
|
603
603
|
|
604
|
-
|
605
|
-
|
604
|
+
assert_equal('/', Recls::Ximpl::canonicalise_path('/dir.14/dir.2/../..'))
|
605
|
+
assert_equal('.', Recls::Ximpl::canonicalise_path('dir.14/dir.2/../..'))
|
606
606
|
|
607
|
-
|
607
|
+
if Recls::Ximpl::OS::OS_IS_WINDOWS
|
608
608
|
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
609
|
+
assert_equal('H:\\dir.1\\dir.2\\', Recls::Ximpl::canonicalise_path('H:\\dir.1\\dir.2\\'))
|
610
|
+
assert_equal('H:\\dir.1\\dir.2\\', Recls::Ximpl::canonicalise_path('H:\\dir.1\\dir.2\\dir.3\\..\\'))
|
611
|
+
assert_equal('H:\\dir.1\\dir.2\\', Recls::Ximpl::canonicalise_path('H:\\dir.1\\dir.2\\dir.3\\..\\'))
|
612
|
+
assert_equal('H:\\dir.1\\dir.2\\', Recls::Ximpl::canonicalise_path('H:\\dir.1\\dir.3\\..\\dir.2\\'))
|
613
|
+
assert_equal('H:\\dir.1\\dir.2\\', Recls::Ximpl::canonicalise_path('H:\\dir.3\\..\\dir.1\\dir.2\\'))
|
614
614
|
|
615
|
-
|
616
|
-
|
615
|
+
assert_equal('H:\\dir.43\\dir.5\\', Recls::Ximpl::canonicalise_path('H:\\..\\dir.43\\dir.5\\'))
|
616
|
+
assert_equal('H:\\dir.42\\', Recls::Ximpl::canonicalise_path('H:\\..\\dir.1\\..\\dir.42\\'))
|
617
617
|
|
618
|
-
|
618
|
+
end
|
619
619
|
|
620
|
-
|
620
|
+
end
|
621
621
|
|
622
|
-
|
622
|
+
def test_complex_examples
|
623
623
|
|
624
|
-
|
625
|
-
|
626
|
-
|
624
|
+
assert_equal('../dir.11/dir.22/dir.33/file3.', Recls::Ximpl::canonicalise_path('abc/.././././.././dir.1/../dir.11/dir.22/dir.33/file3.'))
|
625
|
+
assert_equal('/dir.11/dir.22/dir.33/file3.', Recls::Ximpl::canonicalise_path('/abc/.././././.././dir.1/../dir.11/dir.22/dir.33/file3.'))
|
626
|
+
assert_equal('../dir.11/dir.22/dir.33/file3.', Recls::Ximpl::canonicalise_path('./././abc/.././././.././dir.1/../dir.11/dir.22/././dir.33/././file3.'))
|
627
627
|
|
628
|
-
|
628
|
+
if Recls::Ximpl::OS::OS_IS_WINDOWS
|
629
629
|
|
630
|
-
|
630
|
+
end
|
631
631
|
|
632
|
-
|
632
|
+
end
|
633
633
|
|
634
634
|
end
|
635
635
|
|
636
636
|
class Test_Recls_Ximpl_absolute_path < Test::Unit::TestCase
|
637
637
|
|
638
|
-
|
638
|
+
attr_reader :cwd
|
639
639
|
|
640
|
-
|
640
|
+
def setup
|
641
641
|
|
642
|
-
|
642
|
+
@cwd = Dir.getwd
|
643
643
|
|
644
|
-
|
644
|
+
end
|
645
645
|
|
646
|
-
|
646
|
+
def test_nil
|
647
647
|
|
648
|
-
|
648
|
+
assert_nil(Recls::Ximpl::absolute_path(nil))
|
649
649
|
|
650
|
-
|
650
|
+
assert_nil(Recls::Ximpl::absolute_path(nil, cwd))
|
651
651
|
|
652
|
-
|
652
|
+
end
|
653
653
|
|
654
|
-
|
654
|
+
def test_empty_path
|
655
655
|
|
656
|
-
|
656
|
+
assert_equal('', Recls::Ximpl::absolute_path(''))
|
657
657
|
|
658
|
-
|
658
|
+
assert_equal('', Recls::Ximpl::absolute_path('', cwd))
|
659
659
|
|
660
|
-
|
660
|
+
end
|
661
661
|
|
662
|
-
|
662
|
+
def test_rooted_paths
|
663
663
|
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
664
|
+
assert_equal('/', Recls::Ximpl::absolute_path('/'))
|
665
|
+
assert_equal('/abc', Recls::Ximpl::absolute_path('/abc'))
|
666
|
+
assert_equal('/abc/def', Recls::Ximpl::absolute_path('/abc/def'))
|
667
|
+
assert_equal('/abc/def/', Recls::Ximpl::absolute_path('/abc/def/'))
|
668
|
+
assert_equal('/abc/def/file.ext', Recls::Ximpl::absolute_path('/abc/def/file.ext'))
|
669
669
|
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
670
|
+
assert_equal('/', Recls::Ximpl::absolute_path('/', cwd))
|
671
|
+
assert_equal('/abc', Recls::Ximpl::absolute_path('/abc', cwd))
|
672
|
+
assert_equal('/abc/def', Recls::Ximpl::absolute_path('/abc/def', cwd))
|
673
|
+
assert_equal('/abc/def/', Recls::Ximpl::absolute_path('/abc/def/', cwd))
|
674
|
+
assert_equal('/abc/def/file.ext', Recls::Ximpl::absolute_path('/abc/def/file.ext', cwd))
|
675
675
|
|
676
|
-
|
676
|
+
end
|
677
677
|
|
678
|
-
|
678
|
+
def test_single_dot
|
679
679
|
|
680
|
-
|
681
|
-
|
680
|
+
assert_equal("#{cwd}", Recls::Ximpl::absolute_path('.'))
|
681
|
+
assert_equal("#{cwd}/", Recls::Ximpl::absolute_path('./'))
|
682
682
|
|
683
|
-
|
684
|
-
|
683
|
+
assert_equal("/dir.1/dir.2", Recls::Ximpl::absolute_path('.', "/dir.1/dir.2"))
|
684
|
+
assert_equal("/dir.1/dir.2/", Recls::Ximpl::absolute_path('./', "/dir.1/dir.2"))
|
685
685
|
|
686
|
-
|
687
|
-
|
686
|
+
assert_equal("/dir.1/dir.2", Recls::Ximpl::absolute_path('.', "/dir.1/dir.2/"))
|
687
|
+
assert_equal("/dir.1/dir.2/", Recls::Ximpl::absolute_path('./', "/dir.1/dir.2/"))
|
688
688
|
|
689
|
-
|
689
|
+
end
|
690
690
|
|
691
|
-
|
691
|
+
def test_double_dots
|
692
692
|
|
693
|
-
|
694
|
-
|
693
|
+
assert_equal("/dir.13", Recls::Ximpl::absolute_path('..', "/dir.13/dir.2"))
|
694
|
+
assert_equal("/dir.13/", Recls::Ximpl::absolute_path('../', "/dir.13/dir.2"))
|
695
695
|
|
696
|
-
|
696
|
+
assert_equal("/dir.1/", Recls::Ximpl::absolute_path('../', "/dir.1/dir.2"))
|
697
697
|
|
698
|
-
|
698
|
+
end
|
699
699
|
end
|
700
700
|
|
701
701
|
class Test_Recls_Ximpl_derive_relative_path < Test::Unit::TestCase
|
702
702
|
|
703
|
-
|
703
|
+
attr_reader :cwd
|
704
704
|
|
705
|
-
|
705
|
+
def setup
|
706
706
|
|
707
|
-
|
707
|
+
@cwd = Dir.getwd
|
708
708
|
|
709
|
-
|
709
|
+
end
|
710
710
|
|
711
|
-
|
711
|
+
M = Recls::Ximpl
|
712
712
|
|
713
|
-
|
713
|
+
def test_libpath_cases_test_nils_and_empties
|
714
714
|
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
715
|
+
# to get nowhere from nowhere, go nowhere
|
716
|
+
assert_nil M.derive_relative_path(nil, nil)
|
717
|
+
assert_nil M.derive_relative_path('', nil)
|
718
|
+
assert_nil M.derive_relative_path('', '')
|
719
|
+
assert_nil M.derive_relative_path(nil, '')
|
720
720
|
|
721
|
-
|
722
|
-
|
723
|
-
|
721
|
+
# to get somewhere from nowhere, just go there
|
722
|
+
assert_equal 'abc', M.derive_relative_path(nil, 'abc')
|
723
|
+
assert_equal 'abc', M.derive_relative_path('', 'abc')
|
724
724
|
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
725
|
+
# to get nowhere from anywhere else, go nowhere
|
726
|
+
assert_nil M.derive_relative_path('dir', nil)
|
727
|
+
assert_nil M.derive_relative_path('dir', '')
|
728
|
+
end
|
729
729
|
|
730
|
-
|
730
|
+
def test_libpath_cases_test_same_location
|
731
731
|
|
732
|
-
|
733
|
-
|
734
|
-
|
732
|
+
assert_equal '.', M.derive_relative_path('abc', 'abc')
|
733
|
+
assert_equal './', M.derive_relative_path('abc/', 'abc/')
|
734
|
+
assert_equal './', M.derive_relative_path('abc', 'abc/')
|
735
735
|
|
736
|
-
|
736
|
+
assert_equal './', M.derive_relative_path('/', '/')
|
737
737
|
|
738
738
|
=begin
|
739
739
|
|
740
|
-
|
740
|
+
assert_equal '.', M.derive_relative_path('./abc', 'abc')
|
741
741
|
=end
|
742
|
-
|
742
|
+
assert_equal '.', M.derive_relative_path('./abc/', 'abc')
|
743
743
|
=begin
|
744
744
|
|
745
|
-
|
745
|
+
assert_equal './', M.derive_relative_path('./abc', 'abc/')
|
746
746
|
=end
|
747
|
-
|
748
|
-
|
747
|
+
assert_equal './', M.derive_relative_path('./abc/', 'abc/')
|
748
|
+
end
|
749
749
|
|
750
|
-
|
750
|
+
def test_libpath_cases_test_one_above
|
751
751
|
|
752
752
|
=begin
|
753
753
|
|
754
|
-
|
754
|
+
assert_equal '..', M.derive_relative_path('.', '..')
|
755
755
|
=end
|
756
|
-
|
756
|
+
end
|
757
757
|
|
758
|
-
|
758
|
+
def test_absolute_proper_subset
|
759
759
|
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
760
|
+
assert_equal('abc', Recls::Ximpl.derive_relative_path('/dir1/dir2', '/dir1/dir2/abc'))
|
761
|
+
assert_equal('abc', Recls::Ximpl.derive_relative_path('/dir1/dir2/', '/dir1/dir2/abc'))
|
762
|
+
assert_equal('abc/', Recls::Ximpl.derive_relative_path('/dir1/dir2', '/dir1/dir2/abc/'))
|
763
|
+
assert_equal('abc/', Recls::Ximpl.derive_relative_path('/dir1/dir2/', '/dir1/dir2/abc/'))
|
764
764
|
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
765
|
+
assert_equal('abc', Recls::Ximpl.derive_relative_path('dir1/dir2', 'dir1/dir2/abc'))
|
766
|
+
assert_equal('abc', Recls::Ximpl.derive_relative_path('dir1/dir2/', 'dir1/dir2/abc'))
|
767
|
+
assert_equal('abc/', Recls::Ximpl.derive_relative_path('dir1/dir2', 'dir1/dir2/abc/'))
|
768
|
+
assert_equal('abc/', Recls::Ximpl.derive_relative_path('dir1/dir2/', 'dir1/dir2/abc/'))
|
769
769
|
|
770
770
|
=begin
|
771
771
|
|
772
|
-
|
773
|
-
|
772
|
+
assert_equal('/dir/dir2/abc', Recls::Ximpl.derive_relative_path('/dir1/dir2/abc', 'dir1/dir2'))
|
773
|
+
assert_equal('/dir/dir2/abc', Recls::Ximpl.derive_relative_path('/dir1/dir2/abc', 'dir1/dir2/'))
|
774
774
|
=end
|
775
|
-
|
775
|
+
end
|
776
776
|
|
777
|
-
|
777
|
+
def test_absolute_proper_subset_2
|
778
778
|
|
779
|
-
|
780
|
-
|
779
|
+
assert_equal('c++', Recls::Ximpl.derive_relative_path('/dir1/dir2', '/dir1/dir2/c++'))
|
780
|
+
assert_equal('c++', Recls::Ximpl.derive_relative_path('/dir1/dir2/', '/dir1/dir2/c++'))
|
781
781
|
|
782
|
-
|
783
|
-
|
782
|
+
assert_equal('c++', Recls::Ximpl.derive_relative_path('dir1/dir2', 'dir1/dir2/c++'))
|
783
|
+
assert_equal('c++', Recls::Ximpl.derive_relative_path('dir1/dir2/', 'dir1/dir2/c++'))
|
784
784
|
|
785
|
-
|
785
|
+
end
|
786
786
|
|
787
|
-
|
787
|
+
def test_absolute_same_1
|
788
788
|
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
789
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('/dir1/dir2/abc', '/dir1/dir2/abc'))
|
790
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('/dir1/dir2/abc', '/dir1/dir2/abc/'))
|
791
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('/dir1/dir2/abc/', '/dir1/dir2/abc'))
|
792
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('/dir1/dir2/abc/', '/dir1/dir2/abc/'))
|
793
793
|
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
794
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('dir1/dir2/abc', 'dir1/dir2/abc'))
|
795
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('dir1/dir2/abc', 'dir1/dir2/abc/'))
|
796
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('dir1/dir2/abc/', 'dir1/dir2/abc'))
|
797
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('dir1/dir2/abc/', 'dir1/dir2/abc/'))
|
798
798
|
|
799
|
-
|
799
|
+
end
|
800
800
|
|
801
|
-
|
801
|
+
def test_absolute_same_2
|
802
802
|
|
803
|
-
|
804
|
-
|
803
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('/dir1', '/dir1'))
|
804
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('/dir1/', '/dir1'))
|
805
805
|
|
806
|
-
|
806
|
+
end
|
807
807
|
|
808
|
-
|
808
|
+
def test_absolute_same_3
|
809
809
|
|
810
|
-
|
810
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('/', '/'))
|
811
811
|
|
812
|
-
|
812
|
+
end
|
813
813
|
|
814
|
-
|
814
|
+
def test_different_sub_trees_1
|
815
815
|
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
816
|
+
assert_equal('../abc', Recls::Ximpl.derive_relative_path('/dir1/dir2/ref', '/dir1/dir2/abc'))
|
817
|
+
assert_equal('../abc/', Recls::Ximpl.derive_relative_path('/dir1/dir2/ref', '/dir1/dir2/abc/'))
|
818
|
+
assert_equal('../abc', Recls::Ximpl.derive_relative_path('/dir1/dir2/ref/', '/dir1/dir2/abc'))
|
819
|
+
assert_equal('../abc/', Recls::Ximpl.derive_relative_path('/dir1/dir2/ref/', '/dir1/dir2/abc/'))
|
820
820
|
|
821
|
-
|
821
|
+
end
|
822
822
|
|
823
|
-
|
823
|
+
def test_different_sub_trees_2
|
824
824
|
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
825
|
+
assert_equal('../abc', Recls::Ximpl.derive_relative_path('/ref', '/abc'))
|
826
|
+
assert_equal('../abc/', Recls::Ximpl.derive_relative_path('/ref', '/abc/'))
|
827
|
+
assert_equal('../abc', Recls::Ximpl.derive_relative_path('/ref/', '/abc'))
|
828
|
+
assert_equal('../abc/', Recls::Ximpl.derive_relative_path('/ref/', '/abc/'))
|
829
829
|
|
830
|
-
|
830
|
+
end
|
831
831
|
|
832
|
-
|
832
|
+
def test_different_sub_trees_3
|
833
833
|
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
834
|
+
assert_equal('../../dir3/abc', Recls::Ximpl.derive_relative_path('/dir1/dir2/ref', '/dir1/dir3/abc'))
|
835
|
+
assert_equal('../../dir3/abc/', Recls::Ximpl.derive_relative_path('/dir1/dir2/ref', '/dir1/dir3/abc/'))
|
836
|
+
assert_equal('../../dir3/abc', Recls::Ximpl.derive_relative_path('/dir1/dir2/ref/', '/dir1/dir3/abc'))
|
837
|
+
assert_equal('../../dir3/abc/', Recls::Ximpl.derive_relative_path('/dir1/dir2/ref/', '/dir1/dir3/abc/'))
|
838
838
|
|
839
|
-
|
839
|
+
end
|
840
840
|
|
841
|
-
|
841
|
+
def test_different_sub_trees_4
|
842
842
|
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
843
|
+
assert_equal('..', Recls::Ximpl.derive_relative_path('/dir1/dir2/ref', '/dir1/dir2'))
|
844
|
+
assert_equal('..', Recls::Ximpl.derive_relative_path('/dir1/dir2/ref/', '/dir1/dir2'))
|
845
|
+
assert_equal('..', Recls::Ximpl.derive_relative_path('/dir1/dir2/ref', '/dir1/dir2/'))
|
846
|
+
assert_equal('..', Recls::Ximpl.derive_relative_path('/dir1/dir2/ref/', '/dir1/dir2/'))
|
847
847
|
|
848
|
-
|
848
|
+
end
|
849
849
|
|
850
|
-
|
850
|
+
def test_different_sub_trees_5
|
851
851
|
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
852
|
+
assert_equal('../..', Recls::Ximpl.derive_relative_path('/dir1/dir2/dir3/dir4', '/dir1/dir2'))
|
853
|
+
assert_equal('../..', Recls::Ximpl.derive_relative_path('/dir1/dir2/dir3/dir4/', '/dir1/dir2'))
|
854
|
+
assert_equal('../..', Recls::Ximpl.derive_relative_path('/dir1/dir2/dir3/dir4', '/dir1/dir2/'))
|
855
|
+
assert_equal('../..', Recls::Ximpl.derive_relative_path('/dir1/dir2/dir3/dir4/', '/dir1/dir2/'))
|
856
856
|
|
857
|
-
|
857
|
+
end
|
858
858
|
|
859
|
-
|
859
|
+
def test_embedded_dots_1
|
860
860
|
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
861
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('./dir1/dir2', 'dir1/dir2'))
|
862
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('./dir1/dir2', 'dir1/dir2/'))
|
863
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('./dir1/dir2/', 'dir1/dir2'))
|
864
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('./dir1/dir2/', 'dir1/dir2/'))
|
865
865
|
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
866
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('./dir1/dir2', './dir1/dir2'))
|
867
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('./dir1/dir2', './dir1/dir2/'))
|
868
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('./dir1/dir2/', './dir1/dir2'))
|
869
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('./dir1/dir2/', './dir1/dir2/'))
|
870
870
|
|
871
|
-
|
871
|
+
end
|
872
872
|
|
873
|
-
|
873
|
+
def test_embedded_dots_2
|
874
874
|
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
875
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('dir1/./dir2', 'dir1/dir2'))
|
876
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('dir1/./dir2', 'dir1/dir2/'))
|
877
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('dir1/./dir2/', 'dir1/dir2'))
|
878
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('dir1/./dir2/', 'dir1/dir2/'))
|
879
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('dir1/./dir2', './dir1/dir2'))
|
880
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('dir1/./dir2', './dir1/dir2/'))
|
881
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('dir1/./dir2/', './dir1/dir2'))
|
882
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('dir1/./dir2/', './dir1/dir2/'))
|
883
883
|
|
884
|
-
|
884
|
+
end
|
885
885
|
|
886
|
-
|
886
|
+
def test_embedded_dots_3
|
887
887
|
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
888
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('dir1/dir2/.', 'dir1/dir2'))
|
889
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('dir1/dir2/.', 'dir1/dir2/'))
|
890
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('dir1/dir2/./', 'dir1/dir2'))
|
891
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('dir1/dir2/./', 'dir1/dir2/'))
|
892
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('dir1/dir2/.', './dir1/dir2'))
|
893
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('dir1/dir2/.', './dir1/dir2/'))
|
894
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('dir1/dir2/./', './dir1/dir2'))
|
895
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('dir1/dir2/./', './dir1/dir2/'))
|
896
896
|
|
897
|
-
|
897
|
+
end
|
898
898
|
|
899
|
-
|
899
|
+
def test_embedded_dots_4
|
900
900
|
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
901
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('dir1/./dir2/.', 'dir1/dir2'))
|
902
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('dir1/./dir2/.', 'dir1/dir2/'))
|
903
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('dir1/./dir2/./', 'dir1/dir2'))
|
904
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('dir1/./dir2/./', 'dir1/dir2/'))
|
905
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('dir1/./dir2/.', './dir1/dir2'))
|
906
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('dir1/./dir2/.', './dir1/dir2/'))
|
907
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('dir1/./dir2/./', './dir1/dir2'))
|
908
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('dir1/./dir2/./', './dir1/dir2/'))
|
909
909
|
|
910
|
-
|
910
|
+
end
|
911
911
|
|
912
|
-
|
912
|
+
def test_embedded_dots_5
|
913
913
|
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
914
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('./dir1/./dir2/.', 'dir1/dir2'))
|
915
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('./dir1/./dir2/.', 'dir1/dir2/'))
|
916
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('./dir1/./dir2/./', 'dir1/dir2'))
|
917
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('./dir1/./dir2/./', 'dir1/dir2/'))
|
918
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('./dir1/./dir2/.', './dir1/dir2'))
|
919
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('./dir1/./dir2/.', './dir1/dir2/'))
|
920
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('./dir1/./dir2/./', './dir1/dir2'))
|
921
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('./dir1/./dir2/./', './dir1/dir2/'))
|
922
922
|
|
923
|
-
|
923
|
+
end
|
924
924
|
|
925
|
-
|
925
|
+
def test_embedded_dots_6
|
926
926
|
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
927
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('./dir1/././././dir2/.', 'dir1/dir2'))
|
928
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('./dir1/././././dir2/.', 'dir1/dir2/'))
|
929
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('./dir1/././././dir2/./', 'dir1/dir2'))
|
930
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('./dir1/././././dir2/./', 'dir1/dir2/'))
|
931
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('./dir1/././././dir2/.', './dir1/dir2'))
|
932
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('./dir1/././././dir2/.', './dir1/dir2/'))
|
933
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('./dir1/././././dir2/./', './dir1/dir2'))
|
934
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('./dir1/././././dir2/./', './dir1/dir2/'))
|
935
935
|
|
936
|
-
|
936
|
+
end
|
937
937
|
|
938
|
-
|
938
|
+
def test_embedded_dots_7
|
939
939
|
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
940
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('./dir1/././././dir2/.', 'dir1/././dir2'))
|
941
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('./dir1/././././dir2/.', 'dir1/././dir2/'))
|
942
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('./dir1/././././dir2/./', 'dir1/././dir2'))
|
943
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('./dir1/././././dir2/./', 'dir1/././dir2/'))
|
944
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('./dir1/././././dir2/.', './dir1/././dir2'))
|
945
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('./dir1/././././dir2/.', './dir1/././dir2/'))
|
946
|
+
assert_equal('.', Recls::Ximpl.derive_relative_path('./dir1/././././dir2/./', './dir1/././dir2'))
|
947
|
+
assert_equal('./', Recls::Ximpl.derive_relative_path('./dir1/././././dir2/./', './dir1/././dir2/'))
|
948
948
|
|
949
|
-
|
949
|
+
end
|
950
950
|
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
951
|
+
def test_dots_on_dot_1
|
952
|
+
|
953
|
+
assert_equal('../abc/ghi/file.ext', Recls::Ximpl.derive_relative_path('.', '../abc/ghi/file.ext'))
|
954
|
+
assert_equal('../abc/ghi/file.ext', Recls::Ximpl.derive_relative_path('./', '../abc/ghi/file.ext'))
|
955
|
+
end
|
956
956
|
end
|
957
957
|
|