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
@@ -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
 
@@ -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
- def test_LibPath_module_exists
15
+ def test_LibPath_module_exists
16
16
 
17
- assert defined?(::LibPath)
18
- end
17
+ assert defined?(::LibPath)
18
+ end
19
19
 
20
- def test_LibPath_Form_module_exists
20
+ def test_LibPath_Form_module_exists
21
21
 
22
- assert defined?(::LibPath::Form)
23
- end
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
- include ::LibPath::Form
28
+ include ::LibPath::Form
29
29
 
30
- if $DEBUG
30
+ if $DEBUG
31
31
 
32
- def test_with_nil
32
+ def test_with_nil
33
33
 
34
- assert_raise(::ArgumentError) { path_is_absolute?(nil) }
35
- end
36
- end
34
+ assert_raise(::ArgumentError) { path_is_absolute?(nil) }
35
+ end
36
+ end
37
37
 
38
- def test_empty
38
+ def test_empty
39
39
 
40
- assert_false path_is_absolute?('')
41
- end
40
+ assert_false path_is_absolute?('')
41
+ end
42
42
 
43
- if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
43
+ if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
44
44
 
45
- def test_absolute_paths_from_UNC
45
+ def test_absolute_paths_from_UNC
46
46
 
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')
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
- 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\\')
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
- 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\\')
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
- 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
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
- if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
69
+ if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
70
70
 
71
- def test_absolute_paths_from_drive
71
+ def test_absolute_paths_from_drive
72
72
 
73
- assert path_is_absolute?('C:\\')
74
- assert path_is_absolute?('C:\\abc')
75
- assert path_is_absolute?('C:\\abc\\')
73
+ assert path_is_absolute?('C:\\')
74
+ assert path_is_absolute?('C:\\abc')
75
+ assert path_is_absolute?('C:\\abc\\')
76
76
 
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
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
- def test_absolute_paths_from_root
83
+ def test_absolute_paths_from_root
84
84
 
85
- if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
85
+ if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
86
86
 
87
- assert_false path_is_absolute?('\\')
88
- assert_false path_is_absolute?('\\\\')
89
- assert_false path_is_absolute?('\\abc')
87
+ assert_false path_is_absolute?('\\')
88
+ assert_false path_is_absolute?('\\\\')
89
+ assert_false path_is_absolute?('\\abc')
90
90
 
91
- assert_false path_is_absolute?('/')
92
- assert_false path_is_absolute?('//')
93
- assert_false path_is_absolute?('/abc')
94
- else
91
+ assert_false path_is_absolute?('/')
92
+ assert_false path_is_absolute?('//')
93
+ assert_false path_is_absolute?('/abc')
94
+ else
95
95
 
96
- assert path_is_absolute?('/')
97
- assert path_is_absolute?('//')
98
- assert path_is_absolute?('/abc')
99
- end
100
- end
96
+ assert path_is_absolute?('/')
97
+ assert path_is_absolute?('//')
98
+ assert path_is_absolute?('/abc')
99
+ end
100
+ end
101
101
 
102
- def test_absolute_paths_from_home
102
+ def test_absolute_paths_from_home
103
103
 
104
- assert path_is_absolute?('~')
105
- assert path_is_absolute?('~/')
106
- assert path_is_absolute?('~/abc')
107
- end
104
+ assert path_is_absolute?('~')
105
+ assert path_is_absolute?('~/')
106
+ assert path_is_absolute?('~/abc')
107
+ end
108
108
 
109
- def test_relative_paths
109
+ def test_relative_paths
110
110
 
111
- assert_false path_is_absolute?('abc')
112
- assert_false path_is_absolute?('abc/')
113
- assert_false path_is_absolute?('a/')
111
+ assert_false path_is_absolute?('abc')
112
+ assert_false path_is_absolute?('abc/')
113
+ assert_false path_is_absolute?('a/')
114
114
 
115
- assert_false path_is_absolute?('~abc')
116
- end
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
- include ::LibPath::Form
121
+ include ::LibPath::Form
122
122
 
123
- if $DEBUG
123
+ if $DEBUG
124
124
 
125
- def test_with_nil
125
+ def test_with_nil
126
126
 
127
- assert_raise(::ArgumentError) { path_is_homed?(nil) }
128
- end
129
- end
127
+ assert_raise(::ArgumentError) { path_is_homed?(nil) }
128
+ end
129
+ end
130
130
 
131
- def test_empty
131
+ def test_empty
132
132
 
133
- assert_false path_is_homed?('')
134
- end
133
+ assert_false path_is_homed?('')
134
+ end
135
135
 
136
- if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
136
+ if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
137
137
 
138
- def test_absolute_paths_from_UNC
138
+ def test_absolute_paths_from_UNC
139
139
 
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')
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
- 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\\')
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
- 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\\')
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
- 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
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
- if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
162
+ if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
163
163
 
164
- def test_absolute_paths_from_drive
164
+ def test_absolute_paths_from_drive
165
165
 
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
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
- def test_absolute_paths_from_root
172
+ def test_absolute_paths_from_root
173
173
 
174
- if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
174
+ if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
175
175
 
176
- assert_false path_is_homed?('\\')
177
- assert_false path_is_homed?('\\\\')
178
- assert_false path_is_homed?('\\abc')
179
- end
176
+ assert_false path_is_homed?('\\')
177
+ assert_false path_is_homed?('\\\\')
178
+ assert_false path_is_homed?('\\abc')
179
+ end
180
180
 
181
- assert_false path_is_homed?('/')
182
- assert_false path_is_homed?('//')
183
- assert_false path_is_homed?('/abc')
184
- end
181
+ assert_false path_is_homed?('/')
182
+ assert_false path_is_homed?('//')
183
+ assert_false path_is_homed?('/abc')
184
+ end
185
185
 
186
- def test_absolute_paths_from_home
186
+ def test_absolute_paths_from_home
187
187
 
188
- assert path_is_homed?('~')
189
- assert path_is_homed?('~/')
190
- assert path_is_homed?('~/abc')
191
- end
188
+ assert path_is_homed?('~')
189
+ assert path_is_homed?('~/')
190
+ assert path_is_homed?('~/abc')
191
+ end
192
192
 
193
- def test_relative_paths
193
+ def test_relative_paths
194
194
 
195
- assert_false path_is_homed?('abc')
196
- assert_false path_is_homed?('abc/')
197
- assert_false path_is_homed?('a/')
195
+ assert_false path_is_homed?('abc')
196
+ assert_false path_is_homed?('abc/')
197
+ assert_false path_is_homed?('a/')
198
198
 
199
- assert_false path_is_homed?('~abc')
200
- end
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
- include ::LibPath::Form
205
+ include ::LibPath::Form
206
206
 
207
- if $DEBUG
207
+ if $DEBUG
208
208
 
209
- def test_with_nil
209
+ def test_with_nil
210
210
 
211
- assert_raise(::ArgumentError) { path_is_rooted?(nil) }
212
- end
213
- end
211
+ assert_raise(::ArgumentError) { path_is_rooted?(nil) }
212
+ end
213
+ end
214
214
 
215
- def test_empty
215
+ def test_empty
216
216
 
217
- assert_false path_is_rooted?('')
218
- end
217
+ assert_false path_is_rooted?('')
218
+ end
219
219
 
220
- if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
220
+ if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
221
221
 
222
- def test_absolute_paths_from_UNC
222
+ def test_absolute_paths_from_UNC
223
223
 
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')
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
- 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\\')
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
- 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\\')
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
- 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
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
- if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
246
+ if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
247
247
 
248
- def test_absolute_paths_from_drive
248
+ def test_absolute_paths_from_drive
249
249
 
250
- assert path_is_rooted?('C:\\')
251
- assert path_is_rooted?('C:\\abc')
252
- assert path_is_rooted?('C:\\abc\\')
250
+ assert path_is_rooted?('C:\\')
251
+ assert path_is_rooted?('C:\\abc')
252
+ assert path_is_rooted?('C:\\abc\\')
253
253
 
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
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
- def test_absolute_paths_from_root
260
+ def test_absolute_paths_from_root
261
261
 
262
- if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
262
+ if ::LibPath::Internal_::Platform::Constants::PLATFORM_IS_WINDOWS then
263
263
 
264
- assert path_is_rooted?('\\')
265
- assert_false path_is_rooted?('\\\\')
266
- assert path_is_rooted?('\\abc')
267
- end
264
+ assert path_is_rooted?('\\')
265
+ assert_false path_is_rooted?('\\\\')
266
+ assert path_is_rooted?('\\abc')
267
+ end
268
268
 
269
- assert path_is_rooted?('/')
270
- assert path_is_rooted?('//')
271
- assert path_is_rooted?('/abc')
272
- end
269
+ assert path_is_rooted?('/')
270
+ assert path_is_rooted?('//')
271
+ assert path_is_rooted?('/abc')
272
+ end
273
273
 
274
- def test_absolute_paths_from_home
274
+ def test_absolute_paths_from_home
275
275
 
276
- assert_false path_is_rooted?('~')
277
- assert_false path_is_rooted?('~/')
278
- assert_false path_is_rooted?('~/abc')
279
- end
276
+ assert_false path_is_rooted?('~')
277
+ assert_false path_is_rooted?('~/')
278
+ assert_false path_is_rooted?('~/abc')
279
+ end
280
280
 
281
- def test_relative_paths
281
+ def test_relative_paths
282
282
 
283
- assert_false path_is_rooted?('abc')
284
- assert_false path_is_rooted?('abc/')
285
- assert_false path_is_rooted?('a/')
283
+ assert_false path_is_rooted?('abc')
284
+ assert_false path_is_rooted?('abc/')
285
+ assert_false path_is_rooted?('a/')
286
286
 
287
- assert_false path_is_rooted?('~abc')
288
- end
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
- class Test_path_is_UNCs < Test::Unit::TestCase
293
+ class Test_path_is_UNCs < Test::Unit::TestCase
294
294
 
295
- include ::LibPath::Form
295
+ include ::LibPath::Form
296
296
 
297
- if $DEBUG
297
+ if $DEBUG
298
298
 
299
- def test_with_nil
299
+ def test_with_nil
300
300
 
301
- assert_raise(::ArgumentError) { path_is_UNC?(nil) }
302
- end
303
- end
301
+ assert_raise(::ArgumentError) { path_is_UNC?(nil) }
302
+ end
303
+ end
304
304
 
305
- def test_empty
305
+ def test_empty
306
306
 
307
- assert_false path_is_UNC?('')
308
- end
307
+ assert_false path_is_UNC?('')
308
+ end
309
309
 
310
- def test_absolute_paths_from_drive
310
+ def test_absolute_paths_from_drive
311
311
 
312
- assert_false path_is_UNC?('C:\\')
313
- assert_false path_is_UNC?('C:\\\\')
314
- assert_false path_is_UNC?('C:\\abc\\')
315
- end
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
- def test_absolute_paths_from_UNC
317
+ def test_absolute_paths_from_UNC
318
318
 
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')
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
- 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\\')
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
- 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\\')
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
- 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
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
- def test_absolute_paths_from_root
340
+ def test_absolute_paths_from_root
341
341
 
342
- assert_false path_is_UNC?('\\')
343
- assert_false path_is_UNC?('\\\\')
344
- assert_false path_is_UNC?('\\abc')
342
+ assert_false path_is_UNC?('\\')
343
+ assert_false path_is_UNC?('\\\\')
344
+ assert_false path_is_UNC?('\\abc')
345
345
 
346
- assert_false path_is_UNC?('/')
347
- assert_false path_is_UNC?('//')
348
- assert_false path_is_UNC?('/abc')
349
- end
346
+ assert_false path_is_UNC?('/')
347
+ assert_false path_is_UNC?('//')
348
+ assert_false path_is_UNC?('/abc')
349
+ end
350
350
 
351
- def test_absolute_paths_from_home
351
+ def test_absolute_paths_from_home
352
352
 
353
- assert_false path_is_UNC?('~')
354
- assert_false path_is_UNC?('~/')
355
- assert_false path_is_UNC?('~/abc')
356
- end
353
+ assert_false path_is_UNC?('~')
354
+ assert_false path_is_UNC?('~/')
355
+ assert_false path_is_UNC?('~/abc')
356
+ end
357
357
 
358
- def test_relative_paths
358
+ def test_relative_paths
359
359
 
360
- assert_false path_is_UNC?('abc')
361
- assert_false path_is_UNC?('abc/')
362
- assert_false path_is_UNC?('a/')
360
+ assert_false path_is_UNC?('abc')
361
+ assert_false path_is_UNC?('abc/')
362
+ assert_false path_is_UNC?('a/')
363
363
 
364
- assert_false path_is_UNC?('~abc')
365
- end
366
- end
364
+ assert_false path_is_UNC?('~abc')
365
+ end
366
+ end
367
367
  end
368
368
 
369
369
 
370
+ # ############################## end of file ############################# #
371
+
@@ -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