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.
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 +74 -74
  7. data/lib/libpath/constants/windows.rb +75 -75
  8. data/lib/libpath/constants.rb +20 -20
  9. data/lib/libpath/diagnostics/parameter_checking.rb +27 -26
  10. data/lib/libpath/diagnostics.rb +1 -1
  11. data/lib/libpath/exceptions/libpath_base_exception.rb +20 -21
  12. data/lib/libpath/exceptions/malformed_name_exception.rb +27 -27
  13. data/lib/libpath/exceptions.rb +1 -1
  14. data/lib/libpath/form/unix.rb +118 -118
  15. data/lib/libpath/form/windows.rb +228 -214
  16. data/lib/libpath/form.rb +20 -21
  17. data/lib/libpath/internal_/array.rb +57 -57
  18. data/lib/libpath/internal_/platform.rb +30 -31
  19. data/lib/libpath/internal_/string.rb +25 -20
  20. data/lib/libpath/internal_/unix/form.rb +124 -119
  21. data/lib/libpath/internal_/windows/drive.rb +80 -75
  22. data/lib/libpath/internal_/windows/form.rb +205 -194
  23. data/lib/libpath/libpath.rb +4 -1
  24. data/lib/libpath/path/unix.rb +120 -118
  25. data/lib/libpath/path/windows.rb +126 -124
  26. data/lib/libpath/path.rb +21 -21
  27. data/lib/libpath/util/unix.rb +261 -261
  28. data/lib/libpath/util/windows.rb +403 -403
  29. data/lib/libpath/util.rb +20 -20
  30. data/lib/libpath/version.rb +25 -26
  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
@@ -10,845 +10,848 @@ require 'xqsr3/extensions/test/unit'
10
10
 
11
11
  class Test_existence_of_namespace_LibPath_Form_Windows < Test::Unit::TestCase
12
12
 
13
- def test_LibPath_module_exists
13
+ def test_LibPath_module_exists
14
14
 
15
- assert defined?(::LibPath)
16
- end
15
+ assert defined?(::LibPath)
16
+ end
17
17
 
18
- def test_LibPath_Form_module_exists
18
+ def test_LibPath_Form_module_exists
19
19
 
20
- assert defined?(::LibPath::Form)
21
- end
20
+ assert defined?(::LibPath::Form)
21
+ end
22
22
 
23
- def test_LibPath_Form_Windows_module_exists
23
+ def test_LibPath_Form_Windows_module_exists
24
24
 
25
- assert defined?(::LibPath::Form::Windows)
26
- end
25
+ assert defined?(::LibPath::Form::Windows)
26
+ end
27
27
  end
28
28
 
29
29
  class Test_classify_path_Windows < Test::Unit::TestCase
30
30
 
31
- include ::LibPath::Form::Windows
31
+ include ::LibPath::Form::Windows
32
32
 
33
- def test_with_nil
33
+ def test_with_nil
34
34
 
35
- if $DEBUG
35
+ if $DEBUG
36
36
 
37
- assert_raise(::ArgumentError) { classify_path(nil) }
38
- else
37
+ assert_raise(::ArgumentError) { classify_path(nil) }
38
+ else
39
39
 
40
- assert_nil classify_path(nil)
41
- end
42
- end
40
+ assert_nil classify_path(nil)
41
+ end
42
+ end
43
43
 
44
- def test_empty
44
+ def test_empty
45
45
 
46
- assert_nil classify_path('')
47
- end
46
+ assert_nil classify_path('')
47
+ end
48
48
 
49
- def test_drived
49
+ def test_drived
50
50
 
51
- assert_equal :drived, classify_path('C:abc')
52
- assert_equal :drived, classify_path('C:abc/')
53
- assert_equal :drived, classify_path('C:abc\\')
51
+ assert_equal :drived, classify_path('C:abc')
52
+ assert_equal :drived, classify_path('C:abc/')
53
+ assert_equal :drived, classify_path('C:abc\\')
54
54
 
55
- assert_equal :drived, classify_path('\\\\?\\C:abc')
56
- assert_equal :drived, classify_path('\\\\?\\C:abc/')
57
- assert_equal :drived, classify_path('\\\\?\\C:abc\\')
55
+ assert_equal :drived, classify_path('\\\\?\\C:abc')
56
+ assert_equal :drived, classify_path('\\\\?\\C:abc/')
57
+ assert_equal :drived, classify_path('\\\\?\\C:abc\\')
58
58
 
59
- assert_equal :drived, classify_path('\\\\server\\share')
59
+ assert_equal :drived, classify_path('\\\\server\\share')
60
60
 
61
- assert_equal :drived, classify_path('\\\\?\\server\\share')
62
- end
61
+ assert_equal :drived, classify_path('\\\\?\\server\\share')
62
+ end
63
63
 
64
- def test_absolute
64
+ def test_absolute
65
65
 
66
- assert_equal :absolute, classify_path('C:/')
67
- assert_equal :absolute, classify_path('C:\\')
66
+ assert_equal :absolute, classify_path('C:/')
67
+ assert_equal :absolute, classify_path('C:\\')
68
68
 
69
- assert_equal :absolute, classify_path('C:/abc')
70
- assert_equal :absolute, classify_path('C:\\abc')
69
+ assert_equal :absolute, classify_path('C:/abc')
70
+ assert_equal :absolute, classify_path('C:\\abc')
71
71
 
72
72
 
73
- assert_equal :absolute, classify_path('\\\\server\\share/')
74
- assert_equal :absolute, classify_path('\\\\server\\share\\')
73
+ assert_equal :absolute, classify_path('\\\\server\\share/')
74
+ assert_equal :absolute, classify_path('\\\\server\\share\\')
75
75
 
76
- assert_equal :absolute, classify_path('\\\\server\\share/abc')
77
- assert_equal :absolute, classify_path('\\\\server\\share\\abc')
76
+ assert_equal :absolute, classify_path('\\\\server\\share/abc')
77
+ assert_equal :absolute, classify_path('\\\\server\\share\\abc')
78
78
 
79
79
 
80
- assert_equal :absolute, classify_path('\\\\?\\C:/')
81
- assert_equal :absolute, classify_path('\\\\?\\C:\\')
80
+ assert_equal :absolute, classify_path('\\\\?\\C:/')
81
+ assert_equal :absolute, classify_path('\\\\?\\C:\\')
82
82
 
83
- assert_equal :absolute, classify_path('\\\\?\\C:/abc')
84
- assert_equal :absolute, classify_path('\\\\?\\C:\\abc')
83
+ assert_equal :absolute, classify_path('\\\\?\\C:/abc')
84
+ assert_equal :absolute, classify_path('\\\\?\\C:\\abc')
85
85
 
86
86
 
87
- assert_equal :absolute, classify_path('\\\\?\\server\\share/')
88
- assert_equal :absolute, classify_path('\\\\?\\server\\share\\')
87
+ assert_equal :absolute, classify_path('\\\\?\\server\\share/')
88
+ assert_equal :absolute, classify_path('\\\\?\\server\\share\\')
89
89
 
90
- assert_equal :absolute, classify_path('\\\\?\\server\\share/abc')
91
- assert_equal :absolute, classify_path('\\\\?\\server\\share\\abc')
90
+ assert_equal :absolute, classify_path('\\\\?\\server\\share/abc')
91
+ assert_equal :absolute, classify_path('\\\\?\\server\\share\\abc')
92
92
 
93
93
 
94
- assert_equal :absolute, classify_path('\\\\?\\UNC\\server\\share/')
95
- assert_equal :absolute, classify_path('\\\\?\\UNC\\server\\share\\')
94
+ assert_equal :absolute, classify_path('\\\\?\\UNC\\server\\share/')
95
+ assert_equal :absolute, classify_path('\\\\?\\UNC\\server\\share\\')
96
96
 
97
- assert_equal :absolute, classify_path('\\\\?\\UNC\\server\\share/abc')
98
- assert_equal :absolute, classify_path('\\\\?\\UNC\\server\\share\\abc')
99
- end
97
+ assert_equal :absolute, classify_path('\\\\?\\UNC\\server\\share/abc')
98
+ assert_equal :absolute, classify_path('\\\\?\\UNC\\server\\share\\abc')
99
+ end
100
100
 
101
- def test_rooted
101
+ def test_rooted
102
102
 
103
- assert_equal :rooted, classify_path('/')
104
- assert_equal :rooted, classify_path('\\')
103
+ assert_equal :rooted, classify_path('/')
104
+ assert_equal :rooted, classify_path('\\')
105
105
 
106
- assert_equal :rooted, classify_path('/abc')
107
- assert_equal :rooted, classify_path('\\abc')
108
- end
106
+ assert_equal :rooted, classify_path('/abc')
107
+ assert_equal :rooted, classify_path('\\abc')
108
+ end
109
109
 
110
- def test_homed
110
+ def test_homed
111
111
 
112
- assert_equal :homed, classify_path('~')
112
+ assert_equal :homed, classify_path('~')
113
113
 
114
- assert_equal :homed, classify_path('~/')
115
- assert_equal :homed, classify_path('~\\')
114
+ assert_equal :homed, classify_path('~/')
115
+ assert_equal :homed, classify_path('~\\')
116
116
 
117
- assert_equal :homed, classify_path('~/abc')
118
- assert_equal :homed, classify_path('~\\abc')
119
- end
117
+ assert_equal :homed, classify_path('~/abc')
118
+ assert_equal :homed, classify_path('~\\abc')
119
+ end
120
120
 
121
- def test_relative
121
+ def test_relative
122
122
 
123
- assert_equal :relative, classify_path('abc')
123
+ assert_equal :relative, classify_path('abc')
124
124
 
125
- assert_equal :relative, classify_path('~~')
126
- end
125
+ assert_equal :relative, classify_path('~~')
126
+ end
127
127
  end
128
128
 
129
129
  class Test_name_is_malformed_Windows < Test::Unit::TestCase
130
130
 
131
- include ::LibPath::Form::Windows
131
+ include ::LibPath::Form::Windows
132
132
 
133
- def test_with_nil
133
+ def test_with_nil
134
134
 
135
- assert name_is_malformed?(nil)
136
- end
135
+ assert name_is_malformed?(nil)
136
+ end
137
137
 
138
- def test_empty
138
+ def test_empty
139
139
 
140
- assert_false name_is_malformed?('')
141
- end
140
+ assert_false name_is_malformed?('')
141
+ end
142
142
 
143
- def test_absolute_paths_from_root
143
+ def test_absolute_paths_from_root
144
144
 
145
- assert_false name_is_malformed?('/')
146
- assert_false name_is_malformed?('//')
147
- assert_false name_is_malformed?('/abc')
148
- end
145
+ assert_false name_is_malformed?('/')
146
+ assert_false name_is_malformed?('//')
147
+ assert_false name_is_malformed?('/abc')
148
+ end
149
149
 
150
- def test_absolute_paths_from_home
150
+ def test_absolute_paths_from_home
151
151
 
152
- assert_false name_is_malformed?('~')
153
- assert_false name_is_malformed?('~/')
154
- assert_false name_is_malformed?('~/abc')
155
- end
152
+ assert_false name_is_malformed?('~')
153
+ assert_false name_is_malformed?('~/')
154
+ assert_false name_is_malformed?('~/abc')
155
+ end
156
156
 
157
- def test_relative_paths
157
+ def test_relative_paths
158
158
 
159
- assert_false name_is_malformed?('abc')
160
- assert_false name_is_malformed?('abc/')
161
- assert_false name_is_malformed?('a/')
159
+ assert_false name_is_malformed?('abc')
160
+ assert_false name_is_malformed?('abc/')
161
+ assert_false name_is_malformed?('a/')
162
162
 
163
- assert_false name_is_malformed?('~abc')
164
- end
163
+ assert_false name_is_malformed?('~abc')
164
+ end
165
165
 
166
- def test_innate_invalid_characters
166
+ def test_innate_invalid_characters
167
167
 
168
- assert name_is_malformed?("\0")
169
- assert name_is_malformed?("a\0")
170
- assert name_is_malformed?("\0a")
168
+ assert name_is_malformed?("\0")
169
+ assert name_is_malformed?("a\0")
170
+ assert name_is_malformed?("\0a")
171
171
 
172
- assert name_is_malformed?("\0", reject_shell_characters: true)
173
- assert name_is_malformed?("a\0", reject_shell_characters: true)
174
- assert name_is_malformed?("\0a", reject_shell_characters: true)
175
- end
172
+ assert name_is_malformed?("\0", reject_shell_characters: true)
173
+ assert name_is_malformed?("a\0", reject_shell_characters: true)
174
+ assert name_is_malformed?("\0a", reject_shell_characters: true)
175
+ end
176
176
 
177
- def test_shell_invalid_characters
177
+ def test_shell_invalid_characters
178
178
 
179
- assert_false name_is_malformed?('*')
180
- assert_false name_is_malformed?('?')
181
- assert_false name_is_malformed?('|')
179
+ assert_false name_is_malformed?('*')
180
+ assert_false name_is_malformed?('?')
181
+ assert_false name_is_malformed?('|')
182
182
 
183
- assert name_is_malformed?('*', reject_shell_characters: true)
184
- assert name_is_malformed?('?', reject_shell_characters: true)
185
- assert name_is_malformed?('|', reject_shell_characters: true)
186
- end
183
+ assert name_is_malformed?('*', reject_shell_characters: true)
184
+ assert name_is_malformed?('?', reject_shell_characters: true)
185
+ assert name_is_malformed?('|', reject_shell_characters: true)
186
+ end
187
187
 
188
- def test_path_name_separators
188
+ def test_path_name_separators
189
189
 
190
- assert_false name_is_malformed?('/')
191
- assert_false name_is_malformed?('\\')
190
+ assert_false name_is_malformed?('/')
191
+ assert_false name_is_malformed?('\\')
192
192
 
193
- assert name_is_malformed?('/', reject_path_name_separators: true)
194
- assert name_is_malformed?('\\', reject_path_name_separators: true)
195
- end
193
+ assert name_is_malformed?('/', reject_path_name_separators: true)
194
+ assert name_is_malformed?('\\', reject_path_name_separators: true)
195
+ end
196
196
 
197
- def test_path_separators
197
+ def test_path_separators
198
198
 
199
- assert_false name_is_malformed?(';')
199
+ assert_false name_is_malformed?(';')
200
200
 
201
- assert name_is_malformed?(';', reject_path_separators: true)
202
- end
201
+ assert name_is_malformed?(';', reject_path_separators: true)
202
+ end
203
203
 
204
- def test_partial_UNC
204
+ def test_partial_UNC
205
205
 
206
- assert_false name_is_malformed?('\\')
207
- assert name_is_malformed?('\\\\')
208
- assert name_is_malformed?('\\\\server')
209
- assert name_is_malformed?('\\\\server\\')
210
- assert_false name_is_malformed?('\\\\server\\share')
211
- end
206
+ assert_false name_is_malformed?('\\')
207
+ assert name_is_malformed?('\\\\')
208
+ assert name_is_malformed?('\\\\server')
209
+ assert name_is_malformed?('\\\\server\\')
210
+ assert_false name_is_malformed?('\\\\server\\share')
211
+ end
212
212
  end
213
213
 
214
214
  class Test_path_is_absolute_Windows < Test::Unit::TestCase
215
215
 
216
- include ::LibPath::Form::Windows
216
+ include ::LibPath::Form::Windows
217
217
 
218
- if $DEBUG
218
+ if $DEBUG
219
219
 
220
- def test_with_nil
220
+ def test_with_nil
221
221
 
222
- assert_raise(::ArgumentError) { path_is_absolute?(nil) }
223
- end
224
- end
222
+ assert_raise(::ArgumentError) { path_is_absolute?(nil) }
223
+ end
224
+ end
225
225
 
226
- def test_empty
226
+ def test_empty
227
227
 
228
- assert_false path_is_absolute?('')
229
- end
228
+ assert_false path_is_absolute?('')
229
+ end
230
230
 
231
- def test_absolute_paths_from_UNC
231
+ def test_absolute_paths_from_UNC
232
232
 
233
- assert_false path_is_absolute?('\\\\')
233
+ assert_false path_is_absolute?('\\\\')
234
234
 
235
- assert_false path_is_absolute?('\\\\server')
236
- assert_false path_is_absolute?('\\\\server\\')
235
+ assert_false path_is_absolute?('\\\\server')
236
+ assert_false path_is_absolute?('\\\\server\\')
237
237
 
238
- # form 2
238
+ # form 2
239
239
 
240
- assert_false path_is_absolute?('\\\\server\\share')
241
- assert path_is_absolute?('\\\\server\\share\\')
242
- assert path_is_absolute?('\\\\server\\share/')
240
+ assert_false path_is_absolute?('\\\\server\\share')
241
+ assert path_is_absolute?('\\\\server\\share\\')
242
+ assert path_is_absolute?('\\\\server\\share/')
243
243
 
244
- assert_false path_is_absolute?('\\\\server\\the-share_name')
245
- assert path_is_absolute?('\\\\server\\the-share_name/')
246
- assert path_is_absolute?('\\\\server\\the-share_name\\')
247
- assert path_is_absolute?('\\\\server\\the-share_name\\\\')
248
- assert path_is_absolute?('\\\\server\\the-share_name\\dir')
249
- assert path_is_absolute?('\\\\server\\the-share_name\\dir\\')
244
+ assert_false path_is_absolute?('\\\\server\\the-share_name')
245
+ assert path_is_absolute?('\\\\server\\the-share_name/')
246
+ assert path_is_absolute?('\\\\server\\the-share_name\\')
247
+ assert path_is_absolute?('\\\\server\\the-share_name\\\\')
248
+ assert path_is_absolute?('\\\\server\\the-share_name\\dir')
249
+ assert path_is_absolute?('\\\\server\\the-share_name\\dir\\')
250
250
 
251
- assert_false path_is_absolute?('\\\\101.2.303.4\\the-share_name')
252
- assert path_is_absolute?('\\\\101.2.303.4\\the-share_name/')
253
- assert path_is_absolute?('\\\\101.2.303.4\\the-share_name\\')
254
- assert path_is_absolute?('\\\\101.2.303.4\\the-share_name\\\\')
255
- assert path_is_absolute?('\\\\101.2.303.4\\the-share_name\\dir')
256
- assert path_is_absolute?('\\\\101.2.303.4\\the-share_name\\dir\\')
251
+ assert_false path_is_absolute?('\\\\101.2.303.4\\the-share_name')
252
+ assert path_is_absolute?('\\\\101.2.303.4\\the-share_name/')
253
+ assert path_is_absolute?('\\\\101.2.303.4\\the-share_name\\')
254
+ assert path_is_absolute?('\\\\101.2.303.4\\the-share_name\\\\')
255
+ assert path_is_absolute?('\\\\101.2.303.4\\the-share_name\\dir')
256
+ assert path_is_absolute?('\\\\101.2.303.4\\the-share_name\\dir\\')
257
257
 
258
- assert_false path_is_absolute?('\\\\::1/128\\the-share_name')
259
- assert path_is_absolute?('\\\\::1/128\\the-share_name/')
260
- assert path_is_absolute?('\\\\::1/128\\the-share_name\\')
261
- assert path_is_absolute?('\\\\::1/128\\the-share_name\\\\')
262
- assert path_is_absolute?('\\\\::1/128\\the-share_name\\dir')
263
- assert path_is_absolute?('\\\\::1/128\\the-share_name\\dir\\')
258
+ assert_false path_is_absolute?('\\\\::1/128\\the-share_name')
259
+ assert path_is_absolute?('\\\\::1/128\\the-share_name/')
260
+ assert path_is_absolute?('\\\\::1/128\\the-share_name\\')
261
+ assert path_is_absolute?('\\\\::1/128\\the-share_name\\\\')
262
+ assert path_is_absolute?('\\\\::1/128\\the-share_name\\dir')
263
+ assert path_is_absolute?('\\\\::1/128\\the-share_name\\dir\\')
264
264
 
265
- # form 4
265
+ # form 4
266
266
 
267
- assert_false path_is_absolute?('\\\\?\\server\\the-share_name')
268
- assert path_is_absolute?('\\\\?\\server\\the-share_name/')
269
- assert path_is_absolute?('\\\\?\\server\\the-share_name\\')
270
- assert path_is_absolute?('\\\\?\\server\\the-share_name\\\\')
271
- assert path_is_absolute?('\\\\?\\server\\the-share_name\\dir')
272
- assert path_is_absolute?('\\\\?\\server\\the-share_name\\dir\\')
267
+ assert_false path_is_absolute?('\\\\?\\server\\the-share_name')
268
+ assert path_is_absolute?('\\\\?\\server\\the-share_name/')
269
+ assert path_is_absolute?('\\\\?\\server\\the-share_name\\')
270
+ assert path_is_absolute?('\\\\?\\server\\the-share_name\\\\')
271
+ assert path_is_absolute?('\\\\?\\server\\the-share_name\\dir')
272
+ assert path_is_absolute?('\\\\?\\server\\the-share_name\\dir\\')
273
273
 
274
- assert_false path_is_absolute?('\\\\?\\101.2.303.4\\the-share_name')
275
- assert path_is_absolute?('\\\\?\\101.2.303.4\\the-share_name/')
276
- assert path_is_absolute?('\\\\?\\101.2.303.4\\the-share_name\\')
277
- assert path_is_absolute?('\\\\?\\101.2.303.4\\the-share_name\\\\')
278
- assert path_is_absolute?('\\\\?\\101.2.303.4\\the-share_name\\dir')
279
- assert path_is_absolute?('\\\\?\\101.2.303.4\\the-share_name\\dir\\')
274
+ assert_false path_is_absolute?('\\\\?\\101.2.303.4\\the-share_name')
275
+ assert path_is_absolute?('\\\\?\\101.2.303.4\\the-share_name/')
276
+ assert path_is_absolute?('\\\\?\\101.2.303.4\\the-share_name\\')
277
+ assert path_is_absolute?('\\\\?\\101.2.303.4\\the-share_name\\\\')
278
+ assert path_is_absolute?('\\\\?\\101.2.303.4\\the-share_name\\dir')
279
+ assert path_is_absolute?('\\\\?\\101.2.303.4\\the-share_name\\dir\\')
280
280
 
281
- assert_false path_is_absolute?('\\\\?\\::1/128\\the-share_name')
282
- assert path_is_absolute?('\\\\?\\::1/128\\the-share_name/')
283
- assert path_is_absolute?('\\\\?\\::1/128\\the-share_name\\')
284
- assert path_is_absolute?('\\\\?\\::1/128\\the-share_name\\\\')
285
- assert path_is_absolute?('\\\\?\\::1/128\\the-share_name\\dir')
286
- assert path_is_absolute?('\\\\?\\::1/128\\the-share_name\\dir\\')
281
+ assert_false path_is_absolute?('\\\\?\\::1/128\\the-share_name')
282
+ assert path_is_absolute?('\\\\?\\::1/128\\the-share_name/')
283
+ assert path_is_absolute?('\\\\?\\::1/128\\the-share_name\\')
284
+ assert path_is_absolute?('\\\\?\\::1/128\\the-share_name\\\\')
285
+ assert path_is_absolute?('\\\\?\\::1/128\\the-share_name\\dir')
286
+ assert path_is_absolute?('\\\\?\\::1/128\\the-share_name\\dir\\')
287
287
 
288
- # form 5
288
+ # form 5
289
289
 
290
- assert_false path_is_absolute?('\\\\?\\UNC\\server\\the-share_name')
291
- assert path_is_absolute?('\\\\?\\UNC\\server\\the-share_name/')
292
- assert path_is_absolute?('\\\\?\\UNC\\server\\the-share_name\\')
293
- assert path_is_absolute?('\\\\?\\UNC\\server\\the-share_name\\\\')
294
- assert path_is_absolute?('\\\\?\\UNC\\server\\the-share_name\\dir')
295
- assert path_is_absolute?('\\\\?\\UNC\\server\\the-share_name\\dir\\')
290
+ assert_false path_is_absolute?('\\\\?\\UNC\\server\\the-share_name')
291
+ assert path_is_absolute?('\\\\?\\UNC\\server\\the-share_name/')
292
+ assert path_is_absolute?('\\\\?\\UNC\\server\\the-share_name\\')
293
+ assert path_is_absolute?('\\\\?\\UNC\\server\\the-share_name\\\\')
294
+ assert path_is_absolute?('\\\\?\\UNC\\server\\the-share_name\\dir')
295
+ assert path_is_absolute?('\\\\?\\UNC\\server\\the-share_name\\dir\\')
296
296
 
297
- assert_false path_is_absolute?('\\\\?\\UNC\\101.2.303.4\\the-share_name')
298
- assert path_is_absolute?('\\\\?\\UNC\\101.2.303.4\\the-share_name/')
299
- assert path_is_absolute?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\')
300
- assert path_is_absolute?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\\\')
301
- assert path_is_absolute?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\dir')
302
- assert path_is_absolute?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\dir\\')
297
+ assert_false path_is_absolute?('\\\\?\\UNC\\101.2.303.4\\the-share_name')
298
+ assert path_is_absolute?('\\\\?\\UNC\\101.2.303.4\\the-share_name/')
299
+ assert path_is_absolute?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\')
300
+ assert path_is_absolute?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\\\')
301
+ assert path_is_absolute?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\dir')
302
+ assert path_is_absolute?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\dir\\')
303
303
 
304
- assert_false path_is_absolute?('\\\\?\\UNC\\::1/128\\the-share_name')
305
- assert path_is_absolute?('\\\\?\\UNC\\::1/128\\the-share_name/')
306
- assert path_is_absolute?('\\\\?\\UNC\\::1/128\\the-share_name\\')
307
- assert path_is_absolute?('\\\\?\\UNC\\::1/128\\the-share_name\\\\')
308
- assert path_is_absolute?('\\\\?\\UNC\\::1/128\\the-share_name\\dir')
309
- assert path_is_absolute?('\\\\?\\UNC\\::1/128\\the-share_name\\dir\\')
310
- end
304
+ assert_false path_is_absolute?('\\\\?\\UNC\\::1/128\\the-share_name')
305
+ assert path_is_absolute?('\\\\?\\UNC\\::1/128\\the-share_name/')
306
+ assert path_is_absolute?('\\\\?\\UNC\\::1/128\\the-share_name\\')
307
+ assert path_is_absolute?('\\\\?\\UNC\\::1/128\\the-share_name\\\\')
308
+ assert path_is_absolute?('\\\\?\\UNC\\::1/128\\the-share_name\\dir')
309
+ assert path_is_absolute?('\\\\?\\UNC\\::1/128\\the-share_name\\dir\\')
310
+ end
311
311
 
312
- def test_absolute_paths_from_drive
312
+ def test_absolute_paths_from_drive
313
313
 
314
- # form 1
314
+ # form 1
315
315
 
316
- assert path_is_absolute?('C:\\')
317
- assert path_is_absolute?('C:\\abc')
318
- assert path_is_absolute?('C:\\abc\\')
316
+ assert path_is_absolute?('C:\\')
317
+ assert path_is_absolute?('C:\\abc')
318
+ assert path_is_absolute?('C:\\abc\\')
319
319
 
320
- assert_false path_is_absolute?('C:')
321
- assert_false path_is_absolute?('C:abc')
322
- assert_false path_is_absolute?('C:abc\\')
323
-
324
- # form 3
325
-
326
- assert path_is_absolute?('\\\\?\\C:\\')
327
- assert path_is_absolute?('\\\\?\\C:\\abc')
328
- assert path_is_absolute?('\\\\?\\C:\\abc\\')
329
-
330
- assert_false path_is_absolute?('\\\\?\\C:')
331
- assert_false path_is_absolute?('\\\\?\\C:abc')
332
- assert_false path_is_absolute?('\\\\?\\C:abc\\')
333
- end
334
-
335
- def test_absolute_paths_from_device
336
-
337
- # form 6
338
-
339
- assert_false path_is_absolute?('\\\\.\\')
340
- assert_false path_is_absolute?('\\\\.\\{device-id}')
341
- assert_false path_is_absolute?('\\\\.\\{device-id}/')
342
- assert path_is_absolute?('\\\\.\\{device-id}\\')
343
- assert path_is_absolute?('\\\\.\\{device-id}\\\\')
344
- assert path_is_absolute?('\\\\.\\{device-id}\\dir')
345
- assert path_is_absolute?('\\\\.\\{device-id}\\dir\\')
346
- end
347
-
348
- def test_absolute_paths_from_root
349
-
350
- assert_false path_is_absolute?('\\')
351
- assert_false path_is_absolute?('\\\\')
352
- assert_false path_is_absolute?('\\abc')
353
-
354
- assert_false path_is_absolute?('/')
355
- assert_false path_is_absolute?('//')
356
- assert_false path_is_absolute?('/abc')
357
- end
358
-
359
- def test_absolute_paths_from_home
360
-
361
- assert path_is_absolute?('~')
362
- assert path_is_absolute?('~/')
363
- assert path_is_absolute?('~/abc')
364
- end
365
-
366
- def test_relative_paths
367
-
368
- assert_false path_is_absolute?('abc')
369
- assert_false path_is_absolute?('abc/')
370
- assert_false path_is_absolute?('a/')
371
-
372
- assert_false path_is_absolute?('~abc')
373
- end
320
+ assert_false path_is_absolute?('C:')
321
+ assert_false path_is_absolute?('C:abc')
322
+ assert_false path_is_absolute?('C:abc\\')
323
+
324
+ # form 3
325
+
326
+ assert path_is_absolute?('\\\\?\\C:\\')
327
+ assert path_is_absolute?('\\\\?\\C:\\abc')
328
+ assert path_is_absolute?('\\\\?\\C:\\abc\\')
329
+
330
+ assert_false path_is_absolute?('\\\\?\\C:')
331
+ assert_false path_is_absolute?('\\\\?\\C:abc')
332
+ assert_false path_is_absolute?('\\\\?\\C:abc\\')
333
+ end
334
+
335
+ def test_absolute_paths_from_device
336
+
337
+ # form 6
338
+
339
+ assert_false path_is_absolute?('\\\\.\\')
340
+ assert_false path_is_absolute?('\\\\.\\{device-id}')
341
+ assert_false path_is_absolute?('\\\\.\\{device-id}/')
342
+ assert path_is_absolute?('\\\\.\\{device-id}\\')
343
+ assert path_is_absolute?('\\\\.\\{device-id}\\\\')
344
+ assert path_is_absolute?('\\\\.\\{device-id}\\dir')
345
+ assert path_is_absolute?('\\\\.\\{device-id}\\dir\\')
346
+ end
347
+
348
+ def test_absolute_paths_from_root
349
+
350
+ assert_false path_is_absolute?('\\')
351
+ assert_false path_is_absolute?('\\\\')
352
+ assert_false path_is_absolute?('\\abc')
353
+
354
+ assert_false path_is_absolute?('/')
355
+ assert_false path_is_absolute?('//')
356
+ assert_false path_is_absolute?('/abc')
357
+ end
358
+
359
+ def test_absolute_paths_from_home
360
+
361
+ assert path_is_absolute?('~')
362
+ assert path_is_absolute?('~/')
363
+ assert path_is_absolute?('~/abc')
364
+ end
365
+
366
+ def test_relative_paths
367
+
368
+ assert_false path_is_absolute?('abc')
369
+ assert_false path_is_absolute?('abc/')
370
+ assert_false path_is_absolute?('a/')
371
+
372
+ assert_false path_is_absolute?('~abc')
373
+ end
374
374
  end
375
375
 
376
376
  class Test_path_is_homed_Windows < Test::Unit::TestCase
377
377
 
378
- include ::LibPath::Form::Windows
378
+ include ::LibPath::Form::Windows
379
379
 
380
- if $DEBUG
380
+ if $DEBUG
381
381
 
382
- def test_with_nil
382
+ def test_with_nil
383
383
 
384
- assert_raise(::ArgumentError) { path_is_homed?(nil) }
385
- end
386
- end
384
+ assert_raise(::ArgumentError) { path_is_homed?(nil) }
385
+ end
386
+ end
387
387
 
388
- def test_empty
388
+ def test_empty
389
389
 
390
- assert_false path_is_homed?('')
391
- end
390
+ assert_false path_is_homed?('')
391
+ end
392
392
 
393
- def test_absolute_paths_from_UNC
393
+ def test_absolute_paths_from_UNC
394
394
 
395
- assert_false path_is_homed?('\\\\')
396
- assert_false path_is_homed?('\\\\server')
397
- assert_false path_is_homed?('\\\\server\\')
398
- assert_false path_is_homed?('\\\\server\\share')
395
+ assert_false path_is_homed?('\\\\')
396
+ assert_false path_is_homed?('\\\\server')
397
+ assert_false path_is_homed?('\\\\server\\')
398
+ assert_false path_is_homed?('\\\\server\\share')
399
399
 
400
- assert_false path_is_homed?('\\\\server\\the-share_name\\')
401
- assert_false path_is_homed?('\\\\server\\the-share_name\\\\')
402
- assert_false path_is_homed?('\\\\server\\the-share_name\\dir')
403
- assert_false path_is_homed?('\\\\server\\the-share_name\\dir\\')
400
+ assert_false path_is_homed?('\\\\server\\the-share_name\\')
401
+ assert_false path_is_homed?('\\\\server\\the-share_name\\\\')
402
+ assert_false path_is_homed?('\\\\server\\the-share_name\\dir')
403
+ assert_false path_is_homed?('\\\\server\\the-share_name\\dir\\')
404
404
 
405
- assert_false path_is_homed?('\\\\101.2.303.4\\the-share_name\\')
406
- assert_false path_is_homed?('\\\\101.2.303.4\\the-share_name\\\\')
407
- assert_false path_is_homed?('\\\\101.2.303.4\\the-share_name\\dir')
408
- assert_false path_is_homed?('\\\\101.2.303.4\\the-share_name\\dir\\')
405
+ assert_false path_is_homed?('\\\\101.2.303.4\\the-share_name\\')
406
+ assert_false path_is_homed?('\\\\101.2.303.4\\the-share_name\\\\')
407
+ assert_false path_is_homed?('\\\\101.2.303.4\\the-share_name\\dir')
408
+ assert_false path_is_homed?('\\\\101.2.303.4\\the-share_name\\dir\\')
409
409
 
410
- assert_false path_is_homed?('\\\\::1/128\\the-share_name\\')
411
- assert_false path_is_homed?('\\\\::1/128\\the-share_name\\\\')
412
- assert_false path_is_homed?('\\\\::1/128\\the-share_name\\dir')
413
- assert_false path_is_homed?('\\\\::1/128\\the-share_name\\dir\\')
414
- end
410
+ assert_false path_is_homed?('\\\\::1/128\\the-share_name\\')
411
+ assert_false path_is_homed?('\\\\::1/128\\the-share_name\\\\')
412
+ assert_false path_is_homed?('\\\\::1/128\\the-share_name\\dir')
413
+ assert_false path_is_homed?('\\\\::1/128\\the-share_name\\dir\\')
414
+ end
415
415
 
416
- def test_absolute_paths_from_drive
416
+ def test_absolute_paths_from_drive
417
417
 
418
- assert_false path_is_homed?('C:\\')
419
- assert_false path_is_homed?('C:\\abc')
420
- assert_false path_is_homed?('C:\\abc\\')
421
- end
418
+ assert_false path_is_homed?('C:\\')
419
+ assert_false path_is_homed?('C:\\abc')
420
+ assert_false path_is_homed?('C:\\abc\\')
421
+ end
422
422
 
423
- def test_absolute_paths_from_root
423
+ def test_absolute_paths_from_root
424
424
 
425
- assert_false path_is_homed?('\\')
426
- assert_false path_is_homed?('\\\\')
427
- assert_false path_is_homed?('\\abc')
425
+ assert_false path_is_homed?('\\')
426
+ assert_false path_is_homed?('\\\\')
427
+ assert_false path_is_homed?('\\abc')
428
428
 
429
- assert_false path_is_homed?('/')
430
- assert_false path_is_homed?('//')
431
- assert_false path_is_homed?('/abc')
432
- end
429
+ assert_false path_is_homed?('/')
430
+ assert_false path_is_homed?('//')
431
+ assert_false path_is_homed?('/abc')
432
+ end
433
433
 
434
- def test_absolute_paths_from_home
434
+ def test_absolute_paths_from_home
435
435
 
436
- assert path_is_homed?('~')
437
- assert path_is_homed?('~/')
438
- assert path_is_homed?('~/abc')
439
- end
436
+ assert path_is_homed?('~')
437
+ assert path_is_homed?('~/')
438
+ assert path_is_homed?('~/abc')
439
+ end
440
440
 
441
- def test_relative_paths
441
+ def test_relative_paths
442
442
 
443
- assert_false path_is_homed?('abc')
444
- assert_false path_is_homed?('abc/')
445
- assert_false path_is_homed?('a/')
443
+ assert_false path_is_homed?('abc')
444
+ assert_false path_is_homed?('abc/')
445
+ assert_false path_is_homed?('a/')
446
446
 
447
- assert_false path_is_homed?('~abc')
448
- end
447
+ assert_false path_is_homed?('~abc')
448
+ end
449
449
  end
450
450
 
451
451
  class Test_path_is_rooted_Windows < Test::Unit::TestCase
452
452
 
453
- include ::LibPath::Form::Windows
453
+ include ::LibPath::Form::Windows
454
454
 
455
- if $DEBUG
455
+ if $DEBUG
456
456
 
457
- def test_with_nil
457
+ def test_with_nil
458
458
 
459
- assert_raise(::ArgumentError) { path_is_rooted?(nil) }
460
- end
461
- end
459
+ assert_raise(::ArgumentError) { path_is_rooted?(nil) }
460
+ end
461
+ end
462
462
 
463
- def test_empty
463
+ def test_empty
464
464
 
465
- assert_false path_is_rooted?('')
466
- end
465
+ assert_false path_is_rooted?('')
466
+ end
467
467
 
468
- def test_absolute_paths_from_UNC
468
+ def test_absolute_paths_from_UNC
469
469
 
470
- assert_false path_is_rooted?('\\\\')
470
+ assert_false path_is_rooted?('\\\\')
471
471
 
472
- assert_false path_is_rooted?('\\\\server')
473
- assert_false path_is_rooted?('\\\\server\\')
472
+ assert_false path_is_rooted?('\\\\server')
473
+ assert_false path_is_rooted?('\\\\server\\')
474
474
 
475
- # form 2
475
+ # form 2
476
476
 
477
- assert_false path_is_rooted?('\\\\server\\share')
478
- assert path_is_rooted?('\\\\server\\share\\')
479
- assert path_is_rooted?('\\\\server\\share/')
477
+ assert_false path_is_rooted?('\\\\server\\share')
478
+ assert path_is_rooted?('\\\\server\\share\\')
479
+ assert path_is_rooted?('\\\\server\\share/')
480
480
 
481
- assert_false path_is_rooted?('\\\\server\\the-share_name')
482
- assert path_is_rooted?('\\\\server\\the-share_name/')
483
- assert path_is_rooted?('\\\\server\\the-share_name\\')
484
- assert path_is_rooted?('\\\\server\\the-share_name\\\\')
485
- assert path_is_rooted?('\\\\server\\the-share_name\\dir')
486
- assert path_is_rooted?('\\\\server\\the-share_name\\dir\\')
481
+ assert_false path_is_rooted?('\\\\server\\the-share_name')
482
+ assert path_is_rooted?('\\\\server\\the-share_name/')
483
+ assert path_is_rooted?('\\\\server\\the-share_name\\')
484
+ assert path_is_rooted?('\\\\server\\the-share_name\\\\')
485
+ assert path_is_rooted?('\\\\server\\the-share_name\\dir')
486
+ assert path_is_rooted?('\\\\server\\the-share_name\\dir\\')
487
487
 
488
- assert_false path_is_rooted?('\\\\101.2.303.4\\the-share_name')
489
- assert path_is_rooted?('\\\\101.2.303.4\\the-share_name/')
490
- assert path_is_rooted?('\\\\101.2.303.4\\the-share_name\\')
491
- assert path_is_rooted?('\\\\101.2.303.4\\the-share_name\\\\')
492
- assert path_is_rooted?('\\\\101.2.303.4\\the-share_name\\dir')
493
- assert path_is_rooted?('\\\\101.2.303.4\\the-share_name\\dir\\')
488
+ assert_false path_is_rooted?('\\\\101.2.303.4\\the-share_name')
489
+ assert path_is_rooted?('\\\\101.2.303.4\\the-share_name/')
490
+ assert path_is_rooted?('\\\\101.2.303.4\\the-share_name\\')
491
+ assert path_is_rooted?('\\\\101.2.303.4\\the-share_name\\\\')
492
+ assert path_is_rooted?('\\\\101.2.303.4\\the-share_name\\dir')
493
+ assert path_is_rooted?('\\\\101.2.303.4\\the-share_name\\dir\\')
494
494
 
495
- assert_false path_is_rooted?('\\\\::1/128\\the-share_name')
496
- assert path_is_rooted?('\\\\::1/128\\the-share_name/')
497
- assert path_is_rooted?('\\\\::1/128\\the-share_name\\')
498
- assert path_is_rooted?('\\\\::1/128\\the-share_name\\\\')
499
- assert path_is_rooted?('\\\\::1/128\\the-share_name\\dir')
500
- assert path_is_rooted?('\\\\::1/128\\the-share_name\\dir\\')
495
+ assert_false path_is_rooted?('\\\\::1/128\\the-share_name')
496
+ assert path_is_rooted?('\\\\::1/128\\the-share_name/')
497
+ assert path_is_rooted?('\\\\::1/128\\the-share_name\\')
498
+ assert path_is_rooted?('\\\\::1/128\\the-share_name\\\\')
499
+ assert path_is_rooted?('\\\\::1/128\\the-share_name\\dir')
500
+ assert path_is_rooted?('\\\\::1/128\\the-share_name\\dir\\')
501
501
 
502
- # form 4
502
+ # form 4
503
503
 
504
- assert_false path_is_rooted?('\\\\?\\server\\the-share_name')
505
- assert path_is_rooted?('\\\\?\\server\\the-share_name/')
506
- assert path_is_rooted?('\\\\?\\server\\the-share_name\\')
507
- assert path_is_rooted?('\\\\?\\server\\the-share_name\\\\')
508
- assert path_is_rooted?('\\\\?\\server\\the-share_name\\dir')
509
- assert path_is_rooted?('\\\\?\\server\\the-share_name\\dir\\')
504
+ assert_false path_is_rooted?('\\\\?\\server\\the-share_name')
505
+ assert path_is_rooted?('\\\\?\\server\\the-share_name/')
506
+ assert path_is_rooted?('\\\\?\\server\\the-share_name\\')
507
+ assert path_is_rooted?('\\\\?\\server\\the-share_name\\\\')
508
+ assert path_is_rooted?('\\\\?\\server\\the-share_name\\dir')
509
+ assert path_is_rooted?('\\\\?\\server\\the-share_name\\dir\\')
510
510
 
511
- assert_false path_is_rooted?('\\\\?\\101.2.303.4\\the-share_name')
512
- assert path_is_rooted?('\\\\?\\101.2.303.4\\the-share_name/')
513
- assert path_is_rooted?('\\\\?\\101.2.303.4\\the-share_name\\')
514
- assert path_is_rooted?('\\\\?\\101.2.303.4\\the-share_name\\\\')
515
- assert path_is_rooted?('\\\\?\\101.2.303.4\\the-share_name\\dir')
516
- assert path_is_rooted?('\\\\?\\101.2.303.4\\the-share_name\\dir\\')
511
+ assert_false path_is_rooted?('\\\\?\\101.2.303.4\\the-share_name')
512
+ assert path_is_rooted?('\\\\?\\101.2.303.4\\the-share_name/')
513
+ assert path_is_rooted?('\\\\?\\101.2.303.4\\the-share_name\\')
514
+ assert path_is_rooted?('\\\\?\\101.2.303.4\\the-share_name\\\\')
515
+ assert path_is_rooted?('\\\\?\\101.2.303.4\\the-share_name\\dir')
516
+ assert path_is_rooted?('\\\\?\\101.2.303.4\\the-share_name\\dir\\')
517
517
 
518
- assert_false path_is_rooted?('\\\\?\\::1/128\\the-share_name')
519
- assert path_is_rooted?('\\\\?\\::1/128\\the-share_name/')
520
- assert path_is_rooted?('\\\\?\\::1/128\\the-share_name\\')
521
- assert path_is_rooted?('\\\\?\\::1/128\\the-share_name\\\\')
522
- assert path_is_rooted?('\\\\?\\::1/128\\the-share_name\\dir')
523
- assert path_is_rooted?('\\\\?\\::1/128\\the-share_name\\dir\\')
518
+ assert_false path_is_rooted?('\\\\?\\::1/128\\the-share_name')
519
+ assert path_is_rooted?('\\\\?\\::1/128\\the-share_name/')
520
+ assert path_is_rooted?('\\\\?\\::1/128\\the-share_name\\')
521
+ assert path_is_rooted?('\\\\?\\::1/128\\the-share_name\\\\')
522
+ assert path_is_rooted?('\\\\?\\::1/128\\the-share_name\\dir')
523
+ assert path_is_rooted?('\\\\?\\::1/128\\the-share_name\\dir\\')
524
524
 
525
- # form 5
525
+ # form 5
526
526
 
527
- assert_false path_is_rooted?('\\\\?\\UNC\\server\\the-share_name')
528
- assert path_is_rooted?('\\\\?\\UNC\\server\\the-share_name/')
529
- assert path_is_rooted?('\\\\?\\UNC\\server\\the-share_name\\')
530
- assert path_is_rooted?('\\\\?\\UNC\\server\\the-share_name\\\\')
531
- assert path_is_rooted?('\\\\?\\UNC\\server\\the-share_name\\dir')
532
- assert path_is_rooted?('\\\\?\\UNC\\server\\the-share_name\\dir\\')
527
+ assert_false path_is_rooted?('\\\\?\\UNC\\server\\the-share_name')
528
+ assert path_is_rooted?('\\\\?\\UNC\\server\\the-share_name/')
529
+ assert path_is_rooted?('\\\\?\\UNC\\server\\the-share_name\\')
530
+ assert path_is_rooted?('\\\\?\\UNC\\server\\the-share_name\\\\')
531
+ assert path_is_rooted?('\\\\?\\UNC\\server\\the-share_name\\dir')
532
+ assert path_is_rooted?('\\\\?\\UNC\\server\\the-share_name\\dir\\')
533
533
 
534
- assert_false path_is_rooted?('\\\\?\\UNC\\101.2.303.4\\the-share_name')
535
- assert path_is_rooted?('\\\\?\\UNC\\101.2.303.4\\the-share_name/')
536
- assert path_is_rooted?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\')
537
- assert path_is_rooted?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\\\')
538
- assert path_is_rooted?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\dir')
539
- assert path_is_rooted?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\dir\\')
534
+ assert_false path_is_rooted?('\\\\?\\UNC\\101.2.303.4\\the-share_name')
535
+ assert path_is_rooted?('\\\\?\\UNC\\101.2.303.4\\the-share_name/')
536
+ assert path_is_rooted?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\')
537
+ assert path_is_rooted?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\\\')
538
+ assert path_is_rooted?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\dir')
539
+ assert path_is_rooted?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\dir\\')
540
540
 
541
- assert_false path_is_rooted?('\\\\?\\UNC\\::1/128\\the-share_name')
542
- assert path_is_rooted?('\\\\?\\UNC\\::1/128\\the-share_name/')
543
- assert path_is_rooted?('\\\\?\\UNC\\::1/128\\the-share_name\\')
544
- assert path_is_rooted?('\\\\?\\UNC\\::1/128\\the-share_name\\\\')
545
- assert path_is_rooted?('\\\\?\\UNC\\::1/128\\the-share_name\\dir')
546
- assert path_is_rooted?('\\\\?\\UNC\\::1/128\\the-share_name\\dir\\')
547
- end
541
+ assert_false path_is_rooted?('\\\\?\\UNC\\::1/128\\the-share_name')
542
+ assert path_is_rooted?('\\\\?\\UNC\\::1/128\\the-share_name/')
543
+ assert path_is_rooted?('\\\\?\\UNC\\::1/128\\the-share_name\\')
544
+ assert path_is_rooted?('\\\\?\\UNC\\::1/128\\the-share_name\\\\')
545
+ assert path_is_rooted?('\\\\?\\UNC\\::1/128\\the-share_name\\dir')
546
+ assert path_is_rooted?('\\\\?\\UNC\\::1/128\\the-share_name\\dir\\')
547
+ end
548
548
 
549
- def test_absolute_paths_from_drive
549
+ def test_absolute_paths_from_drive
550
550
 
551
- # form 1
551
+ # form 1
552
552
 
553
- assert path_is_rooted?('C:\\')
554
- assert path_is_rooted?('C:\\abc')
555
- assert path_is_rooted?('C:\\abc\\')
553
+ assert path_is_rooted?('C:\\')
554
+ assert path_is_rooted?('C:\\abc')
555
+ assert path_is_rooted?('C:\\abc\\')
556
556
 
557
- assert_false path_is_rooted?('C:')
558
- assert_false path_is_rooted?('C:abc')
559
- assert_false path_is_rooted?('C:abc\\')
560
-
561
- # form 3
562
-
563
- assert path_is_rooted?('\\\\?\\C:\\')
564
- assert path_is_rooted?('\\\\?\\C:\\abc')
565
- assert path_is_rooted?('\\\\?\\C:\\abc\\')
566
-
567
- assert_false path_is_rooted?('\\\\?\\C:')
568
- assert_false path_is_rooted?('\\\\?\\C:abc')
569
- assert_false path_is_rooted?('\\\\?\\C:abc\\')
570
- end
571
-
572
- def test_absolute_paths_from_device
573
-
574
- # form 6
575
-
576
- assert_false path_is_rooted?('\\\\.\\')
577
- assert_false path_is_rooted?('\\\\.\\{device-id}')
578
- assert_false path_is_rooted?('\\\\.\\{device-id}/')
579
- assert path_is_rooted?('\\\\.\\{device-id}\\')
580
- assert path_is_rooted?('\\\\.\\{device-id}\\\\')
581
- assert path_is_rooted?('\\\\.\\{device-id}\\dir')
582
- assert path_is_rooted?('\\\\.\\{device-id}\\dir\\')
583
- end
584
-
585
- def test_absolute_paths_from_root
586
-
587
- assert path_is_rooted?('\\')
588
- assert_false path_is_rooted?('\\\\')
589
- assert path_is_rooted?('\\abc')
590
-
591
- assert path_is_rooted?('/')
592
- assert path_is_rooted?('//')
593
- assert path_is_rooted?('/abc')
594
- end
595
-
596
- def test_absolute_paths_from_home
597
-
598
- assert_false path_is_rooted?('~')
599
- assert_false path_is_rooted?('~/')
600
- assert_false path_is_rooted?('~/abc')
601
- end
602
-
603
- def test_relative_paths
604
-
605
- assert_false path_is_rooted?('abc')
606
- assert_false path_is_rooted?('abc/')
607
- assert_false path_is_rooted?('a/')
608
-
609
- assert_false path_is_rooted?('~abc')
610
- end
557
+ assert_false path_is_rooted?('C:')
558
+ assert_false path_is_rooted?('C:abc')
559
+ assert_false path_is_rooted?('C:abc\\')
560
+
561
+ # form 3
562
+
563
+ assert path_is_rooted?('\\\\?\\C:\\')
564
+ assert path_is_rooted?('\\\\?\\C:\\abc')
565
+ assert path_is_rooted?('\\\\?\\C:\\abc\\')
566
+
567
+ assert_false path_is_rooted?('\\\\?\\C:')
568
+ assert_false path_is_rooted?('\\\\?\\C:abc')
569
+ assert_false path_is_rooted?('\\\\?\\C:abc\\')
570
+ end
571
+
572
+ def test_absolute_paths_from_device
573
+
574
+ # form 6
575
+
576
+ assert_false path_is_rooted?('\\\\.\\')
577
+ assert_false path_is_rooted?('\\\\.\\{device-id}')
578
+ assert_false path_is_rooted?('\\\\.\\{device-id}/')
579
+ assert path_is_rooted?('\\\\.\\{device-id}\\')
580
+ assert path_is_rooted?('\\\\.\\{device-id}\\\\')
581
+ assert path_is_rooted?('\\\\.\\{device-id}\\dir')
582
+ assert path_is_rooted?('\\\\.\\{device-id}\\dir\\')
583
+ end
584
+
585
+ def test_absolute_paths_from_root
586
+
587
+ assert path_is_rooted?('\\')
588
+ assert_false path_is_rooted?('\\\\')
589
+ assert path_is_rooted?('\\abc')
590
+
591
+ assert path_is_rooted?('/')
592
+ assert path_is_rooted?('//')
593
+ assert path_is_rooted?('/abc')
594
+ end
595
+
596
+ def test_absolute_paths_from_home
597
+
598
+ assert_false path_is_rooted?('~')
599
+ assert_false path_is_rooted?('~/')
600
+ assert_false path_is_rooted?('~/abc')
601
+ end
602
+
603
+ def test_relative_paths
604
+
605
+ assert_false path_is_rooted?('abc')
606
+ assert_false path_is_rooted?('abc/')
607
+ assert_false path_is_rooted?('a/')
608
+
609
+ assert_false path_is_rooted?('~abc')
610
+ end
611
611
  end
612
612
 
613
613
  class Test_path_is_UNC_Windows < Test::Unit::TestCase
614
614
 
615
- include ::LibPath::Form::Windows
615
+ include ::LibPath::Form::Windows
616
616
 
617
- if $DEBUG
617
+ if $DEBUG
618
618
 
619
- def test_with_nil
619
+ def test_with_nil
620
620
 
621
- assert_raise(::ArgumentError) { path_is_UNC?(nil) }
622
- end
623
- end
621
+ assert_raise(::ArgumentError) { path_is_UNC?(nil) }
622
+ end
623
+ end
624
624
 
625
- def test_empty
625
+ def test_empty
626
626
 
627
- assert_false path_is_UNC?('')
628
- end
627
+ assert_false path_is_UNC?('')
628
+ end
629
629
 
630
- def test_absolute_paths_from_drive
630
+ def test_absolute_paths_from_drive
631
631
 
632
- assert_false path_is_UNC?('C:\\')
633
- assert_false path_is_UNC?('C:\\\\')
634
- assert_false path_is_UNC?('C:\\abc\\')
635
- end
632
+ assert_false path_is_UNC?('C:\\')
633
+ assert_false path_is_UNC?('C:\\\\')
634
+ assert_false path_is_UNC?('C:\\abc\\')
635
+ end
636
636
 
637
- def test_absolute_paths_from_UNC
637
+ def test_absolute_paths_from_UNC
638
638
 
639
- assert_false path_is_UNC?('\\\\')
639
+ assert_false path_is_UNC?('\\\\')
640
640
 
641
- # form 3
641
+ # form 3
642
642
 
643
- assert_false path_is_UNC?('\\\\?\\C')
644
- assert path_is_UNC?('\\\\?\\C:')
645
- assert path_is_UNC?('\\\\?\\C:\\')
646
- assert path_is_UNC?('\\\\?\\C:\\\\')
647
- assert path_is_UNC?('\\\\?\\C:\\abc\\')
648
- assert path_is_UNC?('\\\\?\\C:\\abc/')
643
+ assert_false path_is_UNC?('\\\\?\\C')
644
+ assert path_is_UNC?('\\\\?\\C:')
645
+ assert path_is_UNC?('\\\\?\\C:\\')
646
+ assert path_is_UNC?('\\\\?\\C:\\\\')
647
+ assert path_is_UNC?('\\\\?\\C:\\abc\\')
648
+ assert path_is_UNC?('\\\\?\\C:\\abc/')
649
649
 
650
- # form 2
650
+ # form 2
651
651
 
652
- assert_false path_is_UNC?('\\\\server')
653
- assert_false path_is_UNC?('\\\\server\\')
652
+ assert_false path_is_UNC?('\\\\server')
653
+ assert_false path_is_UNC?('\\\\server\\')
654
654
 
655
- assert path_is_UNC?('\\\\server\\share')
655
+ assert path_is_UNC?('\\\\server\\share')
656
656
 
657
- assert path_is_UNC?('\\\\server\\the-share_name')
658
- assert path_is_UNC?('\\\\server\\the-share_name/')
659
- assert path_is_UNC?('\\\\server\\the-share_name\\')
660
- assert path_is_UNC?('\\\\server\\the-share_name\\\\')
661
- assert path_is_UNC?('\\\\server\\the-share_name\\dir')
662
- assert path_is_UNC?('\\\\server\\the-share_name\\dir\\')
657
+ assert path_is_UNC?('\\\\server\\the-share_name')
658
+ assert path_is_UNC?('\\\\server\\the-share_name/')
659
+ assert path_is_UNC?('\\\\server\\the-share_name\\')
660
+ assert path_is_UNC?('\\\\server\\the-share_name\\\\')
661
+ assert path_is_UNC?('\\\\server\\the-share_name\\dir')
662
+ assert path_is_UNC?('\\\\server\\the-share_name\\dir\\')
663
663
 
664
- assert path_is_UNC?('\\\\101.2.303.4\\the-share_name')
665
- assert path_is_UNC?('\\\\101.2.303.4\\the-share_name/')
666
- assert path_is_UNC?('\\\\101.2.303.4\\the-share_name\\')
667
- assert path_is_UNC?('\\\\101.2.303.4\\the-share_name\\\\')
668
- assert path_is_UNC?('\\\\101.2.303.4\\the-share_name\\dir')
669
- assert path_is_UNC?('\\\\101.2.303.4\\the-share_name\\dir\\')
664
+ assert path_is_UNC?('\\\\101.2.303.4\\the-share_name')
665
+ assert path_is_UNC?('\\\\101.2.303.4\\the-share_name/')
666
+ assert path_is_UNC?('\\\\101.2.303.4\\the-share_name\\')
667
+ assert path_is_UNC?('\\\\101.2.303.4\\the-share_name\\\\')
668
+ assert path_is_UNC?('\\\\101.2.303.4\\the-share_name\\dir')
669
+ assert path_is_UNC?('\\\\101.2.303.4\\the-share_name\\dir\\')
670
670
 
671
- assert path_is_UNC?('\\\\::1/128\\the-share_name')
672
- assert path_is_UNC?('\\\\::1/128\\the-share_name/')
673
- assert path_is_UNC?('\\\\::1/128\\the-share_name\\')
674
- assert path_is_UNC?('\\\\::1/128\\the-share_name\\\\')
675
- assert path_is_UNC?('\\\\::1/128\\the-share_name\\dir')
676
- assert path_is_UNC?('\\\\::1/128\\the-share_name\\dir\\')
671
+ assert path_is_UNC?('\\\\::1/128\\the-share_name')
672
+ assert path_is_UNC?('\\\\::1/128\\the-share_name/')
673
+ assert path_is_UNC?('\\\\::1/128\\the-share_name\\')
674
+ assert path_is_UNC?('\\\\::1/128\\the-share_name\\\\')
675
+ assert path_is_UNC?('\\\\::1/128\\the-share_name\\dir')
676
+ assert path_is_UNC?('\\\\::1/128\\the-share_name\\dir\\')
677
677
 
678
- # form 4
678
+ # form 4
679
679
 
680
- assert_false path_is_UNC?('\\\\?\\server')
681
- assert_false path_is_UNC?('\\\\?\\server\\')
680
+ assert_false path_is_UNC?('\\\\?\\server')
681
+ assert_false path_is_UNC?('\\\\?\\server\\')
682
682
 
683
- assert path_is_UNC?('\\\\?\\server\\share')
683
+ assert path_is_UNC?('\\\\?\\server\\share')
684
684
 
685
- assert path_is_UNC?('\\\\?\\server\\the-share_name')
686
- assert path_is_UNC?('\\\\?\\server\\the-share_name/')
687
- assert path_is_UNC?('\\\\?\\server\\the-share_name\\')
688
- assert path_is_UNC?('\\\\?\\server\\the-share_name\\\\')
689
- assert path_is_UNC?('\\\\?\\server\\the-share_name\\dir')
690
- assert path_is_UNC?('\\\\?\\server\\the-share_name\\dir\\')
685
+ assert path_is_UNC?('\\\\?\\server\\the-share_name')
686
+ assert path_is_UNC?('\\\\?\\server\\the-share_name/')
687
+ assert path_is_UNC?('\\\\?\\server\\the-share_name\\')
688
+ assert path_is_UNC?('\\\\?\\server\\the-share_name\\\\')
689
+ assert path_is_UNC?('\\\\?\\server\\the-share_name\\dir')
690
+ assert path_is_UNC?('\\\\?\\server\\the-share_name\\dir\\')
691
691
 
692
- assert path_is_UNC?('\\\\?\\101.2.303.4\\the-share_name')
693
- assert path_is_UNC?('\\\\?\\101.2.303.4\\the-share_name/')
694
- assert path_is_UNC?('\\\\?\\101.2.303.4\\the-share_name\\')
695
- assert path_is_UNC?('\\\\?\\101.2.303.4\\the-share_name\\\\')
696
- assert path_is_UNC?('\\\\?\\101.2.303.4\\the-share_name\\dir')
697
- assert path_is_UNC?('\\\\?\\101.2.303.4\\the-share_name\\dir\\')
692
+ assert path_is_UNC?('\\\\?\\101.2.303.4\\the-share_name')
693
+ assert path_is_UNC?('\\\\?\\101.2.303.4\\the-share_name/')
694
+ assert path_is_UNC?('\\\\?\\101.2.303.4\\the-share_name\\')
695
+ assert path_is_UNC?('\\\\?\\101.2.303.4\\the-share_name\\\\')
696
+ assert path_is_UNC?('\\\\?\\101.2.303.4\\the-share_name\\dir')
697
+ assert path_is_UNC?('\\\\?\\101.2.303.4\\the-share_name\\dir\\')
698
698
 
699
- assert path_is_UNC?('\\\\?\\::1/128\\the-share_name')
700
- assert path_is_UNC?('\\\\?\\::1/128\\the-share_name/')
701
- assert path_is_UNC?('\\\\?\\::1/128\\the-share_name\\')
702
- assert path_is_UNC?('\\\\?\\::1/128\\the-share_name\\\\')
703
- assert path_is_UNC?('\\\\?\\::1/128\\the-share_name\\dir')
704
- assert path_is_UNC?('\\\\?\\::1/128\\the-share_name\\dir\\')
699
+ assert path_is_UNC?('\\\\?\\::1/128\\the-share_name')
700
+ assert path_is_UNC?('\\\\?\\::1/128\\the-share_name/')
701
+ assert path_is_UNC?('\\\\?\\::1/128\\the-share_name\\')
702
+ assert path_is_UNC?('\\\\?\\::1/128\\the-share_name\\\\')
703
+ assert path_is_UNC?('\\\\?\\::1/128\\the-share_name\\dir')
704
+ assert path_is_UNC?('\\\\?\\::1/128\\the-share_name\\dir\\')
705
705
 
706
- # form 5
706
+ # form 5
707
707
 
708
- assert_false path_is_UNC?('\\\\?\\UNC\\server')
709
- assert_false path_is_UNC?('\\\\?\\UNC\\server\\')
708
+ assert_false path_is_UNC?('\\\\?\\UNC\\server')
709
+ assert_false path_is_UNC?('\\\\?\\UNC\\server\\')
710
710
 
711
- assert path_is_UNC?('\\\\?\\UNC\\server\\share')
711
+ assert path_is_UNC?('\\\\?\\UNC\\server\\share')
712
712
 
713
- assert path_is_UNC?('\\\\?\\UNC\\server\\the-share_name')
714
- assert path_is_UNC?('\\\\?\\UNC\\server\\the-share_name/')
715
- assert path_is_UNC?('\\\\?\\UNC\\server\\the-share_name\\')
716
- assert path_is_UNC?('\\\\?\\UNC\\server\\the-share_name\\\\')
717
- assert path_is_UNC?('\\\\?\\UNC\\server\\the-share_name\\dir')
718
- assert path_is_UNC?('\\\\?\\UNC\\server\\the-share_name\\dir\\')
713
+ assert path_is_UNC?('\\\\?\\UNC\\server\\the-share_name')
714
+ assert path_is_UNC?('\\\\?\\UNC\\server\\the-share_name/')
715
+ assert path_is_UNC?('\\\\?\\UNC\\server\\the-share_name\\')
716
+ assert path_is_UNC?('\\\\?\\UNC\\server\\the-share_name\\\\')
717
+ assert path_is_UNC?('\\\\?\\UNC\\server\\the-share_name\\dir')
718
+ assert path_is_UNC?('\\\\?\\UNC\\server\\the-share_name\\dir\\')
719
719
 
720
- assert path_is_UNC?('\\\\?\\UNC\\101.2.303.4\\the-share_name')
721
- assert path_is_UNC?('\\\\?\\UNC\\101.2.303.4\\the-share_name/')
722
- assert path_is_UNC?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\')
723
- assert path_is_UNC?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\\\')
724
- assert path_is_UNC?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\dir')
725
- assert path_is_UNC?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\dir\\')
720
+ assert path_is_UNC?('\\\\?\\UNC\\101.2.303.4\\the-share_name')
721
+ assert path_is_UNC?('\\\\?\\UNC\\101.2.303.4\\the-share_name/')
722
+ assert path_is_UNC?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\')
723
+ assert path_is_UNC?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\\\')
724
+ assert path_is_UNC?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\dir')
725
+ assert path_is_UNC?('\\\\?\\UNC\\101.2.303.4\\the-share_name\\dir\\')
726
726
 
727
- assert path_is_UNC?('\\\\?\\UNC\\::1/128\\the-share_name')
728
- assert path_is_UNC?('\\\\?\\UNC\\::1/128\\the-share_name/')
729
- assert path_is_UNC?('\\\\?\\UNC\\::1/128\\the-share_name\\')
730
- assert path_is_UNC?('\\\\?\\UNC\\::1/128\\the-share_name\\\\')
731
- assert path_is_UNC?('\\\\?\\UNC\\::1/128\\the-share_name\\dir')
732
- assert path_is_UNC?('\\\\?\\UNC\\::1/128\\the-share_name\\dir\\')
733
-
734
- # form 6
727
+ assert path_is_UNC?('\\\\?\\UNC\\::1/128\\the-share_name')
728
+ assert path_is_UNC?('\\\\?\\UNC\\::1/128\\the-share_name/')
729
+ assert path_is_UNC?('\\\\?\\UNC\\::1/128\\the-share_name\\')
730
+ assert path_is_UNC?('\\\\?\\UNC\\::1/128\\the-share_name\\\\')
731
+ assert path_is_UNC?('\\\\?\\UNC\\::1/128\\the-share_name\\dir')
732
+ assert path_is_UNC?('\\\\?\\UNC\\::1/128\\the-share_name\\dir\\')
733
+
734
+ # form 6
735
735
 
736
- assert_false path_is_UNC?('\\\\.\\')
737
-
738
- assert path_is_UNC?('\\\\.\\{device-id}\\')
739
- assert path_is_UNC?('\\\\.\\{device-id}\\\\')
740
- assert path_is_UNC?('\\\\.\\{device-id}\\dir')
741
- assert path_is_UNC?('\\\\.\\{device-id}\\dir\\')
742
- end
743
-
744
- def test_absolute_paths_from_root
745
-
746
- assert_false path_is_UNC?('\\')
747
- assert_false path_is_UNC?('\\\\')
748
- assert_false path_is_UNC?('\\abc')
749
-
750
- assert_false path_is_UNC?('/')
751
- assert_false path_is_UNC?('//')
752
- assert_false path_is_UNC?('/abc')
753
- end
754
-
755
- def test_absolute_paths_from_home
756
-
757
- assert_false path_is_UNC?('~')
758
- assert_false path_is_UNC?('~/')
759
- assert_false path_is_UNC?('~/abc')
760
- end
761
-
762
- def test_relative_paths
763
-
764
- assert_false path_is_UNC?('abc')
765
- assert_false path_is_UNC?('abc/')
766
- assert_false path_is_UNC?('a/')
767
-
768
- assert_false path_is_UNC?('~abc')
769
- end
736
+ assert_false path_is_UNC?('\\\\.\\')
737
+
738
+ assert path_is_UNC?('\\\\.\\{device-id}\\')
739
+ assert path_is_UNC?('\\\\.\\{device-id}\\\\')
740
+ assert path_is_UNC?('\\\\.\\{device-id}\\dir')
741
+ assert path_is_UNC?('\\\\.\\{device-id}\\dir\\')
742
+ end
743
+
744
+ def test_absolute_paths_from_root
745
+
746
+ assert_false path_is_UNC?('\\')
747
+ assert_false path_is_UNC?('\\\\')
748
+ assert_false path_is_UNC?('\\abc')
749
+
750
+ assert_false path_is_UNC?('/')
751
+ assert_false path_is_UNC?('//')
752
+ assert_false path_is_UNC?('/abc')
753
+ end
754
+
755
+ def test_absolute_paths_from_home
756
+
757
+ assert_false path_is_UNC?('~')
758
+ assert_false path_is_UNC?('~/')
759
+ assert_false path_is_UNC?('~/abc')
760
+ end
761
+
762
+ def test_relative_paths
763
+
764
+ assert_false path_is_UNC?('abc')
765
+ assert_false path_is_UNC?('abc/')
766
+ assert_false path_is_UNC?('a/')
767
+
768
+ assert_false path_is_UNC?('~abc')
769
+ end
770
770
  end
771
771
 
772
772
  class Test_path_is_letter_drived_Windows < Test::Unit::TestCase
773
773
 
774
- include ::LibPath::Form::Windows
774
+ include ::LibPath::Form::Windows
775
775
 
776
- if $DEBUG
776
+ if $DEBUG
777
777
 
778
- def test_with_nil
778
+ def test_with_nil
779
779
 
780
- assert_raise(::ArgumentError) { path_is_letter_drived?(nil) }
781
- end
782
- end
780
+ assert_raise(::ArgumentError) { path_is_letter_drived?(nil) }
781
+ end
782
+ end
783
783
 
784
- def test_empty
784
+ def test_empty
785
785
 
786
- assert_nil path_is_letter_drived?('')
787
- end
786
+ assert_nil path_is_letter_drived?('')
787
+ end
788
788
 
789
- def test_absolute_paths_from_drive
789
+ def test_absolute_paths_from_drive
790
790
 
791
- assert_equal 2, path_is_letter_drived?('C:')
792
- assert_equal 3, path_is_letter_drived?('C:\\')
793
- assert_equal 3, path_is_letter_drived?('C:/')
794
- assert_equal 3, path_is_letter_drived?('C:\\\\')
795
- assert_equal 3, path_is_letter_drived?('C:\\abc\\')
791
+ assert_equal 2, path_is_letter_drived?('C:')
792
+ assert_equal 3, path_is_letter_drived?('C:\\')
793
+ assert_equal 3, path_is_letter_drived?('C:/')
794
+ assert_equal 3, path_is_letter_drived?('C:\\\\')
795
+ assert_equal 3, path_is_letter_drived?('C:\\abc\\')
796
796
 
797
- assert_equal 6, path_is_letter_drived?('\\\\?\\C:')
798
- assert_equal 7, path_is_letter_drived?('\\\\?\\C:\\')
799
- assert_equal 7, path_is_letter_drived?('\\\\?\\C:/')
800
- assert_equal 7, path_is_letter_drived?('\\\\?\\C:\\\\')
801
- assert_equal 7, path_is_letter_drived?('\\\\?\\C:\\abc\\')
802
- end
797
+ assert_equal 6, path_is_letter_drived?('\\\\?\\C:')
798
+ assert_equal 7, path_is_letter_drived?('\\\\?\\C:\\')
799
+ assert_equal 7, path_is_letter_drived?('\\\\?\\C:/')
800
+ assert_equal 7, path_is_letter_drived?('\\\\?\\C:\\\\')
801
+ assert_equal 7, path_is_letter_drived?('\\\\?\\C:\\abc\\')
802
+ end
803
803
 
804
- def test_absolute_paths_from_other_UNC
804
+ def test_absolute_paths_from_other_UNC
805
805
 
806
- assert_nil path_is_letter_drived?('\\\\')
807
- assert_nil path_is_letter_drived?('\\\\server')
808
- assert_nil path_is_letter_drived?('\\\\server\\')
809
- assert_nil path_is_letter_drived?('\\\\server\\share')
806
+ assert_nil path_is_letter_drived?('\\\\')
807
+ assert_nil path_is_letter_drived?('\\\\server')
808
+ assert_nil path_is_letter_drived?('\\\\server\\')
809
+ assert_nil path_is_letter_drived?('\\\\server\\share')
810
810
 
811
- assert_nil path_is_letter_drived?('\\\\server\\the-share_name\\')
812
- assert_nil path_is_letter_drived?('\\\\server\\the-share_name\\\\')
813
- assert_nil path_is_letter_drived?('\\\\server\\the-share_name\\dir')
814
- assert_nil path_is_letter_drived?('\\\\server\\the-share_name\\dir\\')
811
+ assert_nil path_is_letter_drived?('\\\\server\\the-share_name\\')
812
+ assert_nil path_is_letter_drived?('\\\\server\\the-share_name\\\\')
813
+ assert_nil path_is_letter_drived?('\\\\server\\the-share_name\\dir')
814
+ assert_nil path_is_letter_drived?('\\\\server\\the-share_name\\dir\\')
815
815
 
816
- assert_nil path_is_letter_drived?('\\\\101.2.303.4\\the-share_name\\')
817
- assert_nil path_is_letter_drived?('\\\\101.2.303.4\\the-share_name\\\\')
818
- assert_nil path_is_letter_drived?('\\\\101.2.303.4\\the-share_name\\dir')
819
- assert_nil path_is_letter_drived?('\\\\101.2.303.4\\the-share_name\\dir\\')
816
+ assert_nil path_is_letter_drived?('\\\\101.2.303.4\\the-share_name\\')
817
+ assert_nil path_is_letter_drived?('\\\\101.2.303.4\\the-share_name\\\\')
818
+ assert_nil path_is_letter_drived?('\\\\101.2.303.4\\the-share_name\\dir')
819
+ assert_nil path_is_letter_drived?('\\\\101.2.303.4\\the-share_name\\dir\\')
820
820
 
821
- assert_nil path_is_letter_drived?('\\\\::1/128\\the-share_name\\')
822
- assert_nil path_is_letter_drived?('\\\\::1/128\\the-share_name\\\\')
823
- assert_nil path_is_letter_drived?('\\\\::1/128\\the-share_name\\dir')
824
- assert_nil path_is_letter_drived?('\\\\::1/128\\the-share_name\\dir\\')
825
- end
821
+ assert_nil path_is_letter_drived?('\\\\::1/128\\the-share_name\\')
822
+ assert_nil path_is_letter_drived?('\\\\::1/128\\the-share_name\\\\')
823
+ assert_nil path_is_letter_drived?('\\\\::1/128\\the-share_name\\dir')
824
+ assert_nil path_is_letter_drived?('\\\\::1/128\\the-share_name\\dir\\')
825
+ end
826
826
 
827
- def test_absolute_paths_from_root
827
+ def test_absolute_paths_from_root
828
828
 
829
- assert_nil path_is_letter_drived?('\\')
830
- assert_nil path_is_letter_drived?('\\\\')
831
- assert_nil path_is_letter_drived?('\\abc')
829
+ assert_nil path_is_letter_drived?('\\')
830
+ assert_nil path_is_letter_drived?('\\\\')
831
+ assert_nil path_is_letter_drived?('\\abc')
832
832
 
833
- assert_nil path_is_letter_drived?('/')
834
- assert_nil path_is_letter_drived?('//')
835
- assert_nil path_is_letter_drived?('/abc')
836
- end
833
+ assert_nil path_is_letter_drived?('/')
834
+ assert_nil path_is_letter_drived?('//')
835
+ assert_nil path_is_letter_drived?('/abc')
836
+ end
837
837
 
838
- def test_absolute_paths_from_home
838
+ def test_absolute_paths_from_home
839
839
 
840
- assert_nil path_is_letter_drived?('~')
841
- assert_nil path_is_letter_drived?('~/')
842
- assert_nil path_is_letter_drived?('~/abc')
843
- end
840
+ assert_nil path_is_letter_drived?('~')
841
+ assert_nil path_is_letter_drived?('~/')
842
+ assert_nil path_is_letter_drived?('~/abc')
843
+ end
844
844
 
845
- def test_relative_paths
845
+ def test_relative_paths
846
846
 
847
- assert_nil path_is_letter_drived?('abc')
848
- assert_nil path_is_letter_drived?('abc/')
849
- assert_nil path_is_letter_drived?('a/')
847
+ assert_nil path_is_letter_drived?('abc')
848
+ assert_nil path_is_letter_drived?('abc/')
849
+ assert_nil path_is_letter_drived?('a/')
850
850
 
851
- assert_nil path_is_letter_drived?('~abc')
852
- end
851
+ assert_nil path_is_letter_drived?('~abc')
852
+ end
853
853
  end
854
854
 
855
+
856
+ # ############################## end of file ############################# #
857
+