pathname2 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +5 -0
  4. data/CHANGES +171 -0
  5. data/LICENSE +177 -0
  6. data/MANIFEST +40 -0
  7. data/README +97 -0
  8. data/Rakefile +222 -0
  9. data/benchmarks/bench_pathname.rb +127 -0
  10. data/benchmarks/bench_plus.rb +34 -0
  11. data/certs/djberg96_pub.pem +26 -0
  12. data/examples/example_pathname.rb +25 -0
  13. data/lib/pathname2.rb +1140 -0
  14. data/pathname2.gemspec +46 -0
  15. data/test/test_pathname.rb +486 -0
  16. data/test/test_version.rb +17 -0
  17. data/test/windows/test_append.rb +59 -0
  18. data/test/windows/test_aref.rb +37 -0
  19. data/test/windows/test_ascend.rb +51 -0
  20. data/test/windows/test_children.rb +42 -0
  21. data/test/windows/test_clean.rb +50 -0
  22. data/test/windows/test_clean_bang.rb +50 -0
  23. data/test/windows/test_constructor.rb +48 -0
  24. data/test/windows/test_descend.rb +51 -0
  25. data/test/windows/test_drive_number.rb +58 -0
  26. data/test/windows/test_each.rb +28 -0
  27. data/test/windows/test_facade.rb +64 -0
  28. data/test/windows/test_is_absolute.rb +47 -0
  29. data/test/windows/test_is_relative.rb +46 -0
  30. data/test/windows/test_is_root.rb +44 -0
  31. data/test/windows/test_is_unc.rb +51 -0
  32. data/test/windows/test_join.rb +52 -0
  33. data/test/windows/test_long_path.rb +41 -0
  34. data/test/windows/test_misc.rb +33 -0
  35. data/test/windows/test_parent.rb +37 -0
  36. data/test/windows/test_pstrip.rb +42 -0
  37. data/test/windows/test_pstrip_bang.rb +46 -0
  38. data/test/windows/test_realpath.rb +39 -0
  39. data/test/windows/test_relative_path_from.rb +60 -0
  40. data/test/windows/test_root.rb +59 -0
  41. data/test/windows/test_short_path.rb +41 -0
  42. data/test/windows/test_to_a.rb +46 -0
  43. data/test/windows/test_undecorate.rb +47 -0
  44. data/test/windows/test_undecorate_bang.rb +53 -0
  45. metadata +176 -0
  46. metadata.gz.sig +1 -0
@@ -0,0 +1,46 @@
1
+ require 'rubygems'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'pathname2'
5
+ spec.version = '1.8.2'
6
+ spec.author = 'Daniel J. Berger'
7
+ spec.license = 'Apache-2.0'
8
+ spec.email = 'djberg96@gmail.com'
9
+ spec.homepage = 'https://github.com/djberg96/pathname2'
10
+ spec.summary = 'An alternate implementation of the Pathname class'
11
+ spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
12
+ spec.cert_chain = ['certs/djberg96_pub.pem']
13
+
14
+ spec.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
15
+
16
+ spec.add_dependency('facade')
17
+ spec.add_development_dependency('test-unit')
18
+ spec.add_development_dependency('rake')
19
+
20
+ spec.metadata = {
21
+ 'homepage_uri' => 'https://github.com/djberg96/pathname2',
22
+ 'bug_tracker_uri' => 'https://github.com/djberg96/pathname2/issues',
23
+ 'changelog_uri' => 'https://github.com/djberg96/pathname2/blob/ffi/CHANGES',
24
+ 'documentation_uri' => 'https://github.com/djberg96/pathname2/wiki',
25
+ 'source_code_uri' => 'https://github.com/djberg96/pathname2',
26
+ 'wiki_uri' => 'https://github.com/djberg96/pathname2/wiki'
27
+ }
28
+
29
+ if File::ALT_SEPARATOR
30
+ spec.add_dependency('ffi')
31
+ spec.test_files = FileList['test/windows/*.rb', 'test/test_version.rb']
32
+ spec.platform = Gem::Platform.new(['universal', 'mingw32'])
33
+ else
34
+ spec.test_files = FileList['test/test_pathname.rb', 'test/test_version.rb']
35
+ end
36
+
37
+ spec.description = <<-EOF
38
+ The pathname2 library provides an implementation of the Pathname
39
+ class different from the one that ships as part of the Ruby standard
40
+ library. It is a subclass of String, though several methods have been
41
+ overridden to better fit a path context. In addition, it supports file
42
+ URL's as paths, provides additional methods for Windows paths, and
43
+ handles UNC paths on Windows properly. See the README file for more
44
+ details.
45
+ EOF
46
+ end
@@ -0,0 +1,486 @@
1
+ ##############################################################################
2
+ # test_pathname.rb
3
+ #
4
+ # Test suite for the pathname library on unixy platforms. This test suite
5
+ # should be run via the test rake task.
6
+ ##############################################################################
7
+ require 'pathname2'
8
+ require 'fileutils'
9
+ require 'rbconfig'
10
+ require 'test-unit'
11
+ include RbConfig
12
+
13
+ class MyPathname < Pathname; end
14
+
15
+ class TC_Pathname < Test::Unit::TestCase
16
+ def self.startup
17
+ Dir.chdir(File.expand_path(File.dirname(__FILE__)))
18
+ @@pwd = Dir.pwd
19
+ end
20
+
21
+ def setup
22
+ @abs_path = Pathname.new('/usr/local/bin')
23
+ @rel_path = Pathname.new('usr/local/bin')
24
+ @trl_path = Pathname.new('/usr/local/bin/')
25
+ @mul_path = Pathname.new('/usr/local/lib/local/lib')
26
+ @rul_path = Pathname.new('usr/local/lib/local/lib')
27
+ @url_path = Pathname.new('file:///foo%20bar/baz')
28
+ @cur_path = Pathname.new(@@pwd)
29
+
30
+ @abs_array = []
31
+ @rel_array = []
32
+
33
+ @mypath = MyPathname.new('/usr/bin')
34
+
35
+ @test_file = 'realpath_test.txt'
36
+ @link_file = 'realpath_symlink.txt'
37
+ @link_file2 = 'realpath_symlink2.txt'
38
+ end
39
+
40
+ # Convenience method to verify that the receiver was not modified
41
+ # except perhaps slashes
42
+ def assert_non_destructive
43
+ assert_equal('/usr/local/bin', @abs_path)
44
+ assert_equal('usr/local/bin', @rel_path)
45
+ end
46
+
47
+ # Convenience method for test_plus
48
+ def assert_pathname_plus(a, b, c)
49
+ a = Pathname.new(a)
50
+ b = Pathname.new(b)
51
+ c = Pathname.new(c)
52
+ assert_equal(a, b + c)
53
+ end
54
+
55
+ # Convenience method for test_spaceship operator
56
+ def assert_pathname_cmp(int, s1, s2)
57
+ p1 = Pathname.new(s1)
58
+ p2 = Pathname.new(s2)
59
+ result = p1 <=> p2
60
+ assert_equal(int, result)
61
+ end
62
+
63
+ # Convenience method for test_relative_path_from
64
+ def assert_relpath(result, dest, base)
65
+ assert_equal(result, Pathname.new(dest).relative_path_from(base))
66
+ end
67
+
68
+ # Convenience method for test_relative_path_from_expected_errors
69
+ def assert_relpath_err(to, from)
70
+ assert_raise(ArgumentError) { Pathname.new(to).relative_path_from(from) }
71
+ end
72
+
73
+ test "url_path returns expected result" do
74
+ assert_equal('/foo bar/baz', @url_path)
75
+ end
76
+
77
+ test "realpath basic functionality" do
78
+ FileUtils.touch(@test_file) && File.symlink(@test_file, @link_file)
79
+ assert_respond_to(@abs_path, :realpath)
80
+ assert_equal(@@pwd, Pathname.new('.').realpath)
81
+ assert_kind_of(Pathname, Pathname.new(@link_file).realpath)
82
+ end
83
+
84
+ test "realpath returns expected result for simple symlink" do
85
+ FileUtils.touch(@test_file) && File.symlink(@test_file, @link_file)
86
+ assert_true(Pathname.new(@link_file) != Pathname.new(@link_file).realpath)
87
+ assert_raises(Errno::ENOENT){ Pathname.new('../bogus').realpath }
88
+ end
89
+
90
+ test "realpath returns expected result for nested symlink" do
91
+ FileUtils.touch(@test_file) && File.symlink(@test_file, @link_file) && File.symlink(@link_file, @link_file2)
92
+ assert_true(Pathname.new(@link_file) != Pathname.new(@link_file2).realpath)
93
+ assert_equal(Pathname.new(@link_file).realpath, Pathname.new(@link_file2).realpath)
94
+ end
95
+
96
+ # These tests taken directly from Tanaka's pathname.rb. The one failure
97
+ # (commented out) is due to the fact that Tanaka's cleanpath method returns
98
+ # the cleanpath for '../a' as '../a' (i.e. it does nothing) whereas mine
99
+ # converts '../a' into just 'a'. Which is correct? I vote mine, because
100
+ # I don't see how you can get 'more relative' from a relative path not
101
+ # already in the pathname.
102
+ #
103
+ def test_relative_path_from
104
+ assert_relpath('../a', 'a', 'b')
105
+ assert_relpath('../a', 'a', 'b/')
106
+ assert_relpath('../a', 'a/', 'b')
107
+ assert_relpath('../a', 'a/', 'b/')
108
+ assert_relpath('../a', '/a', '/b')
109
+ assert_relpath('../a', '/a', '/b/')
110
+ assert_relpath('../a', '/a/', '/b')
111
+ assert_relpath('../a', '/a/', '/b/')
112
+
113
+ assert_relpath('../b', 'a/b', 'a/c')
114
+ assert_relpath('../a', '../a', '../b')
115
+
116
+ assert_relpath('a', 'a', '.')
117
+ assert_relpath('..', '.', 'a')
118
+
119
+ assert_relpath('.', '.', '.')
120
+ assert_relpath('.', '..', '..')
121
+ assert_relpath('..', '..', '.')
122
+
123
+ assert_relpath('c/d', '/a/b/c/d', '/a/b')
124
+ assert_relpath('../..', '/a/b', '/a/b/c/d')
125
+ assert_relpath('../../../../e', '/e', '/a/b/c/d')
126
+ assert_relpath('../b/c', 'a/b/c', 'a/d')
127
+
128
+ assert_relpath('../a', '/../a', '/b')
129
+ #assert_relpath('../../a', '../a', 'b') # fails
130
+ assert_relpath('.', '/a/../../b', '/b')
131
+ assert_relpath('..', 'a/..', 'a')
132
+ assert_relpath('.', 'a/../b', 'b')
133
+
134
+ assert_relpath('a', 'a', 'b/..')
135
+ assert_relpath('b/c', 'b/c', 'b/..')
136
+
137
+ assert_relpath_err('/', '.')
138
+ assert_relpath_err('.', '/')
139
+ assert_relpath_err('a', '..')
140
+ assert_relpath_err('.', '..')
141
+ end
142
+
143
+ def test_parent
144
+ assert_respond_to(@abs_path, :parent)
145
+ assert_equal('/usr/local', @abs_path.parent)
146
+ assert_equal('usr/local', @rel_path.parent)
147
+ assert_equal('/', Pathname.new('/').parent)
148
+ end
149
+
150
+ def test_pstrip
151
+ assert_respond_to(@trl_path, :pstrip)
152
+ assert_nothing_raised{ @trl_path.pstrip }
153
+ assert_equal('/usr/local/bin', @trl_path.pstrip)
154
+ assert_equal('/usr/local/bin/', @trl_path)
155
+ end
156
+
157
+ def test_pstrip_bang
158
+ assert_respond_to(@trl_path, :pstrip!)
159
+ assert_nothing_raised{ @trl_path.pstrip! }
160
+ assert_equal('/usr/local/bin', @trl_path.pstrip!)
161
+ assert_equal('/usr/local/bin', @trl_path)
162
+ end
163
+
164
+ def test_ascend
165
+ assert_respond_to(@abs_path, :ascend)
166
+ assert_nothing_raised{ @abs_path.ascend{} }
167
+
168
+ @abs_path.ascend{ |path| @abs_array.push(path) }
169
+ @rel_path.ascend{ |path| @rel_array.push(path) }
170
+
171
+ assert_equal('/usr/local/bin', @abs_array[0])
172
+ assert_equal('/usr/local', @abs_array[1])
173
+ assert_equal('/usr', @abs_array[2])
174
+ assert_equal('/', @abs_array[3])
175
+ assert_equal(4, @abs_array.length)
176
+
177
+ assert_equal('usr/local/bin', @rel_array[0])
178
+ assert_equal('usr/local', @rel_array[1])
179
+ assert_equal('usr', @rel_array[2])
180
+ assert_equal(3, @rel_array.length)
181
+
182
+ assert_non_destructive
183
+ end
184
+
185
+ def test_descend
186
+ assert_respond_to(@abs_path, :descend)
187
+ assert_nothing_raised{ @abs_path.descend{} }
188
+
189
+ @abs_path.descend{ |path| @abs_array.push(path) }
190
+ @rel_path.descend{ |path| @rel_array.push(path) }
191
+
192
+ assert_equal('/', @abs_array[0])
193
+ assert_equal('/usr', @abs_array[1])
194
+ assert_equal('/usr/local', @abs_array[2])
195
+ assert_equal('/usr/local/bin', @abs_array[3])
196
+ assert_equal(4, @abs_array.length)
197
+
198
+ assert_equal('usr', @rel_array[0])
199
+ assert_equal('usr/local', @rel_array[1])
200
+ assert_equal('usr/local/bin', @rel_array[2])
201
+ assert_equal(3, @rel_array.length)
202
+
203
+ assert_non_destructive
204
+ end
205
+
206
+ def test_children_with_directory
207
+ assert_respond_to(@cur_path, :children)
208
+ assert_nothing_raised{ @cur_path.children }
209
+ assert_kind_of(Array, @cur_path.children)
210
+
211
+ children = @cur_path.children.sort.reject{ |f| f.include?('git') || f.include?('.swp') }
212
+ assert_equal(
213
+ [
214
+ Dir.pwd + '/test_pathname.rb',
215
+ Dir.pwd + '/test_version.rb',
216
+ Dir.pwd + '/windows'
217
+ ],
218
+ children.sort
219
+ )
220
+ end
221
+
222
+ def test_children_without_directory
223
+ assert_nothing_raised{ @cur_path.children(false) }
224
+
225
+ children = @cur_path.children(false).reject{ |f| f.include?('git') || f.include?('.swp') }
226
+ assert_equal(['test_pathname.rb', 'test_version.rb', 'windows'], children.sort)
227
+ end
228
+
229
+ def test_unc
230
+ assert_raises(NotImplementedError){ @abs_path.unc? }
231
+ end
232
+
233
+ def test_enumerable
234
+ assert_respond_to(@abs_path, :each)
235
+ end
236
+
237
+ def test_root
238
+ assert_respond_to(@abs_path, :root)
239
+ assert_nothing_raised{ @abs_path.root }
240
+ assert_nothing_raised{ @rel_path.root }
241
+
242
+ assert_equal('/', @abs_path.root)
243
+ assert_equal('.', @rel_path.root)
244
+
245
+ assert_non_destructive
246
+ end
247
+
248
+ def test_root?
249
+ assert_respond_to(@abs_path, :root?)
250
+ assert_nothing_raised{ @abs_path.root? }
251
+ assert_nothing_raised{ @rel_path.root? }
252
+
253
+ path1 = Pathname.new('/')
254
+ path2 = Pathname.new('a')
255
+ assert_equal(true, path1.root?)
256
+ assert_equal(false, path2.root?)
257
+
258
+ assert_non_destructive
259
+ end
260
+
261
+ def test_absolute
262
+ assert_respond_to(@abs_path, :absolute?)
263
+ assert_nothing_raised{ @abs_path.absolute? }
264
+ assert_nothing_raised{ @rel_path.absolute? }
265
+
266
+ assert_equal(true, @abs_path.absolute?)
267
+ assert_equal(false, @rel_path.absolute?)
268
+
269
+ assert_equal(true, Pathname.new('/usr/bin/ruby').absolute?)
270
+ assert_equal(false, Pathname.new('foo').absolute?)
271
+ assert_equal(false, Pathname.new('foo/bar').absolute?)
272
+ assert_equal(false, Pathname.new('../foo/bar').absolute?)
273
+
274
+ assert_non_destructive
275
+ end
276
+
277
+ def test_relative
278
+ assert_respond_to(@abs_path, :relative?)
279
+ assert_nothing_raised{ @abs_path.relative? }
280
+ assert_nothing_raised{ @rel_path.relative? }
281
+
282
+ assert_equal(false, @abs_path.relative?)
283
+ assert_equal(true, @rel_path.relative?)
284
+
285
+ assert_equal(false, Pathname.new('/usr/bin/ruby').relative?)
286
+ assert_equal(true, Pathname.new('foo').relative?)
287
+ assert_equal(true, Pathname.new('foo/bar').relative?)
288
+ assert_equal(true, Pathname.new('../foo/bar').relative?)
289
+
290
+ assert_non_destructive
291
+ end
292
+
293
+ def test_to_a
294
+ assert_respond_to(@abs_path, :to_a)
295
+ assert_nothing_raised{ @abs_path.to_a }
296
+ assert_nothing_raised{ @rel_path.to_a }
297
+ assert_kind_of(Array, @abs_path.to_a)
298
+ assert_equal(%w/usr local bin/, @abs_path.to_a)
299
+
300
+ assert_non_destructive
301
+ end
302
+
303
+ def test_spaceship_operator
304
+ assert_respond_to(@abs_path, :<=>)
305
+
306
+ assert_pathname_cmp( 0, '/foo/bar', '/foo/bar')
307
+ assert_pathname_cmp(-1, '/foo/bar', '/foo/zap')
308
+ assert_pathname_cmp( 1, '/foo/zap', '/foo/bar')
309
+ assert_pathname_cmp(-1, 'foo', 'foo/')
310
+ assert_pathname_cmp(-1, 'foo/', 'foo/bar')
311
+ end
312
+
313
+ def test_plus_operator
314
+ assert_respond_to(@abs_path, :+)
315
+
316
+ # Standard stuff
317
+ assert_pathname_plus('/foo/bar', '/foo', 'bar')
318
+ assert_pathname_plus('foo/bar', 'foo', 'bar')
319
+ assert_pathname_plus('foo', 'foo', '.')
320
+ assert_pathname_plus('foo', '.', 'foo')
321
+ assert_pathname_plus('/foo', 'bar', '/foo')
322
+ assert_pathname_plus('foo', 'foo/bar', '..')
323
+ assert_pathname_plus('/foo', '/', '../foo')
324
+ assert_pathname_plus('foo/zap', 'foo/bar', '../zap')
325
+ assert_pathname_plus('.', 'foo', '..')
326
+ assert_pathname_plus('foo', '..', 'foo') # Auto clean
327
+ assert_pathname_plus('foo', '..', '../foo') # Auto clean
328
+
329
+ # Edge cases
330
+ assert_pathname_plus('.', '.', '.')
331
+ assert_pathname_plus('/', '/', '..')
332
+ assert_pathname_plus('.', '..', '..')
333
+ assert_pathname_plus('.', 'foo', '..')
334
+
335
+ # Alias
336
+ assert_equal('/foo/bar', Pathname.new('/foo') / Pathname.new('bar'))
337
+ end
338
+
339
+ # Any tests marked with '***' mean that this behavior is different than
340
+ # the current implementation. It also means I disagree with the current
341
+ # implementation.
342
+ def test_clean
343
+ # Standard stuff
344
+ assert_equal('/a/b/c', Pathname.new('/a/b/c').cleanpath)
345
+ assert_equal('b/c', Pathname.new('./b/c').cleanpath)
346
+ assert_equal('a', Pathname.new('a/.').cleanpath) # ***
347
+ assert_equal('a/c', Pathname.new('a/./c').cleanpath)
348
+ assert_equal('a/b', Pathname.new('a/b/.').cleanpath) # ***
349
+ assert_equal('.', Pathname.new('a/../.').cleanpath) # ***
350
+ assert_equal('/a', Pathname.new('/a/b/..').cleanpath)
351
+ assert_equal('/b', Pathname.new('/a/../b').cleanpath)
352
+ assert_equal('d', Pathname.new('a/../../d').cleanpath) # ***
353
+
354
+ # Edge cases
355
+ assert_equal('', Pathname.new('').cleanpath)
356
+ assert_equal('.', Pathname.new('.').cleanpath)
357
+ assert_equal('..', Pathname.new('..').cleanpath)
358
+ assert_equal('/', Pathname.new('/').cleanpath)
359
+ assert_equal('/', Pathname.new('//').cleanpath)
360
+
361
+ assert_non_destructive
362
+ end
363
+
364
+ def test_dirname_basic
365
+ assert_respond_to(@abs_path, :dirname)
366
+ assert_nothing_raised{ @abs_path.dirname }
367
+ assert_kind_of(String, @abs_path.dirname)
368
+ end
369
+
370
+ def test_dirname
371
+ assert_equal('/usr/local', @abs_path.dirname)
372
+ assert_equal('/usr/local/bin', @abs_path.dirname(0))
373
+ assert_equal('/usr/local', @abs_path.dirname(1))
374
+ assert_equal('/usr', @abs_path.dirname(2))
375
+ assert_equal('/', @abs_path.dirname(3))
376
+ assert_equal('/', @abs_path.dirname(9))
377
+ end
378
+
379
+ def test_dirname_expected_errors
380
+ assert_raise(ArgumentError){ @abs_path.dirname(-1) }
381
+ end
382
+
383
+ def test_facade_io
384
+ assert_respond_to(@abs_path, :foreach)
385
+ assert_respond_to(@abs_path, :read)
386
+ assert_respond_to(@abs_path, :readlines)
387
+ assert_respond_to(@abs_path, :sysopen)
388
+ end
389
+
390
+ def test_facade_file
391
+ File.methods(false).each{ |method|
392
+ assert_respond_to(@abs_path, method.to_sym)
393
+ }
394
+ end
395
+
396
+ def test_facade_dir
397
+ Dir.methods(false).each{ |method|
398
+ assert_respond_to(@abs_path, method.to_sym)
399
+ }
400
+ end
401
+
402
+ def test_facade_fileutils
403
+ methods = FileUtils.public_instance_methods
404
+ methods -= File.methods(false)
405
+ methods -= Dir.methods(false)
406
+ methods.delete_if{ |m| m.to_s =~ /stream/ }
407
+ methods.delete(:identical?)
408
+ methods.delete(:sh)
409
+ methods.delete(:ruby)
410
+ methods.delete(:safe_ln)
411
+ methods.delete(:split_all)
412
+
413
+ methods.each{ |method|
414
+ assert_respond_to(@abs_path, method.to_sym)
415
+ }
416
+ end
417
+
418
+ def test_facade_find
419
+ assert_respond_to(@abs_path, :find)
420
+ assert_nothing_raised{ @abs_path.find{} }
421
+
422
+ Pathname.new(Dir.pwd).find{ |f|
423
+ Find.prune if f.match('CVS')
424
+ assert_kind_of(Pathname, f)
425
+ }
426
+ end
427
+
428
+ # Ensures that subclasses return the subclass as the class, not a hard
429
+ # coded Pathname.
430
+ #
431
+ def test_subclasses
432
+ assert_kind_of(MyPathname, @mypath)
433
+ assert_kind_of(MyPathname, @mypath + MyPathname.new('foo'))
434
+ assert_kind_of(MyPathname, @mypath.realpath)
435
+ assert_kind_of(MyPathname, @mypath.children.first)
436
+ end
437
+
438
+ # Test to ensure that the pn{ } shortcut works
439
+ #
440
+ def test_kernel_method
441
+ assert_respond_to(Kernel, :pn)
442
+ assert_nothing_raised{ pn{'/foo'} }
443
+ assert_kind_of(Pathname, pn{'/foo'})
444
+ assert_equal('/foo', pn{'/foo'})
445
+ end
446
+
447
+ def test_pwd_singleton_method
448
+ assert_respond_to(Pathname, :pwd)
449
+ assert_kind_of(String, Pathname.pwd)
450
+ assert_equal(@@pwd, Pathname.pwd)
451
+ end
452
+
453
+ test "String#to_path instance method is implemented" do
454
+ string = "/usr/local/bin"
455
+ assert_respond_to(string, :to_path)
456
+ assert_nothing_raised{ string.to_path }
457
+ assert_kind_of(Pathname, string.to_path)
458
+ end
459
+
460
+ def teardown
461
+ @abs_path = nil
462
+ @rel_path = nil
463
+ @trl_path = nil
464
+ @mul_path = nil
465
+ @rul_path = nil
466
+ @cur_path = nil
467
+ @abs_path = nil
468
+ @rel_path = nil
469
+ @cur_path = nil
470
+ @mypath = nil
471
+ @abs_array.clear
472
+ @rel_array.clear
473
+
474
+ File.delete(@link_file2) if File.exist?(@link_file2)
475
+ File.delete(@link_file) if File.exist?(@link_file)
476
+ File.delete(@test_file) if File.exist?(@test_file)
477
+
478
+ @link_file2 = nil
479
+ @link_file = nil
480
+ @test_file = nil
481
+ end
482
+
483
+ def self.shutdown
484
+ @@pwd = nil
485
+ end
486
+ end