libpath-ruby 0.2.2 → 0.2.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +33 -0
  3. data/README.md +25 -8
  4. data/examples/path_from_arg0.md +43 -43
  5. data/examples/path_from_arg0.rb +25 -23
  6. data/lib/libpath/constants/unix.rb +71 -71
  7. data/lib/libpath/constants/windows.rb +72 -72
  8. data/lib/libpath/constants.rb +18 -19
  9. data/lib/libpath/diagnostics/parameter_checking.rb +25 -25
  10. data/lib/libpath/diagnostics.rb +1 -1
  11. data/lib/libpath/exceptions/libpath_base_exception.rb +13 -13
  12. data/lib/libpath/exceptions/malformed_name_exception.rb +23 -22
  13. data/lib/libpath/exceptions.rb +1 -1
  14. data/lib/libpath/form/unix.rb +104 -103
  15. data/lib/libpath/form/windows.rb +200 -199
  16. data/lib/libpath/form.rb +18 -18
  17. data/lib/libpath/internal_/array.rb +53 -53
  18. data/lib/libpath/internal_/platform.rb +24 -24
  19. data/lib/libpath/internal_/string.rb +18 -18
  20. data/lib/libpath/internal_/unix/form.rb +116 -116
  21. data/lib/libpath/internal_/windows/drive.rb +59 -59
  22. data/lib/libpath/internal_/windows/form.rb +189 -189
  23. data/lib/libpath/libpath.rb +3 -0
  24. data/lib/libpath/path/unix.rb +114 -112
  25. data/lib/libpath/path/windows.rb +120 -118
  26. data/lib/libpath/path.rb +18 -20
  27. data/lib/libpath/util/unix.rb +258 -258
  28. data/lib/libpath/util/windows.rb +400 -400
  29. data/lib/libpath/util.rb +18 -19
  30. data/lib/libpath/version.rb +23 -24
  31. data/lib/libpath.rb +1 -1
  32. data/test/performance/benchmark_drive_letter.rb +50 -10
  33. data/test/performance/benchmark_gsub_string_or_regex.rb +27 -23
  34. data/test/performance/benchmark_rindex2.rb +56 -48
  35. data/test/performance/benchmark_split.rb +16 -10
  36. data/test/unit/compare/ts_all.rb +4 -4
  37. data/test/unit/equate/ts_all.rb +4 -4
  38. data/test/unit/equate/unix/ts_all.rb +4 -4
  39. data/test/unit/equate/windows/ts_all.rb +4 -4
  40. data/test/unit/exceptions/tc_libpath_base_exception.rb +10 -8
  41. data/test/unit/exceptions/tc_malformed_name_exception.rb +14 -12
  42. data/test/unit/exceptions/ts_all.rb +4 -4
  43. data/test/unit/form/tc_absolute_functions.rb +242 -240
  44. data/test/unit/form/ts_all.rb +4 -4
  45. data/test/unit/form/unix/tc_absolute_functions.rb +158 -155
  46. data/test/unit/form/unix/ts_all.rb +4 -4
  47. data/test/unit/form/windows/tc_absolute_functions.rb +628 -625
  48. data/test/unit/form/windows/ts_all.rb +4 -4
  49. data/test/unit/internal_/tc_array.rb +36 -32
  50. data/test/unit/internal_/ts_all.rb +4 -4
  51. data/test/unit/internal_/unix/form/tc_slash_functions.rb +38 -35
  52. data/test/unit/internal_/unix/form/ts_all.rb +4 -4
  53. data/test/unit/internal_/unix/tc_split_path.rb +387 -384
  54. data/test/unit/internal_/unix/ts_all.rb +4 -4
  55. data/test/unit/internal_/windows/form/tc_get_windows_volume.rb +157 -153
  56. data/test/unit/internal_/windows/form/tc_slash_functions.rb +39 -35
  57. data/test/unit/internal_/windows/form/ts_all.rb +4 -4
  58. data/test/unit/internal_/windows/tc_split_path.rb +874 -869
  59. data/test/unit/internal_/windows/ts_all.rb +4 -4
  60. data/test/unit/parse/ts_all.rb +4 -4
  61. data/test/unit/path/tc_path.rb +732 -732
  62. data/test/unit/path/ts_all.rb +4 -4
  63. data/test/unit/path/unix/tc_path.rb +544 -540
  64. data/test/unit/path/unix/ts_all.rb +4 -4
  65. data/test/unit/path/windows/tc_path.rb +608 -603
  66. data/test/unit/path/windows/ts_all.rb +4 -4
  67. data/test/unit/tc_version.rb +25 -22
  68. data/test/unit/ts_all.rb +4 -4
  69. data/test/unit/util/tc_combine_paths.rb +110 -105
  70. data/test/unit/util/tc_derive_relative_path.rb +8 -3
  71. data/test/unit/util/tc_make_path_canonical.rb +142 -138
  72. data/test/unit/util/ts_all.rb +4 -4
  73. data/test/unit/util/unix/tc_combine_paths.rb +38 -34
  74. data/test/unit/util/unix/tc_derive_relative_path.rb +80 -75
  75. data/test/unit/util/unix/tc_make_path_absolute.rb +74 -70
  76. data/test/unit/util/unix/tc_make_path_canonical.rb +95 -90
  77. data/test/unit/util/unix/ts_all.rb +4 -4
  78. data/test/unit/util/windows/tc_combine_paths.rb +82 -77
  79. data/test/unit/util/windows/tc_derive_relative_path.rb +98 -93
  80. data/test/unit/util/windows/tc_make_path_absolute.rb +105 -101
  81. data/test/unit/util/windows/tc_make_path_canonical.rb +158 -153
  82. data/test/unit/util/windows/ts_all.rb +4 -4
  83. metadata +9 -8
@@ -2,219 +2,224 @@
2
2
 
3
3
  $:.unshift File.join(File.dirname(__FILE__), *(['..'] * 4), 'lib')
4
4
 
5
+
5
6
  require 'libpath/util/windows'
6
7
 
7
8
  require 'test/unit'
8
9
 
10
+
9
11
  class Test_LibPath_Util_Windows_make_path_canonical < Test::Unit::TestCase
10
12
 
11
- F = ::LibPath::Util::Windows
13
+ F = ::LibPath::Util::Windows
12
14
 
13
- def test_empty
15
+ def test_empty
14
16
 
15
- assert_equal '', F.make_path_canonical('')
16
- end
17
+ assert_equal '', F.make_path_canonical('')
18
+ end
17
19
 
18
- def test_one_dot
20
+ def test_one_dot
19
21
 
20
- assert_equal '.\\', F.make_path_canonical('.')
21
- assert_equal './', F.make_path_canonical('./')
22
- assert_equal './', F.make_path_canonical('./.')
23
- assert_equal './', F.make_path_canonical('./.')
24
- assert_equal './', F.make_path_canonical('././')
25
- assert_equal './', F.make_path_canonical('././.')
26
- assert_equal './', F.make_path_canonical('./././')
22
+ assert_equal '.\\', F.make_path_canonical('.')
23
+ assert_equal './', F.make_path_canonical('./')
24
+ assert_equal './', F.make_path_canonical('./.')
25
+ assert_equal './', F.make_path_canonical('./.')
26
+ assert_equal './', F.make_path_canonical('././')
27
+ assert_equal './', F.make_path_canonical('././.')
28
+ assert_equal './', F.make_path_canonical('./././')
27
29
 
28
- assert_equal '.\\', F.make_path_canonical('.', make_slashes_canonical: true)
29
- assert_equal '.\\', F.make_path_canonical('./', make_slashes_canonical: true)
30
- assert_equal '.\\', F.make_path_canonical('./.', make_slashes_canonical: true)
31
- assert_equal '.\\', F.make_path_canonical('./.', make_slashes_canonical: true)
32
- assert_equal '.\\', F.make_path_canonical('././', make_slashes_canonical: true)
33
- assert_equal '.\\', F.make_path_canonical('././.', make_slashes_canonical: true)
34
- assert_equal '.\\', F.make_path_canonical('./././', make_slashes_canonical: true)
30
+ assert_equal '.\\', F.make_path_canonical('.', make_slashes_canonical: true)
31
+ assert_equal '.\\', F.make_path_canonical('./', make_slashes_canonical: true)
32
+ assert_equal '.\\', F.make_path_canonical('./.', make_slashes_canonical: true)
33
+ assert_equal '.\\', F.make_path_canonical('./.', make_slashes_canonical: true)
34
+ assert_equal '.\\', F.make_path_canonical('././', make_slashes_canonical: true)
35
+ assert_equal '.\\', F.make_path_canonical('././.', make_slashes_canonical: true)
36
+ assert_equal '.\\', F.make_path_canonical('./././', make_slashes_canonical: true)
35
37
 
36
- assert_equal '.\\', F.make_path_canonical('.')
37
- assert_equal '.\\', F.make_path_canonical('.\\')
38
- assert_equal '.\\', F.make_path_canonical('.\\.')
39
- assert_equal '.\\', F.make_path_canonical('.\\.')
40
- assert_equal '.\\', F.make_path_canonical('.\\.\\')
41
- assert_equal '.\\', F.make_path_canonical('.\\.\\.')
42
- assert_equal '.\\', F.make_path_canonical('.\\.\\.\\')
38
+ assert_equal '.\\', F.make_path_canonical('.')
39
+ assert_equal '.\\', F.make_path_canonical('.\\')
40
+ assert_equal '.\\', F.make_path_canonical('.\\.')
41
+ assert_equal '.\\', F.make_path_canonical('.\\.')
42
+ assert_equal '.\\', F.make_path_canonical('.\\.\\')
43
+ assert_equal '.\\', F.make_path_canonical('.\\.\\.')
44
+ assert_equal '.\\', F.make_path_canonical('.\\.\\.\\')
43
45
 
44
- assert_equal './', F.make_path_canonical('.///./.')
45
- assert_equal '.\\', F.make_path_canonical('.\\\\\\.\\.')
46
- assert_equal './', F.make_path_canonical('./\\/./.')
46
+ assert_equal './', F.make_path_canonical('.///./.')
47
+ assert_equal '.\\', F.make_path_canonical('.\\\\\\.\\.')
48
+ assert_equal './', F.make_path_canonical('./\\/./.')
47
49
 
48
- assert_equal 'C:.\\', F.make_path_canonical('C:.')
49
- end
50
+ assert_equal 'C:.\\', F.make_path_canonical('C:.')
51
+ end
50
52
 
51
- def test_two_dots
53
+ def test_two_dots
52
54
 
53
- assert_equal '..\\', F.make_path_canonical('..')
54
- assert_equal '../', F.make_path_canonical('../')
55
- assert_equal '..\\', F.make_path_canonical('..\\')
56
- assert_equal '../', F.make_path_canonical('../.')
57
- assert_equal '..\\', F.make_path_canonical('..\\.')
58
- assert_equal '../', F.make_path_canonical('.././')
59
- assert_equal '..\\', F.make_path_canonical('..\\.\\')
60
- assert_equal '../', F.make_path_canonical('.././.')
61
- assert_equal '..\\', F.make_path_canonical('..\\.\\.')
55
+ assert_equal '..\\', F.make_path_canonical('..')
56
+ assert_equal '../', F.make_path_canonical('../')
57
+ assert_equal '..\\', F.make_path_canonical('..\\')
58
+ assert_equal '../', F.make_path_canonical('../.')
59
+ assert_equal '..\\', F.make_path_canonical('..\\.')
60
+ assert_equal '../', F.make_path_canonical('.././')
61
+ assert_equal '..\\', F.make_path_canonical('..\\.\\')
62
+ assert_equal '../', F.make_path_canonical('.././.')
63
+ assert_equal '..\\', F.make_path_canonical('..\\.\\.')
62
64
 
63
- assert_equal '..\\', F.make_path_canonical('..', make_slashes_canonical: true)
64
- assert_equal '..\\', F.make_path_canonical('../', make_slashes_canonical: true)
65
- assert_equal '..\\', F.make_path_canonical('../.', make_slashes_canonical: true)
66
- assert_equal '..\\', F.make_path_canonical('.././', make_slashes_canonical: true)
67
- assert_equal '..\\', F.make_path_canonical('.././.', make_slashes_canonical: true)
65
+ assert_equal '..\\', F.make_path_canonical('..', make_slashes_canonical: true)
66
+ assert_equal '..\\', F.make_path_canonical('../', make_slashes_canonical: true)
67
+ assert_equal '..\\', F.make_path_canonical('../.', make_slashes_canonical: true)
68
+ assert_equal '..\\', F.make_path_canonical('.././', make_slashes_canonical: true)
69
+ assert_equal '..\\', F.make_path_canonical('.././.', make_slashes_canonical: true)
68
70
 
69
- assert_equal '..\\', F.make_path_canonical('..')
70
- assert_equal '..\\', F.make_path_canonical('..\\')
71
- assert_equal '..\\', F.make_path_canonical('..\\.')
72
- assert_equal '..\\', F.make_path_canonical('..\\.\\')
73
- assert_equal '..\\', F.make_path_canonical('..\\.\\.')
71
+ assert_equal '..\\', F.make_path_canonical('..')
72
+ assert_equal '..\\', F.make_path_canonical('..\\')
73
+ assert_equal '..\\', F.make_path_canonical('..\\.')
74
+ assert_equal '..\\', F.make_path_canonical('..\\.\\')
75
+ assert_equal '..\\', F.make_path_canonical('..\\.\\.')
74
76
 
75
- assert_equal 'C:..\\', F.make_path_canonical('C:..')
76
- end
77
+ assert_equal 'C:..\\', F.make_path_canonical('C:..')
78
+ end
77
79
 
78
- def test_unresolveable
80
+ def test_unresolveable
79
81
 
80
- assert_equal 'C:..\\', F.make_path_canonical('C:..')
81
- assert_equal 'C:..\\', F.make_path_canonical('C:..\\')
82
+ assert_equal 'C:..\\', F.make_path_canonical('C:..')
83
+ assert_equal 'C:..\\', F.make_path_canonical('C:..\\')
82
84
 
83
- assert_equal '..\\', F.make_path_canonical('..')
84
- assert_equal '../', F.make_path_canonical('../')
85
+ assert_equal '..\\', F.make_path_canonical('..')
86
+ assert_equal '../', F.make_path_canonical('../')
85
87
 
86
- assert_equal '../dir-1', F.make_path_canonical('../dir-1')
87
- assert_equal '../dir-1/', F.make_path_canonical('../dir-1/')
88
+ assert_equal '../dir-1', F.make_path_canonical('../dir-1')
89
+ assert_equal '../dir-1/', F.make_path_canonical('../dir-1/')
88
90
 
89
- assert_equal '../..\\', F.make_path_canonical('../..')
90
- assert_equal '../../', F.make_path_canonical('../../')
91
+ assert_equal '../..\\', F.make_path_canonical('../..')
92
+ assert_equal '../../', F.make_path_canonical('../../')
91
93
 
92
- assert_equal '../../dir-1', F.make_path_canonical('../../dir-1')
93
- assert_equal '../../dir-1/', F.make_path_canonical('../../dir-1/')
94
- end
94
+ assert_equal '../../dir-1', F.make_path_canonical('../../dir-1')
95
+ assert_equal '../../dir-1/', F.make_path_canonical('../../dir-1/')
96
+ end
95
97
 
96
- def test_partially_resolveable
98
+ def test_partially_resolveable
97
99
 
98
- assert_equal '../', F.make_path_canonical('../dir-1/..')
99
- assert_equal '../', F.make_path_canonical('../dir-1/../')
100
+ assert_equal '../', F.make_path_canonical('../dir-1/..')
101
+ assert_equal '../', F.make_path_canonical('../dir-1/../')
100
102
 
101
- assert_equal '../abc', F.make_path_canonical('../dir-1/../abc')
102
- assert_equal '../abc/', F.make_path_canonical('../dir-1/../abc/')
103
+ assert_equal '../abc', F.make_path_canonical('../dir-1/../abc')
104
+ assert_equal '../abc/', F.make_path_canonical('../dir-1/../abc/')
103
105
 
104
- assert_equal '../../', F.make_path_canonical('../../dir-1/..')
105
- assert_equal '../../', F.make_path_canonical('../../dir-1/../')
106
+ assert_equal '../../', F.make_path_canonical('../../dir-1/..')
107
+ assert_equal '../../', F.make_path_canonical('../../dir-1/../')
106
108
 
107
- assert_equal '../../abc', F.make_path_canonical('../../dir-1/../abc')
108
- assert_equal '../../abc/', F.make_path_canonical('../../dir-1/../abc/')
109
+ assert_equal '../../abc', F.make_path_canonical('../../dir-1/../abc')
110
+ assert_equal '../../abc/', F.make_path_canonical('../../dir-1/../abc/')
109
111
 
110
- assert_equal '\\dir.14\\', F.make_path_canonical('\\dir.14\\dir.2\\..')
111
- assert_equal 'dir.14\\', F.make_path_canonical('dir.14\\dir.2\\..')
112
+ assert_equal '\\dir.14\\', F.make_path_canonical('\\dir.14\\dir.2\\..')
113
+ assert_equal 'dir.14\\', F.make_path_canonical('dir.14\\dir.2\\..')
112
114
 
113
- assert_equal '/dir.14/', F.make_path_canonical('/dir.14/dir.2/..')
114
- assert_equal 'dir.14/', F.make_path_canonical('dir.14/dir.2/..')
115
+ assert_equal '/dir.14/', F.make_path_canonical('/dir.14/dir.2/..')
116
+ assert_equal 'dir.14/', F.make_path_canonical('dir.14/dir.2/..')
115
117
 
116
- assert_equal '\\', F.make_path_canonical('\\dir.14\\dir.2\\..\\..')
117
- assert_equal '\\', F.make_path_canonical('\\dir.14\\dir.2\\..\\..\\..')
118
- assert_equal '.\\', F.make_path_canonical('dir.14\\dir.2\\..\\..')
118
+ assert_equal '\\', F.make_path_canonical('\\dir.14\\dir.2\\..\\..')
119
+ assert_equal '\\', F.make_path_canonical('\\dir.14\\dir.2\\..\\..\\..')
120
+ assert_equal '.\\', F.make_path_canonical('dir.14\\dir.2\\..\\..')
119
121
 
120
- assert_equal '/', F.make_path_canonical('/dir.14/dir.2/../..')
121
- assert_equal '/', F.make_path_canonical('/dir.14/dir.2/../../..')
122
- assert_equal '.\\', F.make_path_canonical('dir.14/dir.2/../..')
123
- end
122
+ assert_equal '/', F.make_path_canonical('/dir.14/dir.2/../..')
123
+ assert_equal '/', F.make_path_canonical('/dir.14/dir.2/../../..')
124
+ assert_equal '.\\', F.make_path_canonical('dir.14/dir.2/../..')
125
+ end
124
126
 
125
- def test_basenames
127
+ def test_basenames
126
128
 
127
- assert_equal 'a', F.make_path_canonical('a')
129
+ assert_equal 'a', F.make_path_canonical('a')
128
130
 
129
- assert_equal 'file.ext', F.make_path_canonical('file.ext')
131
+ assert_equal 'file.ext', F.make_path_canonical('file.ext')
130
132
 
131
- assert_equal '..\\', F.make_path_canonical('..')
132
- end
133
+ assert_equal '..\\', F.make_path_canonical('..')
134
+ end
133
135
 
134
- def test_no_dots
136
+ def test_no_dots
135
137
 
136
- assert_equal 'abc/def', F.make_path_canonical('abc/def')
137
- assert_equal 'abc\\def', F.make_path_canonical('abc/def', make_slashes_canonical: true)
138
- assert_equal 'abc\\def', F.make_path_canonical('abc//def')
139
- end
138
+ assert_equal 'abc/def', F.make_path_canonical('abc/def')
139
+ assert_equal 'abc\\def', F.make_path_canonical('abc/def', make_slashes_canonical: true)
140
+ assert_equal 'abc\\def', F.make_path_canonical('abc//def')
141
+ end
140
142
 
141
- def test_one_dots_directories
143
+ def test_one_dots_directories
142
144
 
143
- assert_equal 'abc', F.make_path_canonical('./abc')
144
- assert_equal 'abc', F.make_path_canonical('.\\abc')
145
+ assert_equal 'abc', F.make_path_canonical('./abc')
146
+ assert_equal 'abc', F.make_path_canonical('.\\abc')
145
147
 
146
- assert_equal 'c:abc', F.make_path_canonical('c:./abc')
147
- assert_equal 'c:abc', F.make_path_canonical('c:.\\abc')
148
+ assert_equal 'c:abc', F.make_path_canonical('c:./abc')
149
+ assert_equal 'c:abc', F.make_path_canonical('c:.\\abc')
148
150
 
149
151
 
150
- assert_equal 'abc', F.make_path_canonical('././abc')
151
- assert_equal 'abc', F.make_path_canonical('.\\./abc')
152
- assert_equal 'abc', F.make_path_canonical('.\\.\\abc')
152
+ assert_equal 'abc', F.make_path_canonical('././abc')
153
+ assert_equal 'abc', F.make_path_canonical('.\\./abc')
154
+ assert_equal 'abc', F.make_path_canonical('.\\.\\abc')
153
155
 
154
- assert_equal 'abc', F.make_path_canonical('./././././././././abc')
156
+ assert_equal 'abc', F.make_path_canonical('./././././././././abc')
155
157
 
156
- assert_equal 'abc/', F.make_path_canonical('abc/./')
157
- assert_equal 'abc\\', F.make_path_canonical('abc\\.\\')
158
- assert_equal 'abc/', F.make_path_canonical('abc/.\\')
158
+ assert_equal 'abc/', F.make_path_canonical('abc/./')
159
+ assert_equal 'abc\\', F.make_path_canonical('abc\\.\\')
160
+ assert_equal 'abc/', F.make_path_canonical('abc/.\\')
159
161
 
160
- assert_equal 'abc/', F.make_path_canonical('./abc/./')
161
- assert_equal 'abc\\', F.make_path_canonical('./abc/./', make_slashes_canonical: true)
162
- assert_equal 'abc/', F.make_path_canonical('./abc/.')
163
- assert_equal 'abc\\', F.make_path_canonical('./abc/.', make_slashes_canonical: true)
164
- end
162
+ assert_equal 'abc/', F.make_path_canonical('./abc/./')
163
+ assert_equal 'abc\\', F.make_path_canonical('./abc/./', make_slashes_canonical: true)
164
+ assert_equal 'abc/', F.make_path_canonical('./abc/.')
165
+ assert_equal 'abc\\', F.make_path_canonical('./abc/.', make_slashes_canonical: true)
166
+ end
165
167
 
166
- def test_two_dots_directories
168
+ def test_two_dots_directories
167
169
 
168
- assert_equal '../', F.make_path_canonical('../')
169
- assert_equal '..\\', F.make_path_canonical('..\\')
170
+ assert_equal '../', F.make_path_canonical('../')
171
+ assert_equal '..\\', F.make_path_canonical('..\\')
170
172
 
171
- assert_equal '../abc', F.make_path_canonical('../abc')
172
- assert_equal '..\\abc', F.make_path_canonical('..\\abc')
173
+ assert_equal '../abc', F.make_path_canonical('../abc')
174
+ assert_equal '..\\abc', F.make_path_canonical('..\\abc')
173
175
 
174
- assert_equal '.\\', F.make_path_canonical('abc/..')
175
- assert_equal '.\\', F.make_path_canonical('abc\\..')
176
+ assert_equal '.\\', F.make_path_canonical('abc/..')
177
+ assert_equal '.\\', F.make_path_canonical('abc\\..')
176
178
 
177
- assert_equal './', F.make_path_canonical('abc/../')
178
- assert_equal '.\\', F.make_path_canonical('abc\\..\\')
179
+ assert_equal './', F.make_path_canonical('abc/../')
180
+ assert_equal '.\\', F.make_path_canonical('abc\\..\\')
179
181
 
180
- assert_equal 'def', F.make_path_canonical('abc/../def')
181
- assert_equal 'def', F.make_path_canonical('abc\\..\\def')
182
+ assert_equal 'def', F.make_path_canonical('abc/../def')
183
+ assert_equal 'def', F.make_path_canonical('abc\\..\\def')
182
184
 
183
- assert_equal '.\\', F.make_path_canonical('abc/../def/..')
184
- assert_equal '.\\', F.make_path_canonical('abc\\..\\def\\..')
185
+ assert_equal '.\\', F.make_path_canonical('abc/../def/..')
186
+ assert_equal '.\\', F.make_path_canonical('abc\\..\\def\\..')
185
187
 
186
- assert_equal './', F.make_path_canonical('abc/../def/../')
187
- assert_equal '.\\', F.make_path_canonical('abc\\../def/..\\')
188
- assert_equal './', F.make_path_canonical('abc\\../def/../')
188
+ assert_equal './', F.make_path_canonical('abc/../def/../')
189
+ assert_equal '.\\', F.make_path_canonical('abc\\../def/..\\')
190
+ assert_equal './', F.make_path_canonical('abc\\../def/../')
189
191
 
190
- assert_equal '../dir-2/', F.make_path_canonical('../dir-1/../dir-2/')
191
- assert_equal '..\\dir-2/', F.make_path_canonical('..\\dir-1\\../dir-2/')
192
- assert_equal '../dir-2/', F.make_path_canonical('../dir-1\\..\\dir-2/')
193
- assert_equal '../dir-2\\', F.make_path_canonical('../dir-1/../dir-2\\')
194
- assert_equal '..\\dir-2\\', F.make_path_canonical('..\\dir-1/../dir-2\\')
195
- assert_equal '..\\dir-2\\', F.make_path_canonical('..\\dir-1\\..\\dir-2\\')
192
+ assert_equal '../dir-2/', F.make_path_canonical('../dir-1/../dir-2/')
193
+ assert_equal '..\\dir-2/', F.make_path_canonical('..\\dir-1\\../dir-2/')
194
+ assert_equal '../dir-2/', F.make_path_canonical('../dir-1\\..\\dir-2/')
195
+ assert_equal '../dir-2\\', F.make_path_canonical('../dir-1/../dir-2\\')
196
+ assert_equal '..\\dir-2\\', F.make_path_canonical('..\\dir-1/../dir-2\\')
197
+ assert_equal '..\\dir-2\\', F.make_path_canonical('..\\dir-1\\..\\dir-2\\')
196
198
 
197
- assert_equal '/', F.make_path_canonical('/abc/../def/../')
198
- assert_equal '/', F.make_path_canonical('/abc\\../def/..\\')
199
- assert_equal '/', F.make_path_canonical('/abc\\../def/../')
199
+ assert_equal '/', F.make_path_canonical('/abc/../def/../')
200
+ assert_equal '/', F.make_path_canonical('/abc\\../def/..\\')
201
+ assert_equal '/', F.make_path_canonical('/abc\\../def/../')
200
202
 
201
- assert_equal '\\', F.make_path_canonical('/abc/../def/../', make_slashes_canonical: true)
202
- assert_equal '\\', F.make_path_canonical('/abc\\../def/..\\', make_slashes_canonical: true)
203
- assert_equal '\\', F.make_path_canonical('/abc\\../def/../', make_slashes_canonical: true)
203
+ assert_equal '\\', F.make_path_canonical('/abc/../def/../', make_slashes_canonical: true)
204
+ assert_equal '\\', F.make_path_canonical('/abc\\../def/..\\', make_slashes_canonical: true)
205
+ assert_equal '\\', F.make_path_canonical('/abc\\../def/../', make_slashes_canonical: true)
204
206
 
205
- assert_equal '\\', F.make_path_canonical('\\abc/../def/../')
206
- assert_equal '\\', F.make_path_canonical('\\abc\\../def/..\\')
207
- assert_equal '\\', F.make_path_canonical('\\abc\\../def/../')
207
+ assert_equal '\\', F.make_path_canonical('\\abc/../def/../')
208
+ assert_equal '\\', F.make_path_canonical('\\abc\\../def/..\\')
209
+ assert_equal '\\', F.make_path_canonical('\\abc\\../def/../')
208
210
 
209
- assert_equal '../dir-2/', F.make_path_canonical('../dir-1/../dir-2/')
210
- assert_equal '../dir-2', F.make_path_canonical('../dir-1/../dir-2')
211
- assert_equal '/dir-2', F.make_path_canonical('/../dir-1/../dir-2')
212
- assert_equal '/', F.make_path_canonical('/..')
213
- assert_equal 'C:../dir-2/', F.make_path_canonical('C:../dir-1/../dir-2/')
214
- assert_equal 'C:../dir-2', F.make_path_canonical('C:../dir-1/../dir-2')
215
- assert_equal 'C:/dir-2', F.make_path_canonical('C:/../dir-1/../dir-2')
216
- assert_equal 'C:/', F.make_path_canonical('C:/../')
217
- assert_equal 'C:/', F.make_path_canonical('C:/..')
218
- end
211
+ assert_equal '../dir-2/', F.make_path_canonical('../dir-1/../dir-2/')
212
+ assert_equal '../dir-2', F.make_path_canonical('../dir-1/../dir-2')
213
+ assert_equal '/dir-2', F.make_path_canonical('/../dir-1/../dir-2')
214
+ assert_equal '/', F.make_path_canonical('/..')
215
+ assert_equal 'C:../dir-2/', F.make_path_canonical('C:../dir-1/../dir-2/')
216
+ assert_equal 'C:../dir-2', F.make_path_canonical('C:../dir-1/../dir-2')
217
+ assert_equal 'C:/dir-2', F.make_path_canonical('C:/../dir-1/../dir-2')
218
+ assert_equal 'C:/', F.make_path_canonical('C:/../')
219
+ assert_equal 'C:/', F.make_path_canonical('C:/..')
220
+ end
219
221
  end
220
222
 
223
+
224
+ # ############################## end of file ############################# #
225
+
@@ -7,16 +7,16 @@ this_dir = File.expand_path(File.dirname(__FILE__))
7
7
  # all tc_*rb in current directory
8
8
  Dir[File.join(this_dir, 'tc_*rb')].each do |file|
9
9
 
10
- $stderr.puts "requiring file '#{file}'" if $DEBUG
10
+ $stderr.puts "requiring file '#{file}'" if $DEBUG
11
11
 
12
- require file
12
+ require file
13
13
  end
14
14
 
15
15
  # all ts_*rb in immediate sub-directories
16
16
  Dir[File.join(this_dir, '*', 'ts_*rb')].each do |file|
17
17
 
18
- $stderr.puts "requiring file '#{file}'" if $DEBUG
18
+ $stderr.puts "requiring file '#{file}'" if $DEBUG
19
19
 
20
- require file
20
+ require file
21
21
  end
22
22
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libpath-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Wilson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-18 00:00:00.000000000 Z
11
+ date: 2024-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xqsr3
@@ -32,12 +32,13 @@ dependencies:
32
32
  version: '1.0'
33
33
  description: 'Path parsing library for Ruby
34
34
 
35
- '
35
+ '
36
36
  email: matthew@synesis.com.au
37
37
  executables: []
38
38
  extensions: []
39
39
  extra_rdoc_files: []
40
40
  files:
41
+ - LICENSE
41
42
  - README.md
42
43
  - examples/path_from_arg0.md
43
44
  - examples/path_from_arg0.rb
@@ -122,13 +123,13 @@ homepage: http://github.com/synesissoftware/libpath.Ruby
122
123
  licenses:
123
124
  - BSD-3-Clause
124
125
  metadata: {}
125
- post_install_message:
126
+ post_install_message:
126
127
  rdoc_options: []
127
128
  require_paths:
128
129
  - lib
129
130
  required_ruby_version: !ruby/object:Gem::Requirement
130
131
  requirements:
131
- - - "~>"
132
+ - - ">="
132
133
  - !ruby/object:Gem::Version
133
134
  version: '2.0'
134
135
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -137,8 +138,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
138
  - !ruby/object:Gem::Version
138
139
  version: '0'
139
140
  requirements: []
140
- rubygems_version: 3.0.1
141
- signing_key:
141
+ rubygems_version: 3.3.7
142
+ signing_key:
142
143
  specification_version: 4
143
144
  summary: libpath.Ruby
144
145
  test_files: []