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.
Files changed (43) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE +27 -24
  3. data/README.md +242 -1
  4. data/examples/find_files_and_directories.md +33 -30
  5. data/examples/find_files_and_directories.recursive.md +255 -254
  6. data/examples/show_hidden_files.md +4 -1
  7. data/examples/show_hidden_files.rb +1 -1
  8. data/examples/show_readonly_files.md +4 -1
  9. data/examples/show_readonly_files.rb +1 -1
  10. data/lib/recls/api.rb +75 -73
  11. data/lib/recls/combine_paths_1.rb +25 -23
  12. data/lib/recls/combine_paths_2plus.rb +31 -29
  13. data/lib/recls/entry.rb +276 -273
  14. data/lib/recls/file_search.rb +195 -193
  15. data/lib/recls/flags.rb +46 -45
  16. data/lib/recls/foreach.rb +103 -98
  17. data/lib/recls/obsolete.rb +80 -79
  18. data/lib/recls/recls.rb +16 -15
  19. data/lib/recls/stat.rb +136 -134
  20. data/lib/recls/util.rb +94 -92
  21. data/lib/recls/version.rb +17 -17
  22. data/lib/recls/ximpl/os.rb +45 -43
  23. data/lib/recls/ximpl/unix.rb +38 -35
  24. data/lib/recls/ximpl/util.rb +597 -596
  25. data/lib/recls/ximpl/windows.rb +139 -136
  26. data/lib/recls.rb +10 -9
  27. data/test/scratch/test_display_parts.rb +33 -33
  28. data/test/scratch/test_entry.rb +6 -6
  29. data/test/scratch/test_files_and_directories.rb +8 -8
  30. data/test/scratch/test_foreach.rb +10 -10
  31. data/test/scratch/test_module_function.rb +33 -33
  32. data/test/scratch/test_pattern_arrays.rb +5 -5
  33. data/test/scratch/test_show_dev_and_ino.rb +1 -1
  34. data/test/scratch/test_show_hidden.rb +3 -3
  35. data/test/unit/tc_recls_entries.rb +31 -31
  36. data/test/unit/tc_recls_entry.rb +19 -19
  37. data/test/unit/tc_recls_file_search.rb +32 -32
  38. data/test/unit/tc_recls_module.rb +25 -25
  39. data/test/unit/tc_recls_util.rb +161 -161
  40. data/test/unit/tc_recls_ximpl_util.rb +676 -676
  41. data/test/unit/test_all_separately.sh +1 -1
  42. data/test/unit/ts_all.rb +4 -4
  43. 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
- def test_nil
14
+ def test_nil
15
15
 
16
- wr, rem = Recls::Ximpl::Util.get_windows_root(nil)
17
- assert_nil(wr)
18
- assert_nil(rem)
16
+ wr, rem = Recls::Ximpl::Util.get_windows_root(nil)
17
+ assert_nil(wr)
18
+ assert_nil(rem)
19
19
 
20
- end
21
-
22
- def test_empty
20
+ end
21
+
22
+ def test_empty
23
23
 
24
- wr, rem = Recls::Ximpl::Util.get_windows_root('')
25
- assert_nil(wr)
26
- assert_equal('', rem)
24
+ wr, rem = Recls::Ximpl::Util.get_windows_root('')
25
+ assert_nil(wr)
26
+ assert_equal('', rem)
27
27
 
28
- end
28
+ end
29
29
 
30
- def test_dots_directories
30
+ def test_dots_directories
31
31
 
32
- wr, rem = Recls::Ximpl::Util.get_windows_root('.')
33
- assert_nil(wr)
34
- assert_not_nil(rem)
35
- assert_equal('.', rem)
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
- wr, rem = Recls::Ximpl::Util.get_windows_root('..')
38
- assert_nil(wr)
39
- assert_not_nil(rem)
40
- assert_equal('..', rem)
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
- end
42
+ end
43
43
 
44
- def test_relative_paths
44
+ def test_relative_paths
45
45
 
46
- wr, rem = Recls::Ximpl::Util.get_windows_root('a')
47
- assert_nil(wr)
48
- assert_not_nil(rem)
49
- assert_equal('a', rem)
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
- wr, rem = Recls::Ximpl::Util.get_windows_root('dir1')
52
- assert_nil(wr)
53
- assert_not_nil(rem)
54
- assert_equal('dir1', rem)
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
- 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)
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
- end
61
+ end
62
62
 
63
- def test_windows_paths
63
+ def test_windows_paths
64
64
 
65
- if Recls::Ximpl::OS::OS_IS_WINDOWS
65
+ if Recls::Ximpl::OS::OS_IS_WINDOWS
66
66
 
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)
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
- # 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)
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
- # 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)
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
- # 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)
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
- # 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)
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
- # 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)
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
- # 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)
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
- # 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)
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
- 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
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
- 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
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
- def test_basename_with_paths_without_directories
322
+ def test_basename_with_paths_without_directories
323
323
 
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'))
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
- end # def test_basename_with_paths_without_directories
328
+ end # def test_basename_with_paths_without_directories
329
329
 
330
- def test_basename_with_paths_with_only_directories
330
+ def test_basename_with_paths_with_only_directories
331
331
 
332
- assert_equal('', Recls::Ximpl::basename('a/'))
333
- assert_equal('', Recls::Ximpl::basename('abc/def/'))
334
- assert_equal('', Recls::Ximpl::basename('dir.1/dir2./'))
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
- if Recls::Ximpl::OS::OS_IS_WINDOWS
336
+ if Recls::Ximpl::OS::OS_IS_WINDOWS
337
337
 
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/'))
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
- assert_equal('', Recls::Ximpl::basename('\\\\server\\share\\dir1/dir2\\'))
344
- assert_equal('', Recls::Ximpl::basename('\\\\server\\share/dir1\\dir2/'))
343
+ assert_equal('', Recls::Ximpl::basename('\\\\server\\share\\dir1/dir2\\'))
344
+ assert_equal('', Recls::Ximpl::basename('\\\\server\\share/dir1\\dir2/'))
345
345
 
346
- assert_equal('', Recls::Ximpl::basename('\\\\server\\share\\dir1/'))
347
- assert_equal('', Recls::Ximpl::basename('\\\\server\\share/dir1\\'))
346
+ assert_equal('', Recls::Ximpl::basename('\\\\server\\share\\dir1/'))
347
+ assert_equal('', Recls::Ximpl::basename('\\\\server\\share/dir1\\'))
348
348
 
349
- assert_equal('', Recls::Ximpl::basename('\\\\server\\share\\'))
350
- assert_equal('', Recls::Ximpl::basename('\\\\server\\share/'))
349
+ assert_equal('', Recls::Ximpl::basename('\\\\server\\share\\'))
350
+ assert_equal('', Recls::Ximpl::basename('\\\\server\\share/'))
351
351
 
352
- assert_equal('', Recls::Ximpl::basename('\\\\server\\share'))
353
- assert_equal('', Recls::Ximpl::basename('\\\\server\\share'))
352
+ assert_equal('', Recls::Ximpl::basename('\\\\server\\share'))
353
+ assert_equal('', Recls::Ximpl::basename('\\\\server\\share'))
354
354
 
355
- assert_equal('', Recls::Ximpl::basename('\\\\server\\'))
356
- assert_equal('', Recls::Ximpl::basename('\\\\server\\'))
355
+ assert_equal('', Recls::Ximpl::basename('\\\\server\\'))
356
+ assert_equal('', Recls::Ximpl::basename('\\\\server\\'))
357
357
 
358
- assert_equal('', Recls::Ximpl::basename('\\\\server'))
359
- assert_equal('', Recls::Ximpl::basename('\\\\server'))
358
+ assert_equal('', Recls::Ximpl::basename('\\\\server'))
359
+ assert_equal('', Recls::Ximpl::basename('\\\\server'))
360
360
 
361
- end
361
+ end
362
362
 
363
- end # def test_basename_with_paths_with_only_directories
363
+ end # def test_basename_with_paths_with_only_directories
364
364
 
365
- def test_basename_with_paths_with_directories
365
+ def test_basename_with_paths_with_directories
366
366
 
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.'))
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
- if Recls::Ximpl::OS::OS_IS_WINDOWS
373
+ if Recls::Ximpl::OS::OS_IS_WINDOWS
374
374
 
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'))
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
- assert_equal('file1', Recls::Ximpl::basename('\\\\server\\share\\dir1/dir2\\file1'))
381
- assert_equal('file1', Recls::Ximpl::basename('\\\\server\\share/dir1\\dir2/file1'))
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
- assert_equal('file1', Recls::Ximpl::basename('\\\\server\\share\\dir1/file1'))
384
- assert_equal('file1', Recls::Ximpl::basename('\\\\server\\share/dir1\\file1'))
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
- assert_equal('file1', Recls::Ximpl::basename('\\\\server\\share\\file1'))
387
- assert_equal('file1', Recls::Ximpl::basename('\\\\server\\share/file1'))
386
+ assert_equal('file1', Recls::Ximpl::basename('\\\\server\\share\\file1'))
387
+ assert_equal('file1', Recls::Ximpl::basename('\\\\server\\share/file1'))
388
388
 
389
- end
389
+ end
390
390
 
391
- end # def test_basename_with_paths_with_directories
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
- def test_paths_without_files
397
+ def test_paths_without_files
398
398
 
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/'))
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
- if Recls::Ximpl::OS::OS_IS_WINDOWS
406
+ if Recls::Ximpl::OS::OS_IS_WINDOWS
407
407
 
408
- assert_equal('', Recls::Ximpl::file_ext('H:'))
409
- assert_equal('', Recls::Ximpl::file_ext('H:/'))
410
- assert_equal('', Recls::Ximpl::file_ext('H:\\'))
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
- assert_equal('', Recls::Ximpl::file_ext('\\\\server\\share\\dir1/dir2\\'))
413
- assert_equal('', Recls::Ximpl::file_ext('\\\\server\\share/dir1\\dir2/'))
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
- end
415
+ end
416
416
 
417
- end
417
+ end
418
418
 
419
- def test_paths_with_files_but_no_extensions
419
+ def test_paths_with_files_but_no_extensions
420
420
 
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'))
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
- if Recls::Ximpl::OS::OS_IS_WINDOWS
428
+ if Recls::Ximpl::OS::OS_IS_WINDOWS
429
429
 
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'))
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
- assert_equal('', Recls::Ximpl::file_ext('\\\\server\\share\\dir1/dir2\\file3'))
435
- assert_equal('', Recls::Ximpl::file_ext('\\\\server\\share/dir1\\dir2/file3'))
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
- end
437
+ end
438
438
 
439
- end
439
+ end
440
440
 
441
- def test_paths_with_files_with_extensions
441
+ def test_paths_with_files_with_extensions
442
442
 
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'))
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
- if Recls::Ximpl::OS::OS_IS_WINDOWS
450
+ if Recls::Ximpl::OS::OS_IS_WINDOWS
451
451
 
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'))
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
- 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'))
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
- end
459
+ end
460
460
 
461
- end
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
- def test_nil
467
+ def test_nil
468
468
 
469
- assert_nil(Recls::Ximpl::directory_from_directory_path(nil))
469
+ assert_nil(Recls::Ximpl::directory_from_directory_path(nil))
470
470
 
471
- end
471
+ end
472
472
 
473
- def test_empty
473
+ def test_empty
474
474
 
475
- assert_equal('', Recls::Ximpl::directory_from_directory_path(''))
475
+ assert_equal('', Recls::Ximpl::directory_from_directory_path(''))
476
476
 
477
- end
477
+ end
478
478
 
479
- def test_dots
479
+ def test_dots
480
480
 
481
- assert_equal('.', Recls::Ximpl::directory_from_directory_path('.'))
481
+ assert_equal('.', Recls::Ximpl::directory_from_directory_path('.'))
482
482
 
483
- end
483
+ end
484
484
 
485
- def test_leaf_dir_only
485
+ def test_leaf_dir_only
486
486
 
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.'))
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
- end
491
+ end
492
492
 
493
- def test_roots_only
493
+ def test_roots_only
494
494
 
495
- assert_equal('/', Recls::Ximpl::directory_from_directory_path('/'))
495
+ assert_equal('/', Recls::Ximpl::directory_from_directory_path('/'))
496
496
 
497
- if Recls::Ximpl::OS::OS_IS_WINDOWS
497
+ if Recls::Ximpl::OS::OS_IS_WINDOWS
498
498
 
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/'))
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
- end
504
+ end
505
505
 
506
- end
506
+ end
507
507
 
508
- def test_rooted_paths
508
+ def test_rooted_paths
509
509
 
510
- if Recls::Ximpl::OS::OS_IS_WINDOWS
510
+ if Recls::Ximpl::OS::OS_IS_WINDOWS
511
511
 
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\\'))
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
- end
515
+ end
516
516
 
517
- end
517
+ end
518
518
 
519
519
  end
520
520
 
521
521
  class Test_Recls_Ximpl_canonicalise_path < Test::Unit::TestCase
522
522
 
523
- def test_nil
523
+ def test_nil
524
524
 
525
- assert_nil(Recls::Ximpl::canonicalise_path(nil))
525
+ assert_nil(Recls::Ximpl::canonicalise_path(nil))
526
526
 
527
- end
527
+ end
528
528
 
529
- def test_empty
529
+ def test_empty
530
530
 
531
- assert_equal('', Recls::Ximpl::canonicalise_path(''))
531
+ assert_equal('', Recls::Ximpl::canonicalise_path(''))
532
532
 
533
- end
533
+ end
534
534
 
535
- def test_dots_directories
535
+ def test_dots_directories
536
536
 
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('./././'))
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
- 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('.././'))
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
- end
547
+ end
548
548
 
549
- def test_files_only
549
+ def test_files_only
550
550
 
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'))
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
- end
555
+ end
556
556
 
557
- def test_zero_parts
557
+ def test_zero_parts
558
558
 
559
- if Recls::Ximpl::OS::OS_IS_WINDOWS
559
+ if Recls::Ximpl::OS::OS_IS_WINDOWS
560
560
 
561
- assert_equal('H:', Recls::Ximpl::canonicalise_path('H:'))
561
+ assert_equal('H:', Recls::Ximpl::canonicalise_path('H:'))
562
562
 
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/'))
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
- end
568
+ end
569
569
 
570
- end
570
+ end
571
571
 
572
- def test_single_canonicalisation
572
+ def test_single_canonicalisation
573
573
 
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/.'))
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
- end
579
+ end
580
580
 
581
- def test_double_canonicalisation
581
+ def test_double_canonicalisation
582
582
 
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/'))
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
- 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/'))
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
- 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/'))
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
- 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/'))
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
- 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/..'))
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
- assert_equal('/', Recls::Ximpl::canonicalise_path('/dir.14/dir.2/../..'))
605
- assert_equal('.', Recls::Ximpl::canonicalise_path('dir.14/dir.2/../..'))
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
- if Recls::Ximpl::OS::OS_IS_WINDOWS
607
+ if Recls::Ximpl::OS::OS_IS_WINDOWS
608
608
 
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\\'))
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
- 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\\'))
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
- end
618
+ end
619
619
 
620
- end
620
+ end
621
621
 
622
- def test_complex_examples
622
+ def test_complex_examples
623
623
 
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.'))
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
- if Recls::Ximpl::OS::OS_IS_WINDOWS
628
+ if Recls::Ximpl::OS::OS_IS_WINDOWS
629
629
 
630
- end
630
+ end
631
631
 
632
- end
632
+ end
633
633
 
634
634
  end
635
635
 
636
636
  class Test_Recls_Ximpl_absolute_path < Test::Unit::TestCase
637
637
 
638
- attr_reader :cwd
638
+ attr_reader :cwd
639
639
 
640
- def setup
640
+ def setup
641
641
 
642
- @cwd = Dir.getwd
642
+ @cwd = Dir.getwd
643
643
 
644
- end
644
+ end
645
645
 
646
- def test_nil
646
+ def test_nil
647
647
 
648
- assert_nil(Recls::Ximpl::absolute_path(nil))
648
+ assert_nil(Recls::Ximpl::absolute_path(nil))
649
649
 
650
- assert_nil(Recls::Ximpl::absolute_path(nil, cwd))
650
+ assert_nil(Recls::Ximpl::absolute_path(nil, cwd))
651
651
 
652
- end
652
+ end
653
653
 
654
- def test_empty_path
654
+ def test_empty_path
655
655
 
656
- assert_equal('', Recls::Ximpl::absolute_path(''))
656
+ assert_equal('', Recls::Ximpl::absolute_path(''))
657
657
 
658
- assert_equal('', Recls::Ximpl::absolute_path('', cwd))
658
+ assert_equal('', Recls::Ximpl::absolute_path('', cwd))
659
659
 
660
- end
660
+ end
661
661
 
662
- def test_rooted_paths
662
+ def test_rooted_paths
663
663
 
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'))
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
- 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))
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
- end
676
+ end
677
677
 
678
- def test_single_dot
678
+ def test_single_dot
679
679
 
680
- assert_equal("#{cwd}", Recls::Ximpl::absolute_path('.'))
681
- assert_equal("#{cwd}/", Recls::Ximpl::absolute_path('./'))
680
+ assert_equal("#{cwd}", Recls::Ximpl::absolute_path('.'))
681
+ assert_equal("#{cwd}/", Recls::Ximpl::absolute_path('./'))
682
682
 
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"))
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
- 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/"))
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
- end
689
+ end
690
690
 
691
- def test_double_dots
691
+ def test_double_dots
692
692
 
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"))
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
- assert_equal("/dir.1/", Recls::Ximpl::absolute_path('../', "/dir.1/dir.2"))
696
+ assert_equal("/dir.1/", Recls::Ximpl::absolute_path('../', "/dir.1/dir.2"))
697
697
 
698
- end
698
+ end
699
699
  end
700
700
 
701
701
  class Test_Recls_Ximpl_derive_relative_path < Test::Unit::TestCase
702
702
 
703
- attr_reader :cwd
703
+ attr_reader :cwd
704
704
 
705
- def setup
705
+ def setup
706
706
 
707
- @cwd = Dir.getwd
707
+ @cwd = Dir.getwd
708
708
 
709
- end
709
+ end
710
710
 
711
- M = Recls::Ximpl
711
+ M = Recls::Ximpl
712
712
 
713
- def test_libpath_cases_test_nils_and_empties
713
+ def test_libpath_cases_test_nils_and_empties
714
714
 
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, '')
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
- # 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')
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
- # 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
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
- def test_libpath_cases_test_same_location
730
+ def test_libpath_cases_test_same_location
731
731
 
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/')
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
- assert_equal './', M.derive_relative_path('/', '/')
736
+ assert_equal './', M.derive_relative_path('/', '/')
737
737
 
738
738
  =begin
739
739
 
740
- assert_equal '.', M.derive_relative_path('./abc', 'abc')
740
+ assert_equal '.', M.derive_relative_path('./abc', 'abc')
741
741
  =end
742
- assert_equal '.', M.derive_relative_path('./abc/', 'abc')
742
+ assert_equal '.', M.derive_relative_path('./abc/', 'abc')
743
743
  =begin
744
744
 
745
- assert_equal './', M.derive_relative_path('./abc', 'abc/')
745
+ assert_equal './', M.derive_relative_path('./abc', 'abc/')
746
746
  =end
747
- assert_equal './', M.derive_relative_path('./abc/', 'abc/')
748
- end
747
+ assert_equal './', M.derive_relative_path('./abc/', 'abc/')
748
+ end
749
749
 
750
- def test_libpath_cases_test_one_above
750
+ def test_libpath_cases_test_one_above
751
751
 
752
752
  =begin
753
753
 
754
- assert_equal '..', M.derive_relative_path('.', '..')
754
+ assert_equal '..', M.derive_relative_path('.', '..')
755
755
  =end
756
- end
756
+ end
757
757
 
758
- def test_absolute_proper_subset
758
+ def test_absolute_proper_subset
759
759
 
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/'))
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
- 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/'))
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
- 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/'))
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
- end
775
+ end
776
776
 
777
- def test_absolute_proper_subset_2
777
+ def test_absolute_proper_subset_2
778
778
 
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++'))
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
- 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++'))
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
- end
785
+ end
786
786
 
787
- def test_absolute_same_1
787
+ def test_absolute_same_1
788
788
 
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/'))
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
- 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/'))
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
- end
799
+ end
800
800
 
801
- def test_absolute_same_2
801
+ def test_absolute_same_2
802
802
 
803
- assert_equal('.', Recls::Ximpl.derive_relative_path('/dir1', '/dir1'))
804
- assert_equal('.', Recls::Ximpl.derive_relative_path('/dir1/', '/dir1'))
803
+ assert_equal('.', Recls::Ximpl.derive_relative_path('/dir1', '/dir1'))
804
+ assert_equal('.', Recls::Ximpl.derive_relative_path('/dir1/', '/dir1'))
805
805
 
806
- end
806
+ end
807
807
 
808
- def test_absolute_same_3
808
+ def test_absolute_same_3
809
809
 
810
- assert_equal('./', Recls::Ximpl.derive_relative_path('/', '/'))
810
+ assert_equal('./', Recls::Ximpl.derive_relative_path('/', '/'))
811
811
 
812
- end
812
+ end
813
813
 
814
- def test_different_sub_trees_1
814
+ def test_different_sub_trees_1
815
815
 
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/'))
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
- end
821
+ end
822
822
 
823
- def test_different_sub_trees_2
823
+ def test_different_sub_trees_2
824
824
 
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/'))
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
- end
830
+ end
831
831
 
832
- def test_different_sub_trees_3
832
+ def test_different_sub_trees_3
833
833
 
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/'))
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
- end
839
+ end
840
840
 
841
- def test_different_sub_trees_4
841
+ def test_different_sub_trees_4
842
842
 
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/'))
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
- end
848
+ end
849
849
 
850
- def test_different_sub_trees_5
850
+ def test_different_sub_trees_5
851
851
 
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/'))
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
- end
857
+ end
858
858
 
859
- def test_embedded_dots_1
859
+ def test_embedded_dots_1
860
860
 
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/'))
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
- 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/'))
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
- end
871
+ end
872
872
 
873
- def test_embedded_dots_2
873
+ def test_embedded_dots_2
874
874
 
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/'))
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
- end
884
+ end
885
885
 
886
- def test_embedded_dots_3
886
+ def test_embedded_dots_3
887
887
 
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/'))
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
- end
897
+ end
898
898
 
899
- def test_embedded_dots_4
899
+ def test_embedded_dots_4
900
900
 
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/'))
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
- end
910
+ end
911
911
 
912
- def test_embedded_dots_5
912
+ def test_embedded_dots_5
913
913
 
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/'))
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
- end
923
+ end
924
924
 
925
- def test_embedded_dots_6
925
+ def test_embedded_dots_6
926
926
 
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/'))
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
- end
936
+ end
937
937
 
938
- def test_embedded_dots_7
938
+ def test_embedded_dots_7
939
939
 
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/'))
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
- end
949
+ end
950
950
 
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
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