recls-ruby 2.12.0 → 2.12.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 +4 -4
  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 +76 -73
  11. data/lib/recls/combine_paths_1.rb +26 -23
  12. data/lib/recls/combine_paths_2plus.rb +32 -29
  13. data/lib/recls/entry.rb +277 -273
  14. data/lib/recls/file_search.rb +194 -193
  15. data/lib/recls/flags.rb +48 -45
  16. data/lib/recls/foreach.rb +105 -98
  17. data/lib/recls/obsolete.rb +85 -79
  18. data/lib/recls/recls.rb +19 -24
  19. data/lib/recls/stat.rb +137 -134
  20. data/lib/recls/util.rb +95 -92
  21. data/lib/recls/version.rb +22 -17
  22. data/lib/recls/ximpl/os.rb +49 -48
  23. data/lib/recls/ximpl/unix.rb +41 -38
  24. data/lib/recls/ximpl/util.rb +600 -599
  25. data/lib/recls/ximpl/windows.rb +142 -139
  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 +7 -7
@@ -4,234 +4,234 @@
4
4
 
5
5
  $:.unshift File.join(File.dirname(__FILE__), '../..', 'lib')
6
6
 
7
-
8
7
  require 'recls/util'
9
8
 
10
9
  require 'test/unit'
11
10
 
11
+
12
12
  class Test_combine_paths < Test::Unit::TestCase
13
13
 
14
- def test_nil_nil
14
+ def test_nil_nil
15
15
 
16
- assert_raise(::ArgumentError) { Recls.combine_paths(nil, nil) }
17
- end
16
+ assert_raise(::ArgumentError) { Recls.combine_paths(nil, nil) }
17
+ end
18
18
 
19
- def test_origin_nil
19
+ def test_origin_nil
20
20
 
21
- strings = [
21
+ strings = [
22
22
 
23
- 'abc',
24
- 'abc/def',
25
- 'abc/def/ghi.ext',
26
- ]
23
+ 'abc',
24
+ 'abc/def',
25
+ 'abc/def/ghi.ext',
26
+ ]
27
27
 
28
- strings.each do |s|
28
+ strings.each do |s|
29
29
 
30
- assert_equal s, Recls.combine_paths(nil, s)
31
- end
32
- end
30
+ assert_equal s, Recls.combine_paths(nil, s)
31
+ end
32
+ end
33
33
 
34
- def test_path_nil
34
+ def test_path_nil
35
35
 
36
- strings = [
36
+ strings = [
37
37
 
38
- 'abc',
39
- 'abc/def',
40
- 'abc/def/ghi.ext',
41
- ]
38
+ 'abc',
39
+ 'abc/def',
40
+ 'abc/def/ghi.ext',
41
+ ]
42
42
 
43
- strings.each do |s|
43
+ strings.each do |s|
44
44
 
45
- assert_equal s, Recls.combine_paths(s, nil)
46
- end
47
- end
45
+ assert_equal s, Recls.combine_paths(s, nil)
46
+ end
47
+ end
48
48
 
49
- def test_both_relative
49
+ def test_both_relative
50
50
 
51
- assert_equal 'abc/def', Recls.combine_paths('abc', 'def')
52
- assert_equal 'abc/def', Recls.combine_paths('abc/', 'def')
53
- assert_equal 'abc/def/ghi', Recls.combine_paths('abc/def', 'ghi')
54
- assert_equal 'abc/def/ghi', Recls.combine_paths('abc/def/', 'ghi')
55
- assert_equal 'abc/def/ghi', Recls.combine_paths('abc', 'def/ghi')
56
- assert_equal 'abc/def/ghi', Recls.combine_paths('abc/', 'def/ghi')
57
- assert_equal 'abc/./def/ghi', Recls.combine_paths('abc/.', 'def/ghi')
58
- assert_equal 'abc/./def/ghi', Recls.combine_paths('abc/./', 'def/ghi')
59
- if RUBY_VERSION >= '2'
60
- assert_equal 'abc/./def/ghi', Recls.combine_paths('abc/.', 'def/ghi', clean_path: false)
61
- assert_equal 'abc/./def/ghi', Recls.combine_paths('abc/./', 'def/ghi', clean: false)
62
- assert_equal 'abc/def/ghi', Recls.combine_paths('abc/.', 'def/ghi', clean_path: true)
63
- assert_equal 'abc/def/ghi', Recls.combine_paths('abc/./', 'def/ghi', clean: true)
64
- assert_equal 'abc/def/ghi', Recls.combine_paths('abc/./.', 'def/ghi', clean_path: true)
65
- assert_equal 'abc/../def/ghi', Recls.combine_paths('abc/..', 'def/ghi')
66
- assert_equal 'def/ghi', Recls.combine_paths('abc/..', 'def/ghi', clean_path: true)
67
- end
68
- end
51
+ assert_equal 'abc/def', Recls.combine_paths('abc', 'def')
52
+ assert_equal 'abc/def', Recls.combine_paths('abc/', 'def')
53
+ assert_equal 'abc/def/ghi', Recls.combine_paths('abc/def', 'ghi')
54
+ assert_equal 'abc/def/ghi', Recls.combine_paths('abc/def/', 'ghi')
55
+ assert_equal 'abc/def/ghi', Recls.combine_paths('abc', 'def/ghi')
56
+ assert_equal 'abc/def/ghi', Recls.combine_paths('abc/', 'def/ghi')
57
+ assert_equal 'abc/./def/ghi', Recls.combine_paths('abc/.', 'def/ghi')
58
+ assert_equal 'abc/./def/ghi', Recls.combine_paths('abc/./', 'def/ghi')
59
+ if RUBY_VERSION >= '2'
60
+ assert_equal 'abc/./def/ghi', Recls.combine_paths('abc/.', 'def/ghi', clean_path: false)
61
+ assert_equal 'abc/./def/ghi', Recls.combine_paths('abc/./', 'def/ghi', clean: false)
62
+ assert_equal 'abc/def/ghi', Recls.combine_paths('abc/.', 'def/ghi', clean_path: true)
63
+ assert_equal 'abc/def/ghi', Recls.combine_paths('abc/./', 'def/ghi', clean: true)
64
+ assert_equal 'abc/def/ghi', Recls.combine_paths('abc/./.', 'def/ghi', clean_path: true)
65
+ assert_equal 'abc/../def/ghi', Recls.combine_paths('abc/..', 'def/ghi')
66
+ assert_equal 'def/ghi', Recls.combine_paths('abc/..', 'def/ghi', clean_path: true)
67
+ end
68
+ end
69
69
 
70
- def test_multiple_relative
70
+ def test_multiple_relative
71
71
 
72
- if RUBY_VERSION >= '2'
73
- assert_equal 'a/b/c/d/e/f/g', Recls.combine_paths('a', 'b', 'c', 'd/e/f/', 'g', clean: false)
74
- assert_equal 'a/b/c/d/e/f/g', Recls.combine_paths('a', 'b', 'c', 'd/e/f/', 'g', clean: true)
72
+ if RUBY_VERSION >= '2'
73
+ assert_equal 'a/b/c/d/e/f/g', Recls.combine_paths('a', 'b', 'c', 'd/e/f/', 'g', clean: false)
74
+ assert_equal 'a/b/c/d/e/f/g', Recls.combine_paths('a', 'b', 'c', 'd/e/f/', 'g', clean: true)
75
75
 
76
- assert_equal 'a/b/c/../d/e/f/g', Recls.combine_paths('a', 'b', 'c', '..', 'd/e/f/', 'g', clean: false)
77
- assert_equal 'a/b/d/e/f/g', Recls.combine_paths('a', 'b', 'c', '..', 'd/e/f/', 'g/', clean: true)
78
- assert_equal 'a/b/d/e/f/g/', Recls.combine_paths('a', 'b', 'c', '..', 'd/e/f/', 'g/', canonicalise: true)
79
- end
80
- end
76
+ assert_equal 'a/b/c/../d/e/f/g', Recls.combine_paths('a', 'b', 'c', '..', 'd/e/f/', 'g', clean: false)
77
+ assert_equal 'a/b/d/e/f/g', Recls.combine_paths('a', 'b', 'c', '..', 'd/e/f/', 'g/', clean: true)
78
+ assert_equal 'a/b/d/e/f/g/', Recls.combine_paths('a', 'b', 'c', '..', 'd/e/f/', 'g/', canonicalise: true)
79
+ end
80
+ end
81
81
 
82
- def test_various_absolute_placings
82
+ def test_various_absolute_placings
83
83
 
84
- assert_equal '/a/b/c/d/e/f/g', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', 'f/g')
84
+ assert_equal '/a/b/c/d/e/f/g', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', 'f/g')
85
85
 
86
- assert_equal '/b/c/d/e/f/g', Recls.combine_paths('/', 'a', '/b', 'c', 'd/e', 'f/g')
86
+ assert_equal '/b/c/d/e/f/g', Recls.combine_paths('/', 'a', '/b', 'c', 'd/e', 'f/g')
87
87
 
88
- assert_equal '/c/d/e/f/g', Recls.combine_paths('/', 'a', 'b', '/c', 'd/e', 'f/g')
88
+ assert_equal '/c/d/e/f/g', Recls.combine_paths('/', 'a', 'b', '/c', 'd/e', 'f/g')
89
89
 
90
- assert_equal '/d/e/f/g', Recls.combine_paths('/', 'a', 'b', 'c', '/d/e', 'f/g')
90
+ assert_equal '/d/e/f/g', Recls.combine_paths('/', 'a', 'b', 'c', '/d/e', 'f/g')
91
91
 
92
- assert_equal '/f/g', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', '/f/g')
93
- assert_equal '/f/g/', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', '/f/g/')
94
- if RUBY_VERSION >= '2'
95
- assert_equal '/f/g', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', '/f/g/', clean: true)
96
- assert_equal '/f/g/', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', '/f/g/', canonicalise: true)
97
- end
98
- end
92
+ assert_equal '/f/g', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', '/f/g')
93
+ assert_equal '/f/g/', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', '/f/g/')
94
+ if RUBY_VERSION >= '2'
95
+ assert_equal '/f/g', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', '/f/g/', clean: true)
96
+ assert_equal '/f/g/', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', '/f/g/', canonicalise: true)
97
+ end
98
+ end
99
99
  end
100
100
 
101
101
  class Test_canonicalise_path < Test::Unit::TestCase
102
102
 
103
- def test_nil
103
+ def test_nil
104
104
 
105
- assert_nil(Recls.canonicalise_path(nil))
106
- end
105
+ assert_nil(Recls.canonicalise_path(nil))
106
+ end
107
107
 
108
- def test_empty
108
+ def test_empty
109
109
 
110
- assert_equal('', Recls.canonicalise_path(''))
111
- end
110
+ assert_equal('', Recls.canonicalise_path(''))
111
+ end
112
112
 
113
- def test_dots_directories
113
+ def test_dots_directories
114
114
 
115
- assert_equal('.', Recls.canonicalise_path('.'))
116
- assert_equal('./', Recls.canonicalise_path('./'))
117
- assert_equal('.', Recls.canonicalise_path('././.'))
118
- assert_equal('./', Recls.canonicalise_path('./././'))
115
+ assert_equal('.', Recls.canonicalise_path('.'))
116
+ assert_equal('./', Recls.canonicalise_path('./'))
117
+ assert_equal('.', Recls.canonicalise_path('././.'))
118
+ assert_equal('./', Recls.canonicalise_path('./././'))
119
119
 
120
- assert_equal('..', Recls.canonicalise_path('..'))
121
- assert_equal('../', Recls.canonicalise_path('../'))
122
- assert_equal('..', Recls.canonicalise_path('../.'))
123
- assert_equal('../', Recls.canonicalise_path('.././'))
124
- end
120
+ assert_equal('..', Recls.canonicalise_path('..'))
121
+ assert_equal('../', Recls.canonicalise_path('../'))
122
+ assert_equal('..', Recls.canonicalise_path('../.'))
123
+ assert_equal('../', Recls.canonicalise_path('.././'))
124
+ end
125
125
 
126
- def test_files_only
126
+ def test_files_only
127
127
 
128
- assert_equal('a', Recls.canonicalise_path('a'))
129
- assert_equal('file', Recls.canonicalise_path('file'))
130
- assert_equal('file.ext', Recls.canonicalise_path('file.ext'))
131
- end
128
+ assert_equal('a', Recls.canonicalise_path('a'))
129
+ assert_equal('file', Recls.canonicalise_path('file'))
130
+ assert_equal('file.ext', Recls.canonicalise_path('file.ext'))
131
+ end
132
132
 
133
- def test_zero_parts
133
+ def test_zero_parts
134
134
 
135
- if Recls::Ximpl::OS::OS_IS_WINDOWS
135
+ if Recls::Ximpl::OS::OS_IS_WINDOWS
136
136
 
137
- assert_equal('H:', Recls.canonicalise_path('H:'))
137
+ assert_equal('H:', Recls.canonicalise_path('H:'))
138
138
 
139
- assert_equal('\\\\server', Recls.canonicalise_path('\\\\server'))
140
- assert_equal('\\\\server\\', Recls.canonicalise_path('\\\\server\\'))
141
- assert_equal('\\\\server\\share', Recls.canonicalise_path('\\\\server\\share'))
142
- assert_equal('\\\\server\\share/', Recls.canonicalise_path('\\\\server\\share/'))
143
- end
144
- end
139
+ assert_equal('\\\\server', Recls.canonicalise_path('\\\\server'))
140
+ assert_equal('\\\\server\\', Recls.canonicalise_path('\\\\server\\'))
141
+ assert_equal('\\\\server\\share', Recls.canonicalise_path('\\\\server\\share'))
142
+ assert_equal('\\\\server\\share/', Recls.canonicalise_path('\\\\server\\share/'))
143
+ end
144
+ end
145
145
 
146
- def test_canonicalised_directories_one_level
146
+ def test_canonicalised_directories_one_level
147
147
 
148
- assert_equal('abc', Recls.canonicalise_path('abc'))
149
- assert_equal('abc/', Recls.canonicalise_path('abc/'))
150
- assert_equal('/abc', Recls.canonicalise_path('/abc'))
151
- assert_equal('/abc/', Recls.canonicalise_path('/abc/'))
152
- end
148
+ assert_equal('abc', Recls.canonicalise_path('abc'))
149
+ assert_equal('abc/', Recls.canonicalise_path('abc/'))
150
+ assert_equal('/abc', Recls.canonicalise_path('/abc'))
151
+ assert_equal('/abc/', Recls.canonicalise_path('/abc/'))
152
+ end
153
153
 
154
- def test_canonicalised_directories_two_levels
154
+ def test_canonicalised_directories_two_levels
155
155
 
156
- assert_equal('abc/def', Recls.canonicalise_path('abc/def'))
157
- assert_equal('abc/def/', Recls.canonicalise_path('abc/def/'))
158
- assert_equal('/abc/def', Recls.canonicalise_path('/abc/def'))
159
- assert_equal('/abc/def/', Recls.canonicalise_path('/abc/def/'))
160
- end
156
+ assert_equal('abc/def', Recls.canonicalise_path('abc/def'))
157
+ assert_equal('abc/def/', Recls.canonicalise_path('abc/def/'))
158
+ assert_equal('/abc/def', Recls.canonicalise_path('/abc/def'))
159
+ assert_equal('/abc/def/', Recls.canonicalise_path('/abc/def/'))
160
+ end
161
161
 
162
- def test_uncanonicalised_directories_one_level
162
+ def test_uncanonicalised_directories_one_level
163
163
 
164
- assert_equal('.', Recls.canonicalise_path('.'))
165
- assert_equal('./', Recls.canonicalise_path('./'))
166
- assert_equal('/', Recls.canonicalise_path('/.'))
167
- assert_equal('/', Recls.canonicalise_path('/./'))
164
+ assert_equal('.', Recls.canonicalise_path('.'))
165
+ assert_equal('./', Recls.canonicalise_path('./'))
166
+ assert_equal('/', Recls.canonicalise_path('/.'))
167
+ assert_equal('/', Recls.canonicalise_path('/./'))
168
168
 
169
- assert_equal('..', Recls.canonicalise_path('..'))
170
- assert_equal('../', Recls.canonicalise_path('../'))
171
- assert_equal('/', Recls.canonicalise_path('/..'))
172
- assert_equal('/', Recls.canonicalise_path('/../'))
173
- end
169
+ assert_equal('..', Recls.canonicalise_path('..'))
170
+ assert_equal('../', Recls.canonicalise_path('../'))
171
+ assert_equal('/', Recls.canonicalise_path('/..'))
172
+ assert_equal('/', Recls.canonicalise_path('/../'))
173
+ end
174
174
 
175
- def test_single_canonicalisation
175
+ def test_single_canonicalisation
176
176
 
177
- assert_equal('dir.1/', Recls.canonicalise_path('dir.1/'))
178
- assert_equal('dir.1/', Recls.canonicalise_path('dir.1/./'))
179
- assert_equal('dir.1/', Recls.canonicalise_path('./dir.1/./'))
180
- assert_equal('dir.1/', Recls.canonicalise_path('./dir.1/.'))
181
- end
177
+ assert_equal('dir.1/', Recls.canonicalise_path('dir.1/'))
178
+ assert_equal('dir.1/', Recls.canonicalise_path('dir.1/./'))
179
+ assert_equal('dir.1/', Recls.canonicalise_path('./dir.1/./'))
180
+ assert_equal('dir.1/', Recls.canonicalise_path('./dir.1/.'))
181
+ end
182
182
 
183
- def test_double_canonicalisation
183
+ def test_double_canonicalisation
184
184
 
185
- assert_equal('dir.1/dir.2/', Recls.canonicalise_path('dir.1/dir.2/'))
186
- assert_equal('dir.1/dir.2/', Recls.canonicalise_path('dir.1/dir.2/dir.3/../'))
187
- assert_equal('dir.1/dir.2/', Recls.canonicalise_path('dir.1/dir.2/dir.3/../'))
188
- assert_equal('dir.1/dir.2/', Recls.canonicalise_path('dir.1/dir.3/../dir.2/'))
189
- assert_equal('dir.1/dir.2/', Recls.canonicalise_path('dir.3/../dir.1/dir.2/'))
185
+ assert_equal('dir.1/dir.2/', Recls.canonicalise_path('dir.1/dir.2/'))
186
+ assert_equal('dir.1/dir.2/', Recls.canonicalise_path('dir.1/dir.2/dir.3/../'))
187
+ assert_equal('dir.1/dir.2/', Recls.canonicalise_path('dir.1/dir.2/dir.3/../'))
188
+ assert_equal('dir.1/dir.2/', Recls.canonicalise_path('dir.1/dir.3/../dir.2/'))
189
+ assert_equal('dir.1/dir.2/', Recls.canonicalise_path('dir.3/../dir.1/dir.2/'))
190
190
 
191
- assert_equal('../dir.1/dir.2/', Recls.canonicalise_path('../dir.1/dir.2/'))
192
- assert_equal('../dir.4/', Recls.canonicalise_path('../dir.1/../dir.4/'))
191
+ assert_equal('../dir.1/dir.2/', Recls.canonicalise_path('../dir.1/dir.2/'))
192
+ assert_equal('../dir.4/', Recls.canonicalise_path('../dir.1/../dir.4/'))
193
193
 
194
- assert_equal('/dir.1/dir.2/', Recls.canonicalise_path('/dir.1/dir.2/'))
195
- assert_equal('/dir.1/dir.2/', Recls.canonicalise_path('/dir.1/dir.2/dir.3/../'))
196
- assert_equal('/dir.1/dir.2/', Recls.canonicalise_path('/dir.1/dir.2/dir.3/../'))
197
- assert_equal('/dir.1/dir.2/', Recls.canonicalise_path('/dir.1/dir.3/../dir.2/'))
198
- assert_equal('/dir.1/dir.2/', Recls.canonicalise_path('/dir.3/../dir.1/dir.2/'))
194
+ assert_equal('/dir.1/dir.2/', Recls.canonicalise_path('/dir.1/dir.2/'))
195
+ assert_equal('/dir.1/dir.2/', Recls.canonicalise_path('/dir.1/dir.2/dir.3/../'))
196
+ assert_equal('/dir.1/dir.2/', Recls.canonicalise_path('/dir.1/dir.2/dir.3/../'))
197
+ assert_equal('/dir.1/dir.2/', Recls.canonicalise_path('/dir.1/dir.3/../dir.2/'))
198
+ assert_equal('/dir.1/dir.2/', Recls.canonicalise_path('/dir.3/../dir.1/dir.2/'))
199
199
 
200
- assert_equal('/dir.1/dir.2/', Recls.canonicalise_path('/../dir.1/dir.2/'))
201
- assert_equal('/dir.4/', Recls.canonicalise_path('/../dir.1/../dir.4/'))
200
+ assert_equal('/dir.1/dir.2/', Recls.canonicalise_path('/../dir.1/dir.2/'))
201
+ assert_equal('/dir.4/', Recls.canonicalise_path('/../dir.1/../dir.4/'))
202
202
 
203
- assert_equal('/dir.14/', Recls.canonicalise_path('/dir.14/dir.2/..'))
204
- assert_equal('/', Recls.canonicalise_path('/dir.14/dir.2/../..'))
205
- assert_equal('/', Recls.canonicalise_path('/dir.14/dir.2/../../..'))
206
- assert_equal('dir.14/', Recls.canonicalise_path('dir.14/dir.2/..'))
207
- assert_equal('.', Recls.canonicalise_path('dir.14/dir.2/../..'))
208
- assert_equal('..', Recls.canonicalise_path('dir.14/dir.2/../../..'))
203
+ assert_equal('/dir.14/', Recls.canonicalise_path('/dir.14/dir.2/..'))
204
+ assert_equal('/', Recls.canonicalise_path('/dir.14/dir.2/../..'))
205
+ assert_equal('/', Recls.canonicalise_path('/dir.14/dir.2/../../..'))
206
+ assert_equal('dir.14/', Recls.canonicalise_path('dir.14/dir.2/..'))
207
+ assert_equal('.', Recls.canonicalise_path('dir.14/dir.2/../..'))
208
+ assert_equal('..', Recls.canonicalise_path('dir.14/dir.2/../../..'))
209
209
 
210
- if Recls::Ximpl::OS::OS_IS_WINDOWS
210
+ if Recls::Ximpl::OS::OS_IS_WINDOWS
211
211
 
212
- assert_equal('H:\\dir.1\\dir.2\\', Recls.canonicalise_path('H:\\dir.1\\dir.2\\'))
213
- assert_equal('H:\\dir.1\\dir.2\\', Recls.canonicalise_path('H:\\dir.1\\dir.2\\dir.3\\..\\'))
214
- assert_equal('H:\\dir.1\\dir.2\\', Recls.canonicalise_path('H:\\dir.1\\dir.2\\dir.3\\..\\'))
215
- assert_equal('H:\\dir.1\\dir.2\\', Recls.canonicalise_path('H:\\dir.1\\dir.3\\..\\dir.2\\'))
216
- assert_equal('H:\\dir.1\\dir.2\\', Recls.canonicalise_path('H:\\dir.3\\..\\dir.1\\dir.2\\'))
212
+ assert_equal('H:\\dir.1\\dir.2\\', Recls.canonicalise_path('H:\\dir.1\\dir.2\\'))
213
+ assert_equal('H:\\dir.1\\dir.2\\', Recls.canonicalise_path('H:\\dir.1\\dir.2\\dir.3\\..\\'))
214
+ assert_equal('H:\\dir.1\\dir.2\\', Recls.canonicalise_path('H:\\dir.1\\dir.2\\dir.3\\..\\'))
215
+ assert_equal('H:\\dir.1\\dir.2\\', Recls.canonicalise_path('H:\\dir.1\\dir.3\\..\\dir.2\\'))
216
+ assert_equal('H:\\dir.1\\dir.2\\', Recls.canonicalise_path('H:\\dir.3\\..\\dir.1\\dir.2\\'))
217
217
 
218
- assert_equal('H:\\dir.43\\dir.5\\', Recls.canonicalise_path('H:\\..\\dir.43\\dir.5\\'))
219
- assert_equal('H:\\dir.42\\', Recls.canonicalise_path('H:\\..\\dir.1\\..\\dir.42\\'))
220
- end
221
- end
218
+ assert_equal('H:\\dir.43\\dir.5\\', Recls.canonicalise_path('H:\\..\\dir.43\\dir.5\\'))
219
+ assert_equal('H:\\dir.42\\', Recls.canonicalise_path('H:\\..\\dir.1\\..\\dir.42\\'))
220
+ end
221
+ end
222
222
 
223
- def test_complex_examples
223
+ def test_complex_examples
224
224
 
225
- assert_equal('../dir.11/dir.22/dir.33/file3.', Recls.canonicalise_path('abc/.././././.././dir.1/../dir.11/dir.22/dir.33/file3.'))
226
- assert_equal('/dir.11/dir.22/dir.33/file3.', Recls.canonicalise_path('/abc/.././././.././dir.1/../dir.11/dir.22/dir.33/file3.'))
227
- assert_equal('../dir.11/dir.22/dir.33/file3.', Recls.canonicalise_path('./././abc/.././././.././dir.1/../dir.11/dir.22/././dir.33/././file3.'))
225
+ assert_equal('../dir.11/dir.22/dir.33/file3.', Recls.canonicalise_path('abc/.././././.././dir.1/../dir.11/dir.22/dir.33/file3.'))
226
+ assert_equal('/dir.11/dir.22/dir.33/file3.', Recls.canonicalise_path('/abc/.././././.././dir.1/../dir.11/dir.22/dir.33/file3.'))
227
+ assert_equal('../dir.11/dir.22/dir.33/file3.', Recls.canonicalise_path('./././abc/.././././.././dir.1/../dir.11/dir.22/././dir.33/././file3.'))
228
228
 
229
- if Recls::Ximpl::OS::OS_IS_WINDOWS
229
+ if Recls::Ximpl::OS::OS_IS_WINDOWS
230
230
 
231
- end
232
- end
231
+ end
232
+ end
233
233
  end
234
234
 
235
- # ############################## end of file ############################# #
236
235
 
236
+ # ############################## end of file ############################# #
237
237