rio 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +225 -0
- data/README +12 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/doc/ANNOUNCE +160 -71
- data/doc/RELEASE_NOTES +71 -2
- data/ex/colx.rb +1 -1
- data/ex/passwd_report.rb +4 -8
- data/ex/riocat +5 -5
- data/ex/riogunzip +1 -1
- data/ex/riogzip +6 -6
- data/ex/rioprompt.rb +6 -0
- data/lib/rio.rb +3 -13
- data/lib/rio/arycopy.rb +1 -1
- data/lib/rio/base.rb +1 -5
- data/lib/rio/construct.rb +75 -0
- data/lib/rio/constructor.rb +42 -11
- data/lib/rio/context.rb +1 -1
- data/lib/rio/context/dir.rb +50 -23
- data/lib/rio/context/methods.rb +5 -3
- data/lib/rio/{cxdir.rb → context/skip.rb} +24 -36
- data/lib/rio/context/stream.rb +38 -16
- data/lib/rio/cp.rb +24 -5
- data/lib/rio/dir.rb +8 -7
- data/lib/rio/doc/HOWTO.rb +33 -33
- data/lib/rio/doc/INTRO.rb +416 -256
- data/lib/rio/doc/MISC.rb +3 -1
- data/lib/rio/doc/SYNOPSIS.rb +28 -33
- data/lib/rio/entrysel.rb +76 -9
- data/lib/rio/file.rb +2 -1
- data/lib/rio/filter.rb +95 -0
- data/lib/rio/filter/closeoneof.rb +1 -1
- data/lib/rio/grande.rb +0 -74
- data/lib/rio/if.rb +2 -1
- data/lib/rio/if/basic.rb +1 -1
- data/lib/rio/if/csv.rb +1 -1
- data/lib/rio/if/dir.rb +1 -220
- data/lib/rio/if/fileordir.rb +26 -12
- data/lib/rio/if/grande.rb +55 -6
- data/lib/rio/if/grande_entry.rb +355 -0
- data/lib/rio/if/{methods.rb → grande_stream.rb} +69 -88
- data/lib/rio/if/path.rb +25 -3
- data/lib/rio/if/stream.rb +62 -37
- data/lib/rio/if/temp.rb +2 -2
- data/lib/rio/if/test.rb +23 -0
- data/lib/rio/impl/path.rb +5 -0
- data/lib/rio/match.rb +6 -3
- data/lib/rio/matchrecord.rb +50 -46
- data/lib/rio/{filter/chomp.rb → ops/construct.rb} +12 -20
- data/lib/rio/ops/create.rb +3 -0
- data/lib/rio/ops/dir.rb +12 -6
- data/lib/rio/ops/either.rb +17 -3
- data/lib/rio/ops/path.rb +4 -1
- data/lib/rio/ops/stream/input.rb +6 -1
- data/lib/rio/ops/stream/read.rb +1 -3
- data/lib/rio/{context/chomp.rb → prompt.rb} +17 -13
- data/lib/rio/rl/base.rb +1 -1
- data/lib/rio/rl/builder.rb +3 -1
- data/lib/rio/state.rb +7 -13
- data/lib/rio/stream.rb +8 -5
- data/lib/rio/stream/open.rb +1 -1
- data/lib/rio/version.rb +1 -1
- data/test/mswin32.rb +1 -1
- data/test/runtests_gem.rb +1 -1
- data/test/tc/all.rb +3 -0
- data/test/tc/copy-from.rb +13 -13
- data/test/tc/copy-to.rb +1 -1
- data/test/tc/copy.rb +1 -1
- data/test/tc/copydir.rb +0 -24
- data/test/tc/copysymlink.rb +39 -0
- data/test/tc/csv.rb +2 -2
- data/test/tc/csv2.rb +4 -4
- data/test/tc/misc.rb +16 -16
- data/test/tc/nolines.rb +26 -26
- data/test/tc/noqae.rb +74 -74
- data/test/tc/overload.rb +28 -28
- data/test/tc/riorl.rb +36 -0
- data/test/tc/selnosel.rb +36 -0
- data/test/tc/skip.rb +58 -0
- data/test/tc/skiplines.rb +42 -0
- data/test/tc/symlink.rb +1 -1
- data/test/tc/symlink0.rb +1 -1
- data/test/tc/temp.rb +1 -1
- data/test/tc/tempdir.rb +1 -1
- data/test/tc/testcase.rb +7 -1
- metadata +14 -8
- data/lib/rio/matchcolumns.rb +0 -266
- data/lib/rio/rangemath.rb +0 -44
data/test/tc/copy-to.rb
CHANGED
data/test/tc/copy.rb
CHANGED
@@ -38,7 +38,7 @@ class TC_RIO_copy < Test::Unit::TestCase
|
|
38
38
|
oline = rio(datadir,'dir1/sd1/f1.txt').readline
|
39
39
|
|
40
40
|
dir2 = rio(datadir,'dir2').rmtree.mkpath
|
41
|
-
sd1.
|
41
|
+
sd1.copy_to(dir2)
|
42
42
|
nline = rio(datadir,'dir2/sd1/f1.txt').readline
|
43
43
|
assert_equal(oline,nline)
|
44
44
|
|
data/test/tc/copydir.rb
CHANGED
@@ -45,30 +45,6 @@ class TC_copydir < Test::RIO::TestCase
|
|
45
45
|
@f2 = rio('d0/d2/f2')
|
46
46
|
@f3 = rio('d0/d2/f3')
|
47
47
|
end
|
48
|
-
def assert_dirs_equal(exp,d,msg="")
|
49
|
-
exp.each do |ent|
|
50
|
-
ds = rio(d,ent.filename)
|
51
|
-
assert(ds.exist?,"entry '#{ds}' exists")
|
52
|
-
assert_equal(ent.ftype,ds.ftype,"same ftype")
|
53
|
-
case
|
54
|
-
when ent.file?
|
55
|
-
assert(ds.file?,"entry is a file")
|
56
|
-
assert_equal(ent[],ds[],"file has same contents")
|
57
|
-
when ent.dir?
|
58
|
-
assert_dirs_equal(ent,ds,"subdirectories are the same")
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
def assert_rios_equal(exp,ans,msg="")
|
63
|
-
case
|
64
|
-
when exp.file?
|
65
|
-
assert(ans.file?,"entry is a file")
|
66
|
-
assert_equal(exp.readlines,ans.readlines,"file has same contents")
|
67
|
-
when exp.dir?
|
68
|
-
assert(ans.dir?,"entry is a dir")
|
69
|
-
assert_dirs_equal(exp,ans,"directories are the same")
|
70
|
-
end
|
71
|
-
end
|
72
48
|
def assert_skel_equal(exp,d,msg="")
|
73
49
|
exp.each do |ent|
|
74
50
|
next unless ent.dir?
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/local/bin/ruby
|
2
|
+
if $0 == __FILE__
|
3
|
+
Dir.chdir File.dirname(__FILE__)+'/../'
|
4
|
+
$:.unshift File.expand_path('../lib/')
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rio'
|
8
|
+
require 'tc/testcase'
|
9
|
+
|
10
|
+
class TC_copysymlink < Test::RIO::TestCase
|
11
|
+
@@once = false
|
12
|
+
def self.once
|
13
|
+
@@once = true
|
14
|
+
rio('afile').touch.symlink('alink')
|
15
|
+
rio('d0').rmtree.mkpath
|
16
|
+
rio('d0/afile').touch.symlink('d0/alink')
|
17
|
+
rio('d1').rmtree.mkpath
|
18
|
+
rio('d0/afile').touch.symlink('d1/alink')
|
19
|
+
end
|
20
|
+
def setup
|
21
|
+
super
|
22
|
+
self.class.once unless @@once
|
23
|
+
|
24
|
+
@d0 = rio('d0/')
|
25
|
+
@d1 = rio('d1/')
|
26
|
+
end
|
27
|
+
def test_basic
|
28
|
+
dst = rio('dst').delete!.mkpath
|
29
|
+
dst < @d0
|
30
|
+
|
31
|
+
assert_dirs_equal(@d0,rio(dst,@d0.filename),"basic copy")
|
32
|
+
end
|
33
|
+
def test_cross_copy
|
34
|
+
dst = rio('dst2').delete!.mkpath
|
35
|
+
dst < @d1
|
36
|
+
|
37
|
+
assert_dirs_equal(@d1,rio(dst,@d1.filename),"basic copy")
|
38
|
+
end
|
39
|
+
end
|
data/test/tc/csv.rb
CHANGED
@@ -63,7 +63,7 @@ class TC_csv < Test::Unit::TestCase
|
|
63
63
|
end
|
64
64
|
def test_nocsv_lines
|
65
65
|
rio(@src_name) > rio(@dst_name)
|
66
|
-
assert_equal(@string,rio(@dst_name).
|
66
|
+
assert_equal(@string,rio(@dst_name).contents)
|
67
67
|
assert_equal(@lines,rio(@dst_name)[])
|
68
68
|
assert_equal(@strings,rio(@dst_name).chomp[])
|
69
69
|
assert_equal(@lines,rio(@dst_name).to_a)
|
@@ -72,7 +72,7 @@ class TC_csv < Test::Unit::TestCase
|
|
72
72
|
assert_equal(@strings,rio(@dst_name).chomp.readlines)
|
73
73
|
end
|
74
74
|
def test_csv_lines
|
75
|
-
assert_equal(@string,rio(@dst_name).csv.
|
75
|
+
assert_equal(@string,rio(@dst_name).csv.contents)
|
76
76
|
assert_equal(@records,rio(@dst_name).csv[])
|
77
77
|
assert_equal(@records,rio(@dst_name).csv.chomp[])
|
78
78
|
assert_equal(@lines,rio(@dst_name).csv.lines[])
|
data/test/tc/csv2.rb
CHANGED
@@ -27,8 +27,8 @@ class TC_csv2 < Test::RIO::TestCase
|
|
27
27
|
|
28
28
|
|
29
29
|
rio('src1.csv') > rio('dst.csv')
|
30
|
-
assert_equal(@string,rio('dst.csv').
|
31
|
-
assert_equal(@string,rio('dst.csv').csv.
|
30
|
+
assert_equal(@string,rio('dst.csv').contents)
|
31
|
+
assert_equal(@string,rio('dst.csv').csv.contents)
|
32
32
|
assert_equal(@lines,rio('dst.csv')[])
|
33
33
|
assert_equal(@strings,rio('dst.csv').chomp[])
|
34
34
|
assert_equal(@lines,rio('dst.csv').to_a)
|
@@ -96,8 +96,8 @@ class TC_csv2 < Test::RIO::TestCase
|
|
96
96
|
|
97
97
|
rio('src1.csv') < @src
|
98
98
|
|
99
|
-
assert_equal(@string,rio('src1.csv').
|
100
|
-
assert_equal(@string,rio('src1.csv').csv.
|
99
|
+
assert_equal(@string,rio('src1.csv').contents)
|
100
|
+
assert_equal(@string,rio('src1.csv').csv.contents)
|
101
101
|
assert_equal(@lines[0],rio('src1.csv').getrec)
|
102
102
|
assert_equal(@strings[0],rio('src1.csv').chomp.getrec)
|
103
103
|
|
data/test/tc/misc.rb
CHANGED
@@ -200,28 +200,28 @@ class TC_RIO_misc < Test::Unit::TestCase
|
|
200
200
|
tdir.rmtree.mkpath.chdir {
|
201
201
|
txt = "Hello f1.txt"
|
202
202
|
o = rio('o').puts(txt).close
|
203
|
-
oslurp = o.
|
203
|
+
oslurp = o.contents
|
204
204
|
|
205
205
|
n = rio('n')
|
206
|
-
o.
|
207
|
-
assert_equal(oslurp,n.
|
206
|
+
o.copy_to(n)
|
207
|
+
assert_equal(oslurp,n.contents)
|
208
208
|
|
209
209
|
d = rio('d1').rmtree.mkpath
|
210
210
|
n = rio(d,'o')
|
211
|
-
o.
|
212
|
-
assert_equal(oslurp,n.
|
211
|
+
o.copy_to(d)
|
212
|
+
assert_equal(oslurp,n.contents)
|
213
213
|
|
214
214
|
# d = rio('d2').rmtree
|
215
215
|
# n = rio(d,'o')
|
216
216
|
# assert_raise(::RIO::Exception::Copy) {
|
217
|
-
# o.
|
217
|
+
# o.copy_to(n)
|
218
218
|
# }
|
219
219
|
|
220
220
|
|
221
221
|
d = rio('d3').rmtree.mkpath
|
222
222
|
n = rio(d,'o').touch
|
223
|
-
o.
|
224
|
-
assert_equal(oslurp,n.
|
223
|
+
o.copy_to(d)
|
224
|
+
assert_equal(oslurp,n.contents)
|
225
225
|
|
226
226
|
|
227
227
|
return unless $supports_symlink
|
@@ -231,8 +231,8 @@ class TC_RIO_misc < Test::Unit::TestCase
|
|
231
231
|
rio('qf').symlink('o')
|
232
232
|
}
|
233
233
|
n = rio(d,'o')
|
234
|
-
o.
|
235
|
-
assert_equal(oslurp,n.
|
234
|
+
o.copy_to(d)
|
235
|
+
assert_equal(oslurp,n.contents)
|
236
236
|
|
237
237
|
d = rio('d6').rmtree.mkpath
|
238
238
|
q = rio(d,'qd').mkdir
|
@@ -349,9 +349,9 @@ class TC_RIO_misc < Test::Unit::TestCase
|
|
349
349
|
src.close
|
350
350
|
src = rio(datadir,'src')
|
351
351
|
dst1 = rio(datadir,'dst1')
|
352
|
-
src.
|
352
|
+
src.copy_to(dst1)
|
353
353
|
dst2 = rio(datadir,'dst2').mkdir
|
354
|
-
src.
|
354
|
+
src.copy_to(dst2)
|
355
355
|
sline = rio(datadir,'src').readline
|
356
356
|
l1 = rio(datadir,'dst1').readline
|
357
357
|
l2 = rio(datadir,'dst2/src').readline
|
@@ -366,14 +366,14 @@ class TC_RIO_misc < Test::Unit::TestCase
|
|
366
366
|
oline = rio(datadir,'dir1/sd1/f1.txt').readline
|
367
367
|
|
368
368
|
dir2 = rio(datadir,'dir2').rmtree.mkpath
|
369
|
-
sd1.
|
369
|
+
sd1.copy_to(dir2)
|
370
370
|
nline = rio(datadir,'dir2/sd1/f1.txt').readline
|
371
371
|
assert_equal(oline,nline)
|
372
372
|
|
373
373
|
end
|
374
374
|
def cmpfiles(z1,z2)
|
375
|
-
o = rio(z1).
|
376
|
-
n = rio(z2).
|
375
|
+
o = rio(z1).contents
|
376
|
+
n = rio(z2).contents
|
377
377
|
o == n
|
378
378
|
end
|
379
379
|
|
@@ -436,7 +436,7 @@ end
|
|
436
436
|
# :chdir,
|
437
437
|
# :each_entry,:each_line,:each,:each_byte,
|
438
438
|
# :each_tested,:each_file,:each_directory,:each_symlink,
|
439
|
-
# :to_str,:to_a,:
|
439
|
+
# :to_str,:to_a,:contents,
|
440
440
|
# :length,:size,:zero?,
|
441
441
|
# :eof?,
|
442
442
|
# :read,:readchar,:readline,:readlines,
|
data/test/tc/nolines.rb
CHANGED
@@ -8,8 +8,8 @@ require 'rio'
|
|
8
8
|
require 'test/unit'
|
9
9
|
require 'test/unit/testsuite'
|
10
10
|
|
11
|
-
class
|
12
|
-
def tdir() rio(%w/qp
|
11
|
+
class TC_RIO_skiplines < Test::Unit::TestCase
|
12
|
+
def tdir() rio(%w/qp skiplines/) end
|
13
13
|
def assert!(a,msg="negative assertion")
|
14
14
|
assert((!(a)),msg)
|
15
15
|
end
|
@@ -44,10 +44,10 @@ class TC_RIO_nolines < Test::Unit::TestCase
|
|
44
44
|
file < lines
|
45
45
|
|
46
46
|
exp = lines[0..0] + lines[2..5] + lines[7...8]
|
47
|
-
ans = file.chomp.
|
47
|
+
ans = file.chomp.skiplines[:empty?]
|
48
48
|
assert_equal(exp.map(&:chomp),ans)
|
49
49
|
|
50
|
-
ans = file.
|
50
|
+
ans = file.skiplines(:empty?).chomp.to_a
|
51
51
|
assert_equal(exp.map(&:chomp),ans)
|
52
52
|
|
53
53
|
file.close
|
@@ -73,13 +73,13 @@ class TC_RIO_nolines < Test::Unit::TestCase
|
|
73
73
|
# iterate over the first line and comment lines
|
74
74
|
begin
|
75
75
|
f0 = file.dup
|
76
|
-
ans = f0.
|
76
|
+
ans = f0.skiplines[0,/^\s*#/]
|
77
77
|
assert_equal(exp,ans)
|
78
78
|
end
|
79
79
|
|
80
80
|
begin
|
81
81
|
f0 = file.dup
|
82
|
-
ans = f0.
|
82
|
+
ans = f0.skiplines[proc { |rec,rnum,rio| rnum == 0 || rec =~ /^\s*#/ }]
|
83
83
|
assert_equal(exp,ans)
|
84
84
|
end
|
85
85
|
begin
|
@@ -87,7 +87,7 @@ class TC_RIO_nolines < Test::Unit::TestCase
|
|
87
87
|
|
88
88
|
#$trace_states = true
|
89
89
|
exp0 = lines[0..1] + lines[5...8]
|
90
|
-
ans = f0.
|
90
|
+
ans = f0.skiplines[/^\s*#/]
|
91
91
|
#p f0.cx
|
92
92
|
#$trace_states = false
|
93
93
|
assert_equal(exp0,ans)
|
@@ -102,10 +102,10 @@ class TC_RIO_nolines < Test::Unit::TestCase
|
|
102
102
|
|
103
103
|
exp2 = lines[2..4]
|
104
104
|
exp = exp1 - exp2
|
105
|
-
ans = file.lines(proc { |rec,rnum,ario| rec =~ /#{ario.filename}/ }).
|
105
|
+
ans = file.lines(proc { |rec,rnum,ario| rec =~ /#{ario.filename}/ }).skiplines[/^\s*#/]
|
106
106
|
assert_equal(exp,ans)
|
107
107
|
|
108
|
-
ans = file.
|
108
|
+
ans = file.skiplines(/^\s*#/).lines[proc { |rec,rnum,ario| rec =~ /#{ario.filename}/ }]
|
109
109
|
assert_equal(exp,ans)
|
110
110
|
end
|
111
111
|
|
@@ -113,30 +113,30 @@ class TC_RIO_nolines < Test::Unit::TestCase
|
|
113
113
|
# $trace_states = true
|
114
114
|
lfile,lines = file_lines()
|
115
115
|
|
116
|
-
ans = rio('f1').
|
116
|
+
ans = rio('f1').skiplines(2..4).lines[0..2]
|
117
117
|
exp = lines[6..6]
|
118
118
|
|
119
|
-
ans = rio('f1').
|
119
|
+
ans = rio('f1').skiprecords(0).records(0..2).skiprecords(2..4).records[6]
|
120
120
|
assert_equal(exp,ans)
|
121
121
|
|
122
|
-
ans = rio('f1').lines(0..2).
|
122
|
+
ans = rio('f1').lines(0..2).skiplines(0,2..4).lines[6]
|
123
123
|
assert_equal(exp,ans)
|
124
|
-
ans = rio('f1').
|
124
|
+
ans = rio('f1').skiplines(0,2..4).lines[0..2,6]
|
125
125
|
|
126
126
|
assert_equal(lines[1..1]+lines[6..6],ans)
|
127
127
|
|
128
128
|
|
129
|
-
ans = rio('f1').
|
129
|
+
ans = rio('f1').skiplines(0).lines(0..2).skiplines(2..4).lines[6]
|
130
130
|
assert_equal(exp,ans)
|
131
|
-
ans = rio('f1').
|
131
|
+
ans = rio('f1').skiplines(0).lines(0..2).skiplines(2..4).lines[6]
|
132
132
|
assert_equal(exp,ans)
|
133
|
-
ans = rio('f1').records(0..2).
|
133
|
+
ans = rio('f1').records(0..2).skiprecords(0,2..4).records[6]
|
134
134
|
assert_equal(exp,ans)
|
135
|
-
ans = rio('f1').
|
135
|
+
ans = rio('f1').skiprecords(0,2..4).records[0..2,6]
|
136
136
|
assert_equal(lines[1..1]+lines[6..6],ans)
|
137
137
|
|
138
138
|
exp = lines[1..1] + lines[5..7]
|
139
|
-
ans = rio('f1').
|
139
|
+
ans = rio('f1').skiplines(0,2..4).lines[0..2,6,/f1/]
|
140
140
|
assert_equal(exp,ans)
|
141
141
|
|
142
142
|
|
@@ -169,33 +169,33 @@ class TC_RIO_nolines < Test::Unit::TestCase
|
|
169
169
|
# $trace_states = true
|
170
170
|
lfile,lines = file_lines()
|
171
171
|
|
172
|
-
file = lfile.dup.
|
172
|
+
file = lfile.dup.skiplines(2..4).lines(0..2)
|
173
173
|
exp = lines[0..1]
|
174
174
|
#p "HEE"
|
175
175
|
# breakpoint
|
176
176
|
iter_tests(file,exp)
|
177
177
|
|
178
|
-
file = lfile.dup.
|
178
|
+
file = lfile.dup.skiprecords(0).records(0..2).skiprecords(2..4).records(6)
|
179
179
|
exp = lines[6..6]
|
180
180
|
iter_tests(file,exp)
|
181
181
|
|
182
|
-
file = lfile.dup.lines(0..2).
|
182
|
+
file = lfile.dup.lines(0..2).skiplines(0,2..4).lines(6)
|
183
183
|
iter_tests(file,exp)
|
184
184
|
|
185
|
-
file = lfile.dup.
|
185
|
+
file = lfile.dup.skiplines(0,2..4).lines(0..2,6)
|
186
186
|
iter_tests(file,lines[1..1]+lines[6..6])
|
187
187
|
|
188
|
-
file = lfile.dup.
|
188
|
+
file = lfile.dup.skiplines(0).lines(0..2).skiplines(2..4).lines(6)
|
189
189
|
iter_tests(file,exp)
|
190
190
|
|
191
|
-
file = lfile.dup.records(0..2).
|
191
|
+
file = lfile.dup.records(0..2).skiprecords(0,2..4).records(6)
|
192
192
|
iter_tests(file,exp)
|
193
193
|
|
194
|
-
file = lfile.dup.
|
194
|
+
file = lfile.dup.skiprecords(0,2..4).records(0..2,6)
|
195
195
|
iter_tests(file,lines[1..1]+lines[6..6])
|
196
196
|
|
197
197
|
exp = lines[1..1] + lines[5..7]
|
198
|
-
file = lfile.dup.
|
198
|
+
file = lfile.dup.skiplines(0,2..4).lines(0..2,6,/f1/)
|
199
199
|
iter_tests(file,exp)
|
200
200
|
|
201
201
|
|
data/test/tc/noqae.rb
CHANGED
@@ -95,28 +95,28 @@ class TC_RIO_noqae < Test::Unit::TestCase
|
|
95
95
|
begin
|
96
96
|
begin
|
97
97
|
ans = []
|
98
|
-
rio('d0').
|
98
|
+
rio('d0').skipdirs.each { |el| ans << el }
|
99
99
|
exp = all.reject { |el| el =~ /[cd]\d$/ }
|
100
100
|
assert_equal(exp.sort,smap(ans).sort)
|
101
|
-
ans = rio('d0').
|
101
|
+
ans = rio('d0').skipdirs[]
|
102
102
|
assert_equal(exp.sort,smap(ans).sort)
|
103
103
|
end
|
104
104
|
|
105
105
|
begin
|
106
106
|
ans = []
|
107
|
-
rio('d0').
|
107
|
+
rio('d0').skipfiles.each { |el| ans << el }
|
108
108
|
exp = all.reject { |el| el =~ /[fl]\d$/ }
|
109
109
|
assert_equal(exp.sort,smap(ans).sort)
|
110
|
-
ans = rio('d0').
|
110
|
+
ans = rio('d0').skipfiles[]
|
111
111
|
assert_equal(exp.sort,smap(ans).sort)
|
112
112
|
end
|
113
113
|
|
114
114
|
begin
|
115
115
|
ans = []
|
116
|
-
rio('d0').
|
116
|
+
rio('d0').skipentries.each { |el| ans << el }
|
117
117
|
exp = []
|
118
118
|
assert_equal(exp.sort,smap(ans).sort)
|
119
|
-
ans = rio('d0').
|
119
|
+
ans = rio('d0').skipentries[]
|
120
120
|
assert_equal(exp.sort,smap(ans).sort)
|
121
121
|
end
|
122
122
|
end
|
@@ -124,62 +124,62 @@ class TC_RIO_noqae < Test::Unit::TestCase
|
|
124
124
|
begin
|
125
125
|
begin
|
126
126
|
ans = []
|
127
|
-
rio('d0').
|
127
|
+
rio('d0').skipdirs.skipfiles.each { |el| ans << el }
|
128
128
|
exp = all.reject { |el| el =~ /[cdfl]\d$/ }
|
129
129
|
assert_equal(exp.sort,smap(ans).sort)
|
130
|
-
ans = rio('d0').
|
130
|
+
ans = rio('d0').skipfiles.skipdirs[]
|
131
131
|
assert_equal(exp.sort,smap(ans).sort)
|
132
|
-
ans = rio('d0').
|
132
|
+
ans = rio('d0').skipdirs.skipfiles[]
|
133
133
|
assert_equal(exp.sort,smap(ans).sort)
|
134
134
|
end
|
135
135
|
|
136
136
|
begin
|
137
137
|
ans = []
|
138
|
-
rio('d0').
|
138
|
+
rio('d0').skipdirs.files.each { |el| ans << el }
|
139
139
|
exp = all.select { |el| el =~ /[fl]\d$/ }
|
140
140
|
assert_equal(exp.sort,smap(ans).sort)
|
141
|
-
ans = rio('d0').
|
141
|
+
ans = rio('d0').skipdirs.files[]
|
142
142
|
assert_equal(exp.sort,smap(ans).sort)
|
143
|
-
ans = rio('d0').files.
|
143
|
+
ans = rio('d0').files.skipdirs[]
|
144
144
|
assert_equal(exp.sort,smap(ans).sort)
|
145
145
|
end
|
146
146
|
|
147
147
|
begin
|
148
148
|
exp = all.select { |el| el =~ /[n]\d$/ }
|
149
149
|
ans = []
|
150
|
-
rio('d0').entries.
|
150
|
+
rio('d0').entries.skipfiles.skipdirs.each { |el| ans << el }
|
151
151
|
assert_equal(exp.sort,smap(ans).sort)
|
152
152
|
|
153
|
-
ans = rio('d0').entries.
|
153
|
+
ans = rio('d0').entries.skipfiles.skipdirs[]
|
154
154
|
assert_equal(exp.sort,smap(ans).sort)
|
155
|
-
ans = rio('d0').entries.
|
155
|
+
ans = rio('d0').entries.skipdirs.skipfiles[]
|
156
156
|
assert_equal(exp.sort,smap(ans).sort)
|
157
|
-
ans = rio('d0').
|
157
|
+
ans = rio('d0').skipfiles.skipdirs.entries[]
|
158
158
|
assert_equal(exp.sort,smap(ans).sort)
|
159
|
-
ans = rio('d0').
|
159
|
+
ans = rio('d0').skipfiles.skipdirs[]
|
160
160
|
assert_equal(exp.sort,smap(ans).sort)
|
161
161
|
end
|
162
162
|
|
163
163
|
begin
|
164
164
|
exp = []
|
165
165
|
ans = []
|
166
|
-
rio('d0').
|
166
|
+
rio('d0').skipentries.dirs.each { |el| ans << el }
|
167
167
|
assert_equal(exp.sort,smap(ans).sort)
|
168
|
-
rio('d0').
|
168
|
+
rio('d0').skipentries.files.each { |el| ans << el }
|
169
169
|
assert_equal(exp.sort,smap(ans).sort)
|
170
170
|
|
171
|
-
ans = rio('d0').
|
171
|
+
ans = rio('d0').skipentries.files[]
|
172
172
|
assert_equal(exp.sort,smap(ans).sort)
|
173
|
-
ans = rio('d0').
|
173
|
+
ans = rio('d0').skipentries.dirs[]
|
174
174
|
assert_equal(exp.sort,smap(ans).sort)
|
175
175
|
end
|
176
176
|
|
177
177
|
begin
|
178
178
|
exp = []
|
179
179
|
ans = []
|
180
|
-
rio('d0').
|
180
|
+
rio('d0').skipentries.each { |el| ans << el }
|
181
181
|
assert_equal(exp.sort,smap(ans).sort)
|
182
|
-
ans = rio('d0').
|
182
|
+
ans = rio('d0').skipentries[]
|
183
183
|
assert_equal(exp.sort,smap(ans).sort)
|
184
184
|
end
|
185
185
|
end
|
@@ -197,19 +197,19 @@ class TC_RIO_noqae < Test::Unit::TestCase
|
|
197
197
|
rio('d0').dirs.each { |el|
|
198
198
|
assert(el.directory?)
|
199
199
|
}
|
200
|
-
rio('d0').
|
200
|
+
rio('d0').skipdirs.each { |el|
|
201
201
|
assert!(el.directory?)
|
202
202
|
}
|
203
|
-
rio('d0').
|
203
|
+
rio('d0').skipdirs('*').each { |el|
|
204
204
|
assert(el.directory?)
|
205
205
|
}
|
206
206
|
rio('d0').files.each { |el|
|
207
207
|
assert(el.file?)
|
208
208
|
}
|
209
|
-
rio('d0').
|
209
|
+
rio('d0').skipfiles.each { |el|
|
210
210
|
assert!(el.file?)
|
211
211
|
}
|
212
|
-
rio('d0').
|
212
|
+
rio('d0').skipfiles('*').each { |el|
|
213
213
|
assert(el.file?)
|
214
214
|
}
|
215
215
|
begin
|
@@ -244,7 +244,7 @@ class TC_RIO_noqae < Test::Unit::TestCase
|
|
244
244
|
begin
|
245
245
|
exp = all.select { |el| el =~ /[df]\d\Z/ }
|
246
246
|
ans = []
|
247
|
-
rio('d0').
|
247
|
+
rio('d0').skipentries(:symlink?).each { |el|
|
248
248
|
assert!(el.symlink?)
|
249
249
|
ans << el
|
250
250
|
}
|
@@ -253,7 +253,7 @@ class TC_RIO_noqae < Test::Unit::TestCase
|
|
253
253
|
begin
|
254
254
|
exp = all.select { |el| el =~ /[d]\d\Z/ }
|
255
255
|
ans = []
|
256
|
-
rio('d0').
|
256
|
+
rio('d0').skipdirs(:symlink?).each { |el|
|
257
257
|
assert(el.directory?)
|
258
258
|
assert!(el.symlink?)
|
259
259
|
ans << el
|
@@ -263,7 +263,7 @@ class TC_RIO_noqae < Test::Unit::TestCase
|
|
263
263
|
begin
|
264
264
|
exp = all.select { |el| el =~ /[f]\d\Z/ }
|
265
265
|
ans = []
|
266
|
-
rio('d0').
|
266
|
+
rio('d0').skipfiles(:symlink?).each { |el|
|
267
267
|
assert(el.file?)
|
268
268
|
assert!(el.symlink?)
|
269
269
|
ans << el
|
@@ -284,11 +284,11 @@ class TC_RIO_noqae < Test::Unit::TestCase
|
|
284
284
|
ere = /1/
|
285
285
|
exp = all.reject { |el| el =~ ere }
|
286
286
|
ans = []
|
287
|
-
rio('d0').
|
287
|
+
rio('d0').skipentries(ere).each { |el| ans << el }
|
288
288
|
assert_equal(exp.sort,smap(ans).sort)
|
289
|
-
ans = rio('d0').
|
289
|
+
ans = rio('d0').skipentries(ere).to_a
|
290
290
|
assert_equal(exp.sort,smap(ans).sort)
|
291
|
-
ans = rio('d0').
|
291
|
+
ans = rio('d0').skipentries[ere]
|
292
292
|
assert_equal(exp.sort,smap(ans).sort)
|
293
293
|
end
|
294
294
|
|
@@ -299,9 +299,9 @@ class TC_RIO_noqae < Test::Unit::TestCase
|
|
299
299
|
dre = /1/
|
300
300
|
exp = all.select { |el| el =~ /[cd]2$/ }
|
301
301
|
ans = []
|
302
|
-
rio('d0').
|
302
|
+
rio('d0').skipdirs(dre).each { |el| ans << el }
|
303
303
|
assert_equal(exp.sort,smap(ans).sort)
|
304
|
-
ans = rio('d0').
|
304
|
+
ans = rio('d0').skipdirs[dre]
|
305
305
|
assert_equal(exp.sort,smap(ans).sort)
|
306
306
|
end
|
307
307
|
|
@@ -309,9 +309,9 @@ class TC_RIO_noqae < Test::Unit::TestCase
|
|
309
309
|
dre = /1/
|
310
310
|
exp = all.select { |el| el =~ /[d]2$/ }
|
311
311
|
ans = []
|
312
|
-
rio('d0').
|
312
|
+
rio('d0').skipdirs(dre,:symlink?).each { |el| ans << el }
|
313
313
|
assert_equal(exp.sort,smap(ans).sort)
|
314
|
-
ans = rio('d0').
|
314
|
+
ans = rio('d0').skipdirs[dre,:symlink?]
|
315
315
|
assert_equal(exp.sort,smap(ans).sort)
|
316
316
|
end
|
317
317
|
|
@@ -319,9 +319,9 @@ class TC_RIO_noqae < Test::Unit::TestCase
|
|
319
319
|
fre = /2/
|
320
320
|
exp = all.select { |el| el =~ /[fl]1$/ }
|
321
321
|
ans = []
|
322
|
-
rio('d0').
|
322
|
+
rio('d0').skipfiles(fre).each { |el| ans << el }
|
323
323
|
assert_equal(exp.sort,smap(ans).sort)
|
324
|
-
ans = rio('d0').
|
324
|
+
ans = rio('d0').skipfiles[fre]
|
325
325
|
assert_equal(exp.sort,smap(ans).sort)
|
326
326
|
end
|
327
327
|
|
@@ -329,9 +329,9 @@ class TC_RIO_noqae < Test::Unit::TestCase
|
|
329
329
|
ere = /1/
|
330
330
|
exp = all.select { |el| el =~ /2$/ }
|
331
331
|
ans = []
|
332
|
-
rio('d0').
|
332
|
+
rio('d0').skipentries(ere).each { |el| ans << el }
|
333
333
|
assert_equal(exp.sort,smap(ans).sort)
|
334
|
-
ans = rio('d0').
|
334
|
+
ans = rio('d0').skipentries[ere]
|
335
335
|
assert_equal(exp.sort,smap(ans).sort)
|
336
336
|
end
|
337
337
|
end
|
@@ -342,36 +342,36 @@ class TC_RIO_noqae < Test::Unit::TestCase
|
|
342
342
|
begin
|
343
343
|
exp = all.select { |el| el =~ /([cd]2|[fl]1)$/ }
|
344
344
|
ans = []
|
345
|
-
rio('d0').
|
345
|
+
rio('d0').skipdirs(dre).skipfiles(fre).each { |el| ans << el }
|
346
346
|
assert_equal(exp.sort,smap(ans).sort)
|
347
|
-
ans = rio('d0').
|
347
|
+
ans = rio('d0').skipfiles(fre).skipdirs[dre]
|
348
348
|
assert_equal(exp.sort,smap(ans).sort)
|
349
|
-
ans = rio('d0').
|
349
|
+
ans = rio('d0').skipdirs(dre).skipfiles[fre]
|
350
350
|
assert_equal(exp.sort,smap(ans).sort)
|
351
351
|
end
|
352
352
|
|
353
353
|
begin
|
354
354
|
exp = all.select { |el| el =~ /([cd]2|[fl]2)$/ }
|
355
355
|
ans = []
|
356
|
-
rio('d0').
|
356
|
+
rio('d0').skipdirs(dre).files(fre).each { |el| ans << el }
|
357
357
|
assert_equal(exp.sort,smap(ans).sort)
|
358
|
-
ans = rio('d0').
|
358
|
+
ans = rio('d0').skipdirs(dre).files[fre]
|
359
359
|
assert_equal(exp.sort,smap(ans).sort)
|
360
|
-
ans = rio('d0').files(fre).
|
360
|
+
ans = rio('d0').files(fre).skipdirs[dre]
|
361
361
|
assert_equal(exp.sort,smap(ans).sort)
|
362
362
|
end
|
363
363
|
|
364
364
|
begin
|
365
365
|
exp = all.select { |el| el =~ /([cd]2|[fl]1|n[12])$/ }
|
366
366
|
ans = []
|
367
|
-
rio('d0').entries.
|
367
|
+
rio('d0').entries.skipfiles(fre).skipdirs(dre).each { |el| ans << el }
|
368
368
|
assert_equal(exp.sort,smap(ans).sort)
|
369
369
|
|
370
|
-
ans = rio('d0').entries.
|
370
|
+
ans = rio('d0').entries.skipfiles(fre).skipdirs[dre]
|
371
371
|
assert_equal(exp.sort,smap(ans).sort)
|
372
|
-
ans = rio('d0').entries.
|
372
|
+
ans = rio('d0').entries.skipdirs(dre).skipfiles[fre]
|
373
373
|
assert_equal(exp.sort,smap(ans).sort)
|
374
|
-
ans = rio('d0').
|
374
|
+
ans = rio('d0').skipfiles(fre).skipdirs(dre).entries[]
|
375
375
|
assert_equal(exp.sort,smap(ans).sort)
|
376
376
|
end
|
377
377
|
|
@@ -379,14 +379,14 @@ class TC_RIO_noqae < Test::Unit::TestCase
|
|
379
379
|
ere = /1/
|
380
380
|
exp = all.select { |el| el =~ /([cd]2|[fl]1|n1)$/ }
|
381
381
|
ans = []
|
382
|
-
rio('d0').entries(ere).
|
382
|
+
rio('d0').entries(ere).skipfiles(fre).skipdirs(dre).each { |el| ans << el }
|
383
383
|
assert_equal(exp.sort,smap(ans).sort)
|
384
384
|
|
385
|
-
ans = rio('d0').entries(ere).
|
385
|
+
ans = rio('d0').entries(ere).skipfiles(fre).skipdirs[dre]
|
386
386
|
assert_equal(exp.sort,smap(ans).sort)
|
387
|
-
ans = rio('d0').entries(ere).
|
387
|
+
ans = rio('d0').entries(ere).skipdirs(dre).skipfiles[fre]
|
388
388
|
assert_equal(exp.sort,smap(ans).sort)
|
389
|
-
ans = rio('d0').
|
389
|
+
ans = rio('d0').skipfiles(fre).skipdirs(dre).entries[ere]
|
390
390
|
assert_equal(exp.sort,smap(ans).sort)
|
391
391
|
end
|
392
392
|
|
@@ -396,28 +396,28 @@ class TC_RIO_noqae < Test::Unit::TestCase
|
|
396
396
|
fre = /f/
|
397
397
|
exp = all.select { |el| el =~ /(d2|l2)$/ }
|
398
398
|
ans = []
|
399
|
-
rio('d0').
|
399
|
+
rio('d0').skipentries(ere).skipfiles(fre).skipdirs(dre).each { |el| ans << el }
|
400
400
|
assert_equal(exp.sort,smap(ans).sort)
|
401
401
|
|
402
|
-
ans = rio('d0').
|
402
|
+
ans = rio('d0').skipentries(ere).skipfiles(fre).skipdirs[dre]
|
403
403
|
assert_equal(exp.sort,smap(ans).sort)
|
404
|
-
ans = rio('d0').
|
404
|
+
ans = rio('d0').skipentries(ere).skipdirs(dre).skipfiles[fre]
|
405
405
|
assert_equal(exp.sort,smap(ans).sort)
|
406
|
-
ans = rio('d0').
|
406
|
+
ans = rio('d0').skipfiles(fre).skipdirs(dre).skipentries[ere]
|
407
407
|
assert_equal(exp.sort,smap(ans).sort)
|
408
408
|
end
|
409
409
|
|
410
410
|
begin
|
411
411
|
exp = []
|
412
412
|
ans = []
|
413
|
-
rio('d0').
|
413
|
+
rio('d0').skipentries.dirs.each { |el| ans << el }
|
414
414
|
assert_equal(exp.sort,smap(ans).sort)
|
415
|
-
rio('d0').
|
415
|
+
rio('d0').skipentries.files.each { |el| ans << el }
|
416
416
|
assert_equal(exp.sort,smap(ans).sort)
|
417
417
|
|
418
|
-
ans = rio('d0').
|
418
|
+
ans = rio('d0').skipentries.files[]
|
419
419
|
assert_equal(exp.sort,smap(ans).sort)
|
420
|
-
ans = rio('d0').
|
420
|
+
ans = rio('d0').skipentries.dirs[]
|
421
421
|
assert_equal(exp.sort,smap(ans).sort)
|
422
422
|
end
|
423
423
|
|
@@ -425,9 +425,9 @@ class TC_RIO_noqae < Test::Unit::TestCase
|
|
425
425
|
ere = /1/
|
426
426
|
exp = all.select { |el| el =~ /2$/ }
|
427
427
|
ans = []
|
428
|
-
rio('d0').
|
428
|
+
rio('d0').skipentries(ere).each { |el| ans << el }
|
429
429
|
assert_equal(exp.sort,smap(ans).sort)
|
430
|
-
ans = rio('d0').
|
430
|
+
ans = rio('d0').skipentries[ere]
|
431
431
|
assert_equal(exp.sort,smap(ans).sort)
|
432
432
|
end
|
433
433
|
end
|
@@ -440,14 +440,14 @@ class TC_RIO_noqae < Test::Unit::TestCase
|
|
440
440
|
begin
|
441
441
|
begin
|
442
442
|
ans = []
|
443
|
-
rio('d0').
|
443
|
+
rio('d0').skipfiles(/2/).each { |el| ans << el }
|
444
444
|
exp = all.reject { |el| el =~ /[fl]\d$/ }
|
445
445
|
assert_equal(exp.sort,smap(ans).sort)
|
446
446
|
end
|
447
447
|
|
448
448
|
begin
|
449
449
|
ans = []
|
450
|
-
rio('d0').
|
450
|
+
rio('d0').skipfiles('*2').each { |el| ans << el }
|
451
451
|
exp = ['d0/f1']
|
452
452
|
assert_equal(exp.sort,smap(ans).sort)
|
453
453
|
end
|
@@ -457,21 +457,21 @@ class TC_RIO_noqae < Test::Unit::TestCase
|
|
457
457
|
begin
|
458
458
|
begin
|
459
459
|
ans = []
|
460
|
-
rio('d0').
|
460
|
+
rio('d0').skipfiles.each { |el| ans << el }
|
461
461
|
exp = ['d0/d1','d0/d2']
|
462
462
|
assert_equal(exp.sort,smap(ans).sort)
|
463
463
|
end
|
464
464
|
|
465
465
|
begin
|
466
466
|
ans = []
|
467
|
-
rio('d0').
|
467
|
+
rio('d0').skipdirs(/2/).each { |el| ans << el }
|
468
468
|
exp = ['d0/d1']
|
469
469
|
assert_equal(exp.sort,smap(ans).sort)
|
470
470
|
end
|
471
471
|
|
472
472
|
begin
|
473
473
|
ans = []
|
474
|
-
rio('d0').
|
474
|
+
rio('d0').skipdirs('*2').each { |el| ans << el }
|
475
475
|
exp = ['d0/d1']
|
476
476
|
assert_equal(exp.sort,smap(ans).sort)
|
477
477
|
end
|
@@ -479,25 +479,25 @@ class TC_RIO_noqae < Test::Unit::TestCase
|
|
479
479
|
begin
|
480
480
|
begin
|
481
481
|
ans = []
|
482
|
-
rio('d0').
|
482
|
+
rio('d0').skipfiles.dirs.each { |el| ans << el }
|
483
483
|
exp = ['d0/d1','d0/d2','d0/f1','d0/f2']
|
484
484
|
assert_equal(exp.sort,smap(ans).sort)
|
485
485
|
end
|
486
486
|
begin
|
487
487
|
ans = []
|
488
|
-
rio('d0').
|
488
|
+
rio('d0').skipfiles.dirs.each { |el| ans << el }
|
489
489
|
exp = ['d0/d1','d0/d2','d0/f1','d0/f2']
|
490
490
|
assert_equal(exp.sort,smap(ans).sort)
|
491
491
|
end
|
492
492
|
begin
|
493
493
|
ans = []
|
494
|
-
rio('d0').
|
494
|
+
rio('d0').skipfiles.dirs.each { |el| ans << el }
|
495
495
|
exp = ['d0/d1','d0/d2','d0/f1','d0/f2']
|
496
496
|
assert_equal(exp.sort,smap(ans).sort)
|
497
497
|
end
|
498
498
|
begin
|
499
499
|
ans = []
|
500
|
-
rio('d0').
|
500
|
+
rio('d0').skipfiles.dirs.each { |el| ans << el }
|
501
501
|
exp = ['d0/d1','d0/d2','d0/f1','d0/f2']
|
502
502
|
assert_equal(exp.sort,smap(ans).sort)
|
503
503
|
end
|