libpath-ruby 0.2.2 → 0.2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +33 -0
- data/README.md +25 -8
- data/examples/path_from_arg0.md +43 -43
- data/examples/path_from_arg0.rb +25 -23
- data/lib/libpath/constants/unix.rb +74 -74
- data/lib/libpath/constants/windows.rb +75 -75
- data/lib/libpath/constants.rb +20 -20
- data/lib/libpath/diagnostics/parameter_checking.rb +27 -26
- data/lib/libpath/diagnostics.rb +1 -1
- data/lib/libpath/exceptions/libpath_base_exception.rb +20 -21
- data/lib/libpath/exceptions/malformed_name_exception.rb +27 -27
- data/lib/libpath/exceptions.rb +1 -1
- data/lib/libpath/form/unix.rb +118 -118
- data/lib/libpath/form/windows.rb +228 -214
- data/lib/libpath/form.rb +20 -21
- data/lib/libpath/internal_/array.rb +57 -57
- data/lib/libpath/internal_/platform.rb +30 -31
- data/lib/libpath/internal_/string.rb +25 -20
- data/lib/libpath/internal_/unix/form.rb +124 -119
- data/lib/libpath/internal_/windows/drive.rb +80 -75
- data/lib/libpath/internal_/windows/form.rb +205 -194
- data/lib/libpath/libpath.rb +4 -1
- data/lib/libpath/path/unix.rb +120 -118
- data/lib/libpath/path/windows.rb +126 -124
- data/lib/libpath/path.rb +21 -21
- data/lib/libpath/util/unix.rb +261 -261
- data/lib/libpath/util/windows.rb +403 -403
- data/lib/libpath/util.rb +20 -20
- data/lib/libpath/version.rb +25 -26
- data/lib/libpath.rb +1 -1
- data/test/performance/benchmark_drive_letter.rb +50 -10
- data/test/performance/benchmark_gsub_string_or_regex.rb +27 -23
- data/test/performance/benchmark_rindex2.rb +56 -48
- data/test/performance/benchmark_split.rb +16 -10
- data/test/unit/compare/ts_all.rb +4 -4
- data/test/unit/equate/ts_all.rb +4 -4
- data/test/unit/equate/unix/ts_all.rb +4 -4
- data/test/unit/equate/windows/ts_all.rb +4 -4
- data/test/unit/exceptions/tc_libpath_base_exception.rb +10 -8
- data/test/unit/exceptions/tc_malformed_name_exception.rb +14 -12
- data/test/unit/exceptions/ts_all.rb +4 -4
- data/test/unit/form/tc_absolute_functions.rb +242 -240
- data/test/unit/form/ts_all.rb +4 -4
- data/test/unit/form/unix/tc_absolute_functions.rb +158 -155
- data/test/unit/form/unix/ts_all.rb +4 -4
- data/test/unit/form/windows/tc_absolute_functions.rb +628 -625
- data/test/unit/form/windows/ts_all.rb +4 -4
- data/test/unit/internal_/tc_array.rb +36 -32
- data/test/unit/internal_/ts_all.rb +4 -4
- data/test/unit/internal_/unix/form/tc_slash_functions.rb +38 -35
- data/test/unit/internal_/unix/form/ts_all.rb +4 -4
- data/test/unit/internal_/unix/tc_split_path.rb +387 -384
- data/test/unit/internal_/unix/ts_all.rb +4 -4
- data/test/unit/internal_/windows/form/tc_get_windows_volume.rb +157 -153
- data/test/unit/internal_/windows/form/tc_slash_functions.rb +39 -35
- data/test/unit/internal_/windows/form/ts_all.rb +4 -4
- data/test/unit/internal_/windows/tc_split_path.rb +874 -869
- data/test/unit/internal_/windows/ts_all.rb +4 -4
- data/test/unit/parse/ts_all.rb +4 -4
- data/test/unit/path/tc_path.rb +732 -732
- data/test/unit/path/ts_all.rb +4 -4
- data/test/unit/path/unix/tc_path.rb +544 -540
- data/test/unit/path/unix/ts_all.rb +4 -4
- data/test/unit/path/windows/tc_path.rb +608 -603
- data/test/unit/path/windows/ts_all.rb +4 -4
- data/test/unit/tc_version.rb +25 -22
- data/test/unit/ts_all.rb +4 -4
- data/test/unit/util/tc_combine_paths.rb +110 -105
- data/test/unit/util/tc_derive_relative_path.rb +8 -3
- data/test/unit/util/tc_make_path_canonical.rb +142 -138
- data/test/unit/util/ts_all.rb +4 -4
- data/test/unit/util/unix/tc_combine_paths.rb +38 -34
- data/test/unit/util/unix/tc_derive_relative_path.rb +80 -75
- data/test/unit/util/unix/tc_make_path_absolute.rb +74 -70
- data/test/unit/util/unix/tc_make_path_canonical.rb +95 -90
- data/test/unit/util/unix/ts_all.rb +4 -4
- data/test/unit/util/windows/tc_combine_paths.rb +82 -77
- data/test/unit/util/windows/tc_derive_relative_path.rb +98 -93
- data/test/unit/util/windows/tc_make_path_absolute.rb +105 -101
- data/test/unit/util/windows/tc_make_path_canonical.rb +158 -153
- data/test/unit/util/windows/ts_all.rb +4 -4
- metadata +9 -8
@@ -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
|
-
|
10
|
+
$stderr.puts "requiring file '#{file}'" if $DEBUG
|
11
11
|
|
12
|
-
|
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
|
-
|
18
|
+
$stderr.puts "requiring file '#{file}'" if $DEBUG
|
19
19
|
|
20
|
-
|
20
|
+
require file
|
21
21
|
end
|
22
22
|
|
@@ -12,358 +12,360 @@ require 'libpath/internal_/platform'
|
|
12
12
|
|
13
13
|
class Test_existence_of_namespace_LibPath_Form < Test::Unit::TestCase
|
14
14
|
|
15
|
-
|
15
|
+
def test_LibPath_module_exists
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
assert defined?(::LibPath)
|
18
|
+
end
|
19
19
|
|
20
|
-
|
20
|
+
def test_LibPath_Form_module_exists
|
21
21
|
|
22
|
-
|
23
|
-
|
22
|
+
assert defined?(::LibPath::Form)
|
23
|
+
end
|
24
24
|
end
|
25
25
|
|
26
26
|
class Test_path_is_absolute < Test::Unit::TestCase
|
27
27
|
|
28
|
-
|
28
|
+
include ::LibPath::Form
|
29
29
|
|
30
|
-
|
30
|
+
if $DEBUG
|
31
31
|
|
32
|
-
|
32
|
+
def test_with_nil
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
assert_raise(::ArgumentError) { path_is_absolute?(nil) }
|
35
|
+
end
|
36
|
+
end
|
37
37
|
|
38
|
-
|
38
|
+
def test_empty
|
39
39
|
|
40
|
-
|
41
|
-
|
40
|
+
assert_false path_is_absolute?('')
|
41
|
+
end
|
42
42
|
|
43
|
-
|
43
|
+
if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
|
44
44
|
|
45
|
-
|
45
|
+
def test_absolute_paths_from_UNC
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
assert_false path_is_absolute?('\\\\')
|
48
|
+
assert_false path_is_absolute?('\\\\server')
|
49
|
+
assert_false path_is_absolute?('\\\\server\\')
|
50
|
+
assert_false path_is_absolute?('\\\\server\\share')
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
52
|
+
assert path_is_absolute?('\\\\server\\the-share_name\\')
|
53
|
+
assert path_is_absolute?('\\\\server\\the-share_name\\\\')
|
54
|
+
assert path_is_absolute?('\\\\server\\the-share_name\\dir')
|
55
|
+
assert path_is_absolute?('\\\\server\\the-share_name\\dir\\')
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
57
|
+
assert path_is_absolute?('\\\\101.2.303.4\\the-share_name\\')
|
58
|
+
assert path_is_absolute?('\\\\101.2.303.4\\the-share_name\\\\')
|
59
|
+
assert path_is_absolute?('\\\\101.2.303.4\\the-share_name\\dir')
|
60
|
+
assert path_is_absolute?('\\\\101.2.303.4\\the-share_name\\dir\\')
|
61
61
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
62
|
+
assert path_is_absolute?('\\\\::1/128\\the-share_name\\')
|
63
|
+
assert path_is_absolute?('\\\\::1/128\\the-share_name\\\\')
|
64
|
+
assert path_is_absolute?('\\\\::1/128\\the-share_name\\dir')
|
65
|
+
assert path_is_absolute?('\\\\::1/128\\the-share_name\\dir\\')
|
66
|
+
end
|
67
|
+
end
|
68
68
|
|
69
|
-
|
69
|
+
if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
|
70
70
|
|
71
|
-
|
71
|
+
def test_absolute_paths_from_drive
|
72
72
|
|
73
|
-
|
74
|
-
|
75
|
-
|
73
|
+
assert path_is_absolute?('C:\\')
|
74
|
+
assert path_is_absolute?('C:\\abc')
|
75
|
+
assert path_is_absolute?('C:\\abc\\')
|
76
76
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
77
|
+
assert_false path_is_absolute?('C:')
|
78
|
+
assert_false path_is_absolute?('C:abc')
|
79
|
+
assert_false path_is_absolute?('C:abc\\')
|
80
|
+
end
|
81
|
+
end
|
82
82
|
|
83
|
-
|
83
|
+
def test_absolute_paths_from_root
|
84
84
|
|
85
|
-
|
85
|
+
if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
|
86
86
|
|
87
|
-
|
88
|
-
|
89
|
-
|
87
|
+
assert_false path_is_absolute?('\\')
|
88
|
+
assert_false path_is_absolute?('\\\\')
|
89
|
+
assert_false path_is_absolute?('\\abc')
|
90
90
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
91
|
+
assert_false path_is_absolute?('/')
|
92
|
+
assert_false path_is_absolute?('//')
|
93
|
+
assert_false path_is_absolute?('/abc')
|
94
|
+
else
|
95
95
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
96
|
+
assert path_is_absolute?('/')
|
97
|
+
assert path_is_absolute?('//')
|
98
|
+
assert path_is_absolute?('/abc')
|
99
|
+
end
|
100
|
+
end
|
101
101
|
|
102
|
-
|
102
|
+
def test_absolute_paths_from_home
|
103
103
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
104
|
+
assert path_is_absolute?('~')
|
105
|
+
assert path_is_absolute?('~/')
|
106
|
+
assert path_is_absolute?('~/abc')
|
107
|
+
end
|
108
108
|
|
109
|
-
|
109
|
+
def test_relative_paths
|
110
110
|
|
111
|
-
|
112
|
-
|
113
|
-
|
111
|
+
assert_false path_is_absolute?('abc')
|
112
|
+
assert_false path_is_absolute?('abc/')
|
113
|
+
assert_false path_is_absolute?('a/')
|
114
114
|
|
115
|
-
|
116
|
-
|
115
|
+
assert_false path_is_absolute?('~abc')
|
116
|
+
end
|
117
117
|
end
|
118
118
|
|
119
119
|
class Test_path_is_homed < Test::Unit::TestCase
|
120
120
|
|
121
|
-
|
121
|
+
include ::LibPath::Form
|
122
122
|
|
123
|
-
|
123
|
+
if $DEBUG
|
124
124
|
|
125
|
-
|
125
|
+
def test_with_nil
|
126
126
|
|
127
|
-
|
128
|
-
|
129
|
-
|
127
|
+
assert_raise(::ArgumentError) { path_is_homed?(nil) }
|
128
|
+
end
|
129
|
+
end
|
130
130
|
|
131
|
-
|
131
|
+
def test_empty
|
132
132
|
|
133
|
-
|
134
|
-
|
133
|
+
assert_false path_is_homed?('')
|
134
|
+
end
|
135
135
|
|
136
|
-
|
136
|
+
if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
|
137
137
|
|
138
|
-
|
138
|
+
def test_absolute_paths_from_UNC
|
139
139
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
140
|
+
assert_false path_is_homed?('\\\\')
|
141
|
+
assert_false path_is_homed?('\\\\server')
|
142
|
+
assert_false path_is_homed?('\\\\server\\')
|
143
|
+
assert_false path_is_homed?('\\\\server\\share')
|
144
144
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
145
|
+
assert_false path_is_homed?('\\\\server\\the-share_name\\')
|
146
|
+
assert_false path_is_homed?('\\\\server\\the-share_name\\\\')
|
147
|
+
assert_false path_is_homed?('\\\\server\\the-share_name\\dir')
|
148
|
+
assert_false path_is_homed?('\\\\server\\the-share_name\\dir\\')
|
149
149
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
150
|
+
assert_false path_is_homed?('\\\\101.2.303.4\\the-share_name\\')
|
151
|
+
assert_false path_is_homed?('\\\\101.2.303.4\\the-share_name\\\\')
|
152
|
+
assert_false path_is_homed?('\\\\101.2.303.4\\the-share_name\\dir')
|
153
|
+
assert_false path_is_homed?('\\\\101.2.303.4\\the-share_name\\dir\\')
|
154
154
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
155
|
+
assert_false path_is_homed?('\\\\::1/128\\the-share_name\\')
|
156
|
+
assert_false path_is_homed?('\\\\::1/128\\the-share_name\\\\')
|
157
|
+
assert_false path_is_homed?('\\\\::1/128\\the-share_name\\dir')
|
158
|
+
assert_false path_is_homed?('\\\\::1/128\\the-share_name\\dir\\')
|
159
|
+
end
|
160
|
+
end
|
161
161
|
|
162
|
-
|
162
|
+
if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
|
163
163
|
|
164
|
-
|
164
|
+
def test_absolute_paths_from_drive
|
165
165
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
166
|
+
assert_false path_is_homed?('C:\\')
|
167
|
+
assert_false path_is_homed?('C:\\abc')
|
168
|
+
assert_false path_is_homed?('C:\\abc\\')
|
169
|
+
end
|
170
|
+
end
|
171
171
|
|
172
|
-
|
172
|
+
def test_absolute_paths_from_root
|
173
173
|
|
174
|
-
|
174
|
+
if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
|
175
175
|
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
176
|
+
assert_false path_is_homed?('\\')
|
177
|
+
assert_false path_is_homed?('\\\\')
|
178
|
+
assert_false path_is_homed?('\\abc')
|
179
|
+
end
|
180
180
|
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
181
|
+
assert_false path_is_homed?('/')
|
182
|
+
assert_false path_is_homed?('//')
|
183
|
+
assert_false path_is_homed?('/abc')
|
184
|
+
end
|
185
185
|
|
186
|
-
|
186
|
+
def test_absolute_paths_from_home
|
187
187
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
188
|
+
assert path_is_homed?('~')
|
189
|
+
assert path_is_homed?('~/')
|
190
|
+
assert path_is_homed?('~/abc')
|
191
|
+
end
|
192
192
|
|
193
|
-
|
193
|
+
def test_relative_paths
|
194
194
|
|
195
|
-
|
196
|
-
|
197
|
-
|
195
|
+
assert_false path_is_homed?('abc')
|
196
|
+
assert_false path_is_homed?('abc/')
|
197
|
+
assert_false path_is_homed?('a/')
|
198
198
|
|
199
|
-
|
200
|
-
|
199
|
+
assert_false path_is_homed?('~abc')
|
200
|
+
end
|
201
201
|
end
|
202
202
|
|
203
203
|
class Test_path_is_rooteds < Test::Unit::TestCase
|
204
204
|
|
205
|
-
|
205
|
+
include ::LibPath::Form
|
206
206
|
|
207
|
-
|
207
|
+
if $DEBUG
|
208
208
|
|
209
|
-
|
209
|
+
def test_with_nil
|
210
210
|
|
211
|
-
|
212
|
-
|
213
|
-
|
211
|
+
assert_raise(::ArgumentError) { path_is_rooted?(nil) }
|
212
|
+
end
|
213
|
+
end
|
214
214
|
|
215
|
-
|
215
|
+
def test_empty
|
216
216
|
|
217
|
-
|
218
|
-
|
217
|
+
assert_false path_is_rooted?('')
|
218
|
+
end
|
219
219
|
|
220
|
-
|
220
|
+
if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
|
221
221
|
|
222
|
-
|
222
|
+
def test_absolute_paths_from_UNC
|
223
223
|
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
224
|
+
assert_false path_is_rooted?('\\\\')
|
225
|
+
assert_false path_is_rooted?('\\\\server')
|
226
|
+
assert_false path_is_rooted?('\\\\server\\')
|
227
|
+
assert_false path_is_rooted?('\\\\server\\share')
|
228
228
|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
229
|
+
assert path_is_rooted?('\\\\server\\the-share_name\\')
|
230
|
+
assert path_is_rooted?('\\\\server\\the-share_name\\\\')
|
231
|
+
assert path_is_rooted?('\\\\server\\the-share_name\\dir')
|
232
|
+
assert path_is_rooted?('\\\\server\\the-share_name\\dir\\')
|
233
233
|
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
234
|
+
assert path_is_rooted?('\\\\101.2.303.4\\the-share_name\\')
|
235
|
+
assert path_is_rooted?('\\\\101.2.303.4\\the-share_name\\\\')
|
236
|
+
assert path_is_rooted?('\\\\101.2.303.4\\the-share_name\\dir')
|
237
|
+
assert path_is_rooted?('\\\\101.2.303.4\\the-share_name\\dir\\')
|
238
238
|
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
239
|
+
assert path_is_rooted?('\\\\::1/128\\the-share_name\\')
|
240
|
+
assert path_is_rooted?('\\\\::1/128\\the-share_name\\\\')
|
241
|
+
assert path_is_rooted?('\\\\::1/128\\the-share_name\\dir')
|
242
|
+
assert path_is_rooted?('\\\\::1/128\\the-share_name\\dir\\')
|
243
|
+
end
|
244
|
+
end
|
245
245
|
|
246
|
-
|
246
|
+
if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
|
247
247
|
|
248
|
-
|
248
|
+
def test_absolute_paths_from_drive
|
249
249
|
|
250
|
-
|
251
|
-
|
252
|
-
|
250
|
+
assert path_is_rooted?('C:\\')
|
251
|
+
assert path_is_rooted?('C:\\abc')
|
252
|
+
assert path_is_rooted?('C:\\abc\\')
|
253
253
|
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
254
|
+
assert_false path_is_rooted?('C:')
|
255
|
+
assert_false path_is_rooted?('C:abc')
|
256
|
+
assert_false path_is_rooted?('C:abc\\')
|
257
|
+
end
|
258
|
+
end
|
259
259
|
|
260
|
-
|
260
|
+
def test_absolute_paths_from_root
|
261
261
|
|
262
|
-
|
262
|
+
if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
|
263
263
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
264
|
+
assert path_is_rooted?('\\')
|
265
|
+
assert_false path_is_rooted?('\\\\')
|
266
|
+
assert path_is_rooted?('\\abc')
|
267
|
+
end
|
268
268
|
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
269
|
+
assert path_is_rooted?('/')
|
270
|
+
assert path_is_rooted?('//')
|
271
|
+
assert path_is_rooted?('/abc')
|
272
|
+
end
|
273
273
|
|
274
|
-
|
274
|
+
def test_absolute_paths_from_home
|
275
275
|
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
276
|
+
assert_false path_is_rooted?('~')
|
277
|
+
assert_false path_is_rooted?('~/')
|
278
|
+
assert_false path_is_rooted?('~/abc')
|
279
|
+
end
|
280
280
|
|
281
|
-
|
281
|
+
def test_relative_paths
|
282
282
|
|
283
|
-
|
284
|
-
|
285
|
-
|
283
|
+
assert_false path_is_rooted?('abc')
|
284
|
+
assert_false path_is_rooted?('abc/')
|
285
|
+
assert_false path_is_rooted?('a/')
|
286
286
|
|
287
|
-
|
288
|
-
|
287
|
+
assert_false path_is_rooted?('~abc')
|
288
|
+
end
|
289
289
|
end
|
290
290
|
|
291
291
|
if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
|
292
292
|
|
293
|
-
|
293
|
+
class Test_path_is_UNCs < Test::Unit::TestCase
|
294
294
|
|
295
|
-
|
295
|
+
include ::LibPath::Form
|
296
296
|
|
297
|
-
|
297
|
+
if $DEBUG
|
298
298
|
|
299
|
-
|
299
|
+
def test_with_nil
|
300
300
|
|
301
|
-
|
302
|
-
|
303
|
-
|
301
|
+
assert_raise(::ArgumentError) { path_is_UNC?(nil) }
|
302
|
+
end
|
303
|
+
end
|
304
304
|
|
305
|
-
|
305
|
+
def test_empty
|
306
306
|
|
307
|
-
|
308
|
-
|
307
|
+
assert_false path_is_UNC?('')
|
308
|
+
end
|
309
309
|
|
310
|
-
|
310
|
+
def test_absolute_paths_from_drive
|
311
311
|
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
312
|
+
assert_false path_is_UNC?('C:\\')
|
313
|
+
assert_false path_is_UNC?('C:\\\\')
|
314
|
+
assert_false path_is_UNC?('C:\\abc\\')
|
315
|
+
end
|
316
316
|
|
317
|
-
|
317
|
+
def test_absolute_paths_from_UNC
|
318
318
|
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
319
|
+
assert_false path_is_UNC?('\\\\')
|
320
|
+
assert_false path_is_UNC?('\\\\server')
|
321
|
+
assert_false path_is_UNC?('\\\\server\\')
|
322
|
+
assert path_is_UNC?('\\\\server\\share')
|
323
323
|
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
324
|
+
assert path_is_UNC?('\\\\server\\the-share_name\\')
|
325
|
+
assert path_is_UNC?('\\\\server\\the-share_name\\\\')
|
326
|
+
assert path_is_UNC?('\\\\server\\the-share_name\\dir')
|
327
|
+
assert path_is_UNC?('\\\\server\\the-share_name\\dir\\')
|
328
328
|
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
329
|
+
assert path_is_UNC?('\\\\101.2.303.4\\the-share_name\\')
|
330
|
+
assert path_is_UNC?('\\\\101.2.303.4\\the-share_name\\\\')
|
331
|
+
assert path_is_UNC?('\\\\101.2.303.4\\the-share_name\\dir')
|
332
|
+
assert path_is_UNC?('\\\\101.2.303.4\\the-share_name\\dir\\')
|
333
333
|
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
334
|
+
assert path_is_UNC?('\\\\::1/128\\the-share_name\\')
|
335
|
+
assert path_is_UNC?('\\\\::1/128\\the-share_name\\\\')
|
336
|
+
assert path_is_UNC?('\\\\::1/128\\the-share_name\\dir')
|
337
|
+
assert path_is_UNC?('\\\\::1/128\\the-share_name\\dir\\')
|
338
|
+
end
|
339
339
|
|
340
|
-
|
340
|
+
def test_absolute_paths_from_root
|
341
341
|
|
342
|
-
|
343
|
-
|
344
|
-
|
342
|
+
assert_false path_is_UNC?('\\')
|
343
|
+
assert_false path_is_UNC?('\\\\')
|
344
|
+
assert_false path_is_UNC?('\\abc')
|
345
345
|
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
346
|
+
assert_false path_is_UNC?('/')
|
347
|
+
assert_false path_is_UNC?('//')
|
348
|
+
assert_false path_is_UNC?('/abc')
|
349
|
+
end
|
350
350
|
|
351
|
-
|
351
|
+
def test_absolute_paths_from_home
|
352
352
|
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
353
|
+
assert_false path_is_UNC?('~')
|
354
|
+
assert_false path_is_UNC?('~/')
|
355
|
+
assert_false path_is_UNC?('~/abc')
|
356
|
+
end
|
357
357
|
|
358
|
-
|
358
|
+
def test_relative_paths
|
359
359
|
|
360
|
-
|
361
|
-
|
362
|
-
|
360
|
+
assert_false path_is_UNC?('abc')
|
361
|
+
assert_false path_is_UNC?('abc/')
|
362
|
+
assert_false path_is_UNC?('a/')
|
363
363
|
|
364
|
-
|
365
|
-
|
366
|
-
|
364
|
+
assert_false path_is_UNC?('~abc')
|
365
|
+
end
|
366
|
+
end
|
367
367
|
end
|
368
368
|
|
369
369
|
|
370
|
+
# ############################## end of file ############################# #
|
371
|
+
|
data/test/unit/form/ts_all.rb
CHANGED
@@ -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
|
-
|
10
|
+
$stderr.puts "requiring file '#{file}'" if $DEBUG
|
11
11
|
|
12
|
-
|
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
|
-
|
18
|
+
$stderr.puts "requiring file '#{file}'" if $DEBUG
|
19
19
|
|
20
|
-
|
20
|
+
require file
|
21
21
|
end
|
22
22
|
|