recls-ruby 2.12.0.1 → 2.13.0
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.
- checksums.yaml +4 -4
- data/examples/show_hidden_files.md +1 -1
- data/examples/show_hidden_files.rb +1 -1
- data/examples/show_readonly_files.md +1 -1
- data/examples/show_readonly_files.rb +1 -1
- data/lib/recls/api.rb +2 -2
- data/lib/recls/combine_paths_1.rb +4 -3
- data/lib/recls/combine_paths_2plus.rb +4 -3
- data/lib/recls/entry.rb +30 -0
- data/lib/recls/file_search.rb +1 -1
- data/lib/recls/recls.rb +16 -10
- data/lib/recls/stat.rb +10 -5
- data/lib/recls/util.rb +2 -8
- data/lib/recls/version.rb +1 -1
- data/lib/recls/ximpl/util.rb +8 -4
- data/test/unit/tc_recls_entry.rb +16 -1
- data/test/unit/tc_recls_util.rb +47 -15
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d6532f17abe260ced9482626db483f1f41d27e9bb152bbd870b5b525bba4399
|
4
|
+
data.tar.gz: eb78ee7591a8014fa293b236ef5e7ae8a35ecd3559105ea07eab6fe132e37955
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 730ea68a021a6657485d618aaf10cc42284a138330c4e5b8e2c48ebafef46f1955b26ada22a9008aa6b9f3bacb6271354f6dd07fe179177165892299f5a35fde
|
7
|
+
data.tar.gz: 0d57bec94aaa38ec8cd3d1577570e571e00fd3fd503d621ba4cd65325e49ff7f215977cb7b12a3d6260aef00523fd37bef248c5a7cb92b83532b16d89640ccb7
|
data/lib/recls/api.rb
CHANGED
@@ -66,7 +66,7 @@ module Recls
|
|
66
66
|
# - +options+ (+Hash+, +Integer+) Combination of flags (with behaviour as described below for the +flags+ option), or an options hash;
|
67
67
|
#
|
68
68
|
# * *Options:*
|
69
|
-
# - +flags+ (+Integer+) Combination of flags - +Recls::FILES+, +Recls::DIRECTORIES+, etc. If the value modulo +Recls::TYPEMASK+ is 0, then +Recls::FILES+ is assumed. The value +Recls::RECURSIVE+ is added by the function, and so need not be added by the caller; it cannot be removed
|
69
|
+
# - +flags+ (+Integer+) Combination of flags - +Recls::FILES+, +Recls::DIRECTORIES+, etc. If the value modulo +Recls::TYPEMASK+ is 0, then +Recls::FILES+ is assumed. The value +Recls::RECURSIVE+ is added by the function, and so need not be added by the caller; it cannot be removed;
|
70
70
|
#
|
71
71
|
# === Return
|
72
72
|
# An instance of a class implementing +Enumerable+ whose value type is
|
@@ -105,7 +105,7 @@ module Recls
|
|
105
105
|
# - +options+ (+Hash+, +Integer+) Combination of flags (with behaviour as described below for the +flags+ option), or an options hash;
|
106
106
|
#
|
107
107
|
# * *Options:*
|
108
|
-
# - +flags+ (+Integer+) Combination of flags - +Recls::FILES+, +Recls::DIRECTORIES+, +Recls::RECURSIVE+, etc. If the value modulo +Recls::TYPEMASK+ is 0, then +Recls::FILES+ is assumed
|
108
|
+
# - +flags+ (+Integer+) Combination of flags - +Recls::FILES+, +Recls::DIRECTORIES+, +Recls::RECURSIVE+, etc. If the value modulo +Recls::TYPEMASK+ is 0, then +Recls::FILES+ is assumed;
|
109
109
|
#
|
110
110
|
# === Return
|
111
111
|
# An instance of a class implementing +Enumerable+ whose value type is
|
@@ -53,17 +53,18 @@ module Recls
|
|
53
53
|
# === Signature
|
54
54
|
#
|
55
55
|
# * *Parameters:*
|
56
|
-
# - +paths+ (+[ String, Recls::Entry ]+) Array of 1 or more path elements to be combined;
|
56
|
+
# - +paths+ (+[ (String, Recls::Entry) ]+) Array of 1 or more path elements to be combined;
|
57
57
|
#
|
58
58
|
# === Return
|
59
59
|
# (+String+) The combined path.
|
60
60
|
def self.combine_paths(*paths)
|
61
61
|
|
62
|
-
paths
|
63
|
-
paths = paths.map { |p| 'Recls::Entry' == p.class.to_s ? p.path : p }
|
62
|
+
paths.reject! { |p| p.nil? }
|
64
63
|
|
65
64
|
raise ArgumentError, 'must specify one or more path elements' if paths.empty?
|
66
65
|
|
66
|
+
ix_last_entry = paths.rindex { |path| ::Recls::Entry === path } and return paths[ix_last_entry]
|
67
|
+
|
67
68
|
return Recls::Ximpl.combine_paths paths, {}
|
68
69
|
end
|
69
70
|
end # module Recls
|
@@ -53,7 +53,7 @@ module Recls
|
|
53
53
|
# === Signature
|
54
54
|
#
|
55
55
|
# * *Parameters:*
|
56
|
-
# - +paths+ (+[ String, Recls::Entry ]+) Array of 1 or more path elements to be combined;
|
56
|
+
# - +paths+ (+[ (String, Recls::Entry) ]+) Array of 1 or more path elements to be combined;
|
57
57
|
# - +options+ (+Hash+) Options that moderate the combination;
|
58
58
|
#
|
59
59
|
# * *Options:*
|
@@ -65,11 +65,12 @@ module Recls
|
|
65
65
|
# (+String+) The combined path.
|
66
66
|
def self.combine_paths(*paths, **options)
|
67
67
|
|
68
|
-
paths
|
69
|
-
paths = paths.map { |p| 'Recls::Entry' == p.class.to_s ? p.path : p }
|
68
|
+
paths.reject! { |p| p.nil? }
|
70
69
|
|
71
70
|
raise ArgumentError, 'must specify one or more path elements' if paths.empty?
|
72
71
|
|
72
|
+
ix_last_entry = paths.rindex { |path| ::Recls::Entry === path } and return paths[ix_last_entry]
|
73
|
+
|
73
74
|
return Recls::Ximpl.combine_paths paths, options
|
74
75
|
end
|
75
76
|
end # module Recls
|
data/lib/recls/entry.rb
CHANGED
@@ -398,5 +398,35 @@ module Recls
|
|
398
398
|
end # module Recls
|
399
399
|
|
400
400
|
|
401
|
+
# We now monkey-patch `::String` cautiously, to facilitate constructs such
|
402
|
+
# as:
|
403
|
+
#
|
404
|
+
# cwd = Recls.stat @cwd
|
405
|
+
# assert_equal @cwd, cwd
|
406
|
+
|
407
|
+
|
408
|
+
=begin
|
409
|
+
=end
|
410
|
+
|
411
|
+
# @!visibility private
|
412
|
+
class String # :nodoc:
|
413
|
+
|
414
|
+
# TODO: work out if can use `super` for all supported versions of Ruby
|
415
|
+
|
416
|
+
# @!visibility private
|
417
|
+
alias_method :String_modified_for_Recls_Entry_for_original_op_eq, :== # :nodoc:
|
418
|
+
|
419
|
+
def == rhs
|
420
|
+
|
421
|
+
if ::Recls::Entry === rhs
|
422
|
+
|
423
|
+
rhs = rhs.path
|
424
|
+
end
|
425
|
+
|
426
|
+
String_modified_for_Recls_Entry_for_original_op_eq rhs
|
427
|
+
end
|
428
|
+
end
|
429
|
+
|
430
|
+
|
401
431
|
# ############################## end of file ############################# #
|
402
432
|
|
data/lib/recls/file_search.rb
CHANGED
@@ -89,7 +89,7 @@ module Recls
|
|
89
89
|
flags = options[:flags] || 0
|
90
90
|
else
|
91
91
|
|
92
|
-
raise ArgumentError, "options parameter must a
|
92
|
+
raise ArgumentError, "options parameter must a `#{::Hash}`, `nil`, or an integer specifying flags - an instance of `#{options.class}` given"
|
93
93
|
end
|
94
94
|
|
95
95
|
|
data/lib/recls/recls.rb
CHANGED
@@ -37,16 +37,6 @@
|
|
37
37
|
# ######################################################################## #
|
38
38
|
|
39
39
|
|
40
|
-
require 'recls/version'
|
41
|
-
|
42
|
-
require 'recls/api'
|
43
|
-
require 'recls/entry'
|
44
|
-
require 'recls/file_search'
|
45
|
-
require 'recls/foreach'
|
46
|
-
require 'recls/stat'
|
47
|
-
require 'recls/util'
|
48
|
-
require 'recls/ximpl/os'
|
49
|
-
|
50
40
|
# The *recls* module
|
51
41
|
#
|
52
42
|
# == Significant Components
|
@@ -62,6 +52,21 @@ require 'recls/ximpl/os'
|
|
62
52
|
# - Recls::file_search
|
63
53
|
# - Recls::foreach
|
64
54
|
# - Recls::stat
|
55
|
+
module Recls
|
56
|
+
end # module Recls
|
57
|
+
|
58
|
+
|
59
|
+
require 'recls/version'
|
60
|
+
|
61
|
+
require 'recls/api'
|
62
|
+
require 'recls/entry'
|
63
|
+
require 'recls/file_search'
|
64
|
+
require 'recls/foreach'
|
65
|
+
require 'recls/stat'
|
66
|
+
require 'recls/util'
|
67
|
+
require 'recls/ximpl/os'
|
68
|
+
|
69
|
+
|
65
70
|
module Recls
|
66
71
|
|
67
72
|
# The string sequence used to separate names in paths, e.g. "/" on UNIX
|
@@ -80,6 +85,7 @@ module Recls
|
|
80
85
|
end
|
81
86
|
end # module Recls
|
82
87
|
|
88
|
+
|
83
89
|
require 'recls/obsolete'
|
84
90
|
|
85
91
|
|
data/lib/recls/stat.rb
CHANGED
@@ -109,7 +109,7 @@ module Recls
|
|
109
109
|
#
|
110
110
|
# * *Parameters:*
|
111
111
|
# - +path+ (+String+) A path to evaluate. May not be +nil+;
|
112
|
-
# - +search_root+ (+String+, +Recls::Entry+) A directory from which the returned Entry instance's search-relative attributes are evaluated;
|
112
|
+
# - +search_root+ (+String+, +Recls::Entry+) A directory from which the returned +Entry+ instance's search-relative attributes are evaluated;
|
113
113
|
# - +flags+ (+Integer+) A bit-combined set of flags (such as +Recls::DIRECTORIES+, +Recls::FILES+, +Recls::RECURSIVE+, +Recls::DETAILS_LATER+, and so on);
|
114
114
|
#
|
115
115
|
# ==== Parameter Ordering
|
@@ -132,12 +132,17 @@ module Recls
|
|
132
132
|
search_root = nil
|
133
133
|
message = nil
|
134
134
|
|
135
|
-
|
135
|
+
path_is_entry = ::Recls::Entry === path
|
136
|
+
|
137
|
+
unless path_is_entry
|
138
|
+
|
139
|
+
path = File.expand_path(path) if path =~ /^~[\\\/]*/
|
140
|
+
end
|
136
141
|
|
137
142
|
case args.size
|
138
143
|
when 0
|
139
144
|
|
140
|
-
|
145
|
+
return path if path_is_entry
|
141
146
|
when 1
|
142
147
|
|
143
148
|
case args[0]
|
@@ -149,7 +154,7 @@ module Recls
|
|
149
154
|
search_root = args[0]
|
150
155
|
else
|
151
156
|
|
152
|
-
message = "argument '#{args[0]}' (
|
157
|
+
message = "argument '#{args[0]}' (of type `#{args[0].class}`) not valid"
|
153
158
|
end
|
154
159
|
when 2
|
155
160
|
|
@@ -171,7 +176,7 @@ module Recls
|
|
171
176
|
message = "too many arguments"
|
172
177
|
end
|
173
178
|
|
174
|
-
raise ArgumentError, "#{message}: Recls.stat() takes one (path), two (path+flags or path+search_root), or three (path+search_root+flags) arguments" if message
|
179
|
+
raise ArgumentError, "#{message}: `Recls.stat()` takes one (path), two (path+flags or path+search_root), or three (path+search_root+flags) arguments" if message
|
175
180
|
|
176
181
|
Recls::Ximpl.stat_prep(path, search_root, flags)
|
177
182
|
end
|
data/lib/recls/util.rb
CHANGED
@@ -61,8 +61,6 @@ module Recls
|
|
61
61
|
# (+String+) The absolute form of the path.
|
62
62
|
def self.absolute_path(path)
|
63
63
|
|
64
|
-
return path.path if 'Recls::Entry' === path.class.to_s
|
65
|
-
|
66
64
|
Recls::Ximpl.absolute_path path
|
67
65
|
end
|
68
66
|
|
@@ -78,7 +76,7 @@ module Recls
|
|
78
76
|
# (+String+) The canonical form of the path.
|
79
77
|
def self.canonicalise_path(path)
|
80
78
|
|
81
|
-
|
79
|
+
return path.path if ::Recls::Entry === path
|
82
80
|
|
83
81
|
Recls::Ximpl.canonicalise_path path
|
84
82
|
end
|
@@ -132,16 +130,12 @@ module Recls
|
|
132
130
|
# === Signature
|
133
131
|
#
|
134
132
|
# * *Parameters:*
|
135
|
-
# - +path+ (+String+, +Recls::Entry+) The path;
|
133
|
+
# - +path+ (+String+, +Recls::Entry+, +nil+) The path to be evaluated;
|
136
134
|
#
|
137
135
|
# === Return
|
138
136
|
# (boolean) +true+ if +path+ is absolute; +false+ otherwise.
|
139
137
|
def self.absolute_path?(path)
|
140
138
|
|
141
|
-
return nil if path.nil?
|
142
|
-
|
143
|
-
return true if 'Recls::Entry' === path.class.to_s
|
144
|
-
|
145
139
|
Recls::Ximpl.absolute_path? path
|
146
140
|
end
|
147
141
|
end # module Recls
|
data/lib/recls/version.rb
CHANGED
data/lib/recls/ximpl/util.rb
CHANGED
@@ -454,6 +454,8 @@ module Recls # :nodoc:
|
|
454
454
|
# @!visibility private
|
455
455
|
def self.canonicalise_path(path) # :nodoc:
|
456
456
|
|
457
|
+
raise ArgumentError, "`path` must be an instance of `::String` or `nil`" if $DEBUG && !path.nil? && !path.is_a?(::String)
|
458
|
+
|
457
459
|
return nil if not path
|
458
460
|
return '' if path.empty?
|
459
461
|
|
@@ -495,7 +497,7 @@ module Recls # :nodoc:
|
|
495
497
|
return path
|
496
498
|
else
|
497
499
|
|
498
|
-
raise TypeError, "parameter path ('#{path}') is of type
|
500
|
+
raise TypeError, "parameter path ('#{path}') is of type `#{path.class}` must be `nil` or an instance of `#{::String}` or `#{::Recls::Entry}`"
|
499
501
|
end
|
500
502
|
|
501
503
|
f1_windows_root, f2_directory, dummy1, dummy2, dummy3, dummy4, dummy5 = Util.split_path(path)
|
@@ -529,7 +531,7 @@ module Recls # :nodoc:
|
|
529
531
|
return path.path
|
530
532
|
else
|
531
533
|
|
532
|
-
raise TypeError, "parameter path ('#{path}') is of type
|
534
|
+
raise TypeError, "parameter path ('#{path}') is of type `#{path.class}` must be an instance of `#{::String}` or `#{::Recls::Entry}`"
|
533
535
|
end
|
534
536
|
|
535
537
|
return '' if path.empty?
|
@@ -776,7 +778,9 @@ module Recls # :nodoc:
|
|
776
778
|
# @!visibility private
|
777
779
|
def self.combine_paths(paths, options) # :nodoc:
|
778
780
|
|
779
|
-
|
781
|
+
raise ArgumentError, "`paths` must be an instance of `::Array`" if $DEBUG && !paths.is_a?(::Array)
|
782
|
+
raise ArgumentError, "`paths` elements must be instances of `::String`" if $DEBUG && paths.any? { |s| !s.is_a?(::String) }
|
783
|
+
|
780
784
|
abs_ix = 0
|
781
785
|
|
782
786
|
paths = paths.map { |path| '~' == path[0].to_s ? File.expand_path(path) : path }
|
@@ -840,7 +844,7 @@ module Recls # :nodoc:
|
|
840
844
|
|
841
845
|
rescue SystemCallError => x
|
842
846
|
|
843
|
-
$stderr.puts "exception (
|
847
|
+
$stderr.puts "exception (`#{x.class}`): #{x}" if $DEBUG
|
844
848
|
|
845
849
|
if(0 != (STOP_ON_ACCESS_FAILURE & flags))
|
846
850
|
|
data/test/unit/tc_recls_entry.rb
CHANGED
@@ -27,14 +27,29 @@ class Test_Recls_entry < Test::Unit::TestCase
|
|
27
27
|
cwd = Recls.stat @cwd
|
28
28
|
|
29
29
|
assert_equal @cwd, cwd.path
|
30
|
+
assert_equal @cwd, cwd
|
31
|
+
|
32
|
+
cwd2 = Recls.stat cwd
|
33
|
+
|
34
|
+
assert_equal @cwd, cwd.path
|
35
|
+
assert_equal @cwd, cwd
|
36
|
+
|
37
|
+
assert_equal cwd.object_id, cwd2.object_id
|
30
38
|
end
|
31
39
|
|
32
40
|
def test_entry_does_mark_directory
|
33
41
|
|
34
42
|
cwd = Recls.stat @cwd, Recls::MARK_DIRECTORIES
|
35
43
|
|
36
|
-
# assert_equal "#{@cwd}#{Recls::PATH_NAME_SEPARATOR}", cwd.path
|
37
44
|
assert_equal "#{@cwd}/", cwd.path
|
45
|
+
assert_equal "#{@cwd}/", cwd
|
46
|
+
|
47
|
+
cwd2 = Recls.stat cwd, Recls::MARK_DIRECTORIES
|
48
|
+
|
49
|
+
assert_equal "#{@cwd}/", cwd.path
|
50
|
+
assert_equal "#{@cwd}/", cwd
|
51
|
+
|
52
|
+
assert_not_equal cwd.object_id, cwd2.object_id
|
38
53
|
end
|
39
54
|
end
|
40
55
|
|
data/test/unit/tc_recls_util.rb
CHANGED
@@ -6,6 +6,10 @@ $:.unshift File.join(File.dirname(__FILE__), '../..', 'lib')
|
|
6
6
|
|
7
7
|
require 'recls/util'
|
8
8
|
|
9
|
+
if RUBY_VERSION >= '2'
|
10
|
+
|
11
|
+
require 'xqsr3/extensions/test/unit'
|
12
|
+
end
|
9
13
|
require 'test/unit'
|
10
14
|
|
11
15
|
|
@@ -13,7 +17,13 @@ class Test_combine_paths < Test::Unit::TestCase
|
|
13
17
|
|
14
18
|
def test_nil_nil
|
15
19
|
|
16
|
-
|
20
|
+
if RUBY_VERSION >= '2'
|
21
|
+
|
22
|
+
assert_raise_with_message(::ArgumentError, /must specify one or more path elements/) { Recls.combine_paths(nil, nil) }
|
23
|
+
else
|
24
|
+
|
25
|
+
assert_raise(::ArgumentError) { Recls.combine_paths(nil, nil) }
|
26
|
+
end
|
17
27
|
end
|
18
28
|
|
19
29
|
def test_origin_nil
|
@@ -56,26 +66,29 @@ class Test_combine_paths < Test::Unit::TestCase
|
|
56
66
|
assert_equal 'abc/def/ghi', Recls.combine_paths('abc/', 'def/ghi')
|
57
67
|
assert_equal 'abc/./def/ghi', Recls.combine_paths('abc/.', 'def/ghi')
|
58
68
|
assert_equal 'abc/./def/ghi', Recls.combine_paths('abc/./', 'def/ghi')
|
69
|
+
|
59
70
|
if RUBY_VERSION >= '2'
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
71
|
+
|
72
|
+
assert_equal 'abc/./def/ghi', Recls.combine_paths('abc/.', 'def/ghi', clean_path: false)
|
73
|
+
assert_equal 'abc/./def/ghi', Recls.combine_paths('abc/./', 'def/ghi', clean: false)
|
74
|
+
assert_equal 'abc/def/ghi', Recls.combine_paths('abc/.', 'def/ghi', clean_path: true)
|
75
|
+
assert_equal 'abc/def/ghi', Recls.combine_paths('abc/./', 'def/ghi', clean: true)
|
76
|
+
assert_equal 'abc/def/ghi', Recls.combine_paths('abc/./.', 'def/ghi', clean_path: true)
|
77
|
+
assert_equal 'abc/../def/ghi', Recls.combine_paths('abc/..', 'def/ghi')
|
78
|
+
assert_equal 'def/ghi', Recls.combine_paths('abc/..', 'def/ghi', clean_path: true)
|
67
79
|
end
|
68
80
|
end
|
69
81
|
|
70
82
|
def test_multiple_relative
|
71
83
|
|
72
84
|
if RUBY_VERSION >= '2'
|
73
|
-
assert_equal 'a/b/c/d/e/f/g', Recls.combine_paths('a', 'b', 'c', 'd/e/f/', 'g', clean: false)
|
74
|
-
assert_equal 'a/b/c/d/e/f/g', Recls.combine_paths('a', 'b', 'c', 'd/e/f/', 'g', clean: true)
|
75
85
|
|
76
|
-
|
77
|
-
|
78
|
-
|
86
|
+
assert_equal 'a/b/c/d/e/f/g', Recls.combine_paths('a', 'b', 'c', 'd/e/f/', 'g', clean: false)
|
87
|
+
assert_equal 'a/b/c/d/e/f/g', Recls.combine_paths('a', 'b', 'c', 'd/e/f/', 'g', clean: true)
|
88
|
+
|
89
|
+
assert_equal 'a/b/c/../d/e/f/g', Recls.combine_paths('a', 'b', 'c', '..', 'd/e/f/', 'g', clean: false)
|
90
|
+
assert_equal 'a/b/d/e/f/g', Recls.combine_paths('a', 'b', 'c', '..', 'd/e/f/', 'g/', clean: true)
|
91
|
+
assert_equal 'a/b/d/e/f/g/', Recls.combine_paths('a', 'b', 'c', '..', 'd/e/f/', 'g/', canonicalise: true)
|
79
92
|
end
|
80
93
|
end
|
81
94
|
|
@@ -91,11 +104,22 @@ class Test_combine_paths < Test::Unit::TestCase
|
|
91
104
|
|
92
105
|
assert_equal '/f/g', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', '/f/g')
|
93
106
|
assert_equal '/f/g/', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', '/f/g/')
|
107
|
+
|
94
108
|
if RUBY_VERSION >= '2'
|
95
|
-
|
96
|
-
|
109
|
+
|
110
|
+
assert_equal '/f/g', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', '/f/g/', clean: true)
|
111
|
+
assert_equal '/f/g/', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', '/f/g/', canonicalise: true)
|
97
112
|
end
|
98
113
|
end
|
114
|
+
|
115
|
+
def test_combining_with_entries
|
116
|
+
|
117
|
+
f_g = Recls.stat('/f/g', Recls::DETAILS_LATER)
|
118
|
+
b = Recls.stat('b', Recls::DETAILS_LATER)
|
119
|
+
|
120
|
+
assert_equal '/f/g', Recls.combine_paths('/', 'a', 'b', 'c', 'd/e', f_g)
|
121
|
+
assert_equal '/f/g', Recls.combine_paths('/', 'a', b, 'c', 'd/e', f_g)
|
122
|
+
end
|
99
123
|
end
|
100
124
|
|
101
125
|
class Test_canonicalise_path < Test::Unit::TestCase
|
@@ -128,6 +152,14 @@ class Test_canonicalise_path < Test::Unit::TestCase
|
|
128
152
|
assert_equal('a', Recls.canonicalise_path('a'))
|
129
153
|
assert_equal('file', Recls.canonicalise_path('file'))
|
130
154
|
assert_equal('file.ext', Recls.canonicalise_path('file.ext'))
|
155
|
+
|
156
|
+
a = Recls.stat 'a', Recls::DETAILS_LATER
|
157
|
+
file = Recls.stat 'file', Recls::DETAILS_LATER
|
158
|
+
file_ext = Recls.stat 'file.ext', Recls::DETAILS_LATER
|
159
|
+
|
160
|
+
assert_equal(Recls.canonicalise_path(a.path), Recls.canonicalise_path(a))
|
161
|
+
assert_equal(Recls.canonicalise_path(file.path), Recls.canonicalise_path(file))
|
162
|
+
assert_equal(Recls.canonicalise_path(file_ext.path), Recls.canonicalise_path(file_ext))
|
131
163
|
end
|
132
164
|
|
133
165
|
def test_zero_parts
|