wishdev-rio 0.4.3.1
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.
- data/COPYING +341 -0
- data/README +81 -0
- data/Rakefile +281 -0
- data/build_doc.rb +94 -0
- data/doc/ANNOUNCE +159 -0
- data/doc/RELEASE_NOTES +308 -0
- data/doc/RIOIS +215 -0
- data/doc/generators/template/html/rio.css +428 -0
- data/doc/generators/template/html/rio.rb +523 -0
- data/doc/generators/template/html/ugly.rb +132 -0
- data/doc/pkg_def.rb +60 -0
- data/doc/rfc1738.txt +1403 -0
- data/doc/rfc959.txt +3933 -0
- data/ex/catcsv.rb +64 -0
- data/ex/colx.rb +8 -0
- data/ex/findinruby +15 -0
- data/ex/findruby +14 -0
- data/ex/passwd_report.rb +8 -0
- data/ex/prompt.rb +25 -0
- data/ex/rgb.txt.gz +0 -0
- data/ex/riocat +42 -0
- data/ex/riogunzip +31 -0
- data/ex/riogzip +24 -0
- data/ex/rioprompt.rb +10 -0
- data/ex/targz2zip +17 -0
- data/ex/tonl +10 -0
- data/lib/rio/abstract_method.rb +56 -0
- data/lib/rio/argv.rb +56 -0
- data/lib/rio/arycopy.rb +43 -0
- data/lib/rio/assert.rb +114 -0
- data/lib/rio/base.rb +56 -0
- data/lib/rio/callstr.rb +46 -0
- data/lib/rio/const.rb +51 -0
- data/lib/rio/construct.rb +50 -0
- data/lib/rio/constructor.rb +258 -0
- data/lib/rio/context/autoclose.rb +72 -0
- data/lib/rio/context/copying.rb +55 -0
- data/lib/rio/context/cxx.rb +66 -0
- data/lib/rio/context/dir.rb +120 -0
- data/lib/rio/context/gzip.rb +50 -0
- data/lib/rio/context/methods.rb +182 -0
- data/lib/rio/context/skip.rb +66 -0
- data/lib/rio/context/stream.rb +229 -0
- data/lib/rio/context.rb +117 -0
- data/lib/rio/cp.rb +370 -0
- data/lib/rio/def.rb +53 -0
- data/lib/rio/dir.rb +144 -0
- data/lib/rio/doc/EXAMPLES.rb +299 -0
- data/lib/rio/doc/HOWTO.rb +737 -0
- data/lib/rio/doc/INDEX.rb +311 -0
- data/lib/rio/doc/INTRO.rb +1068 -0
- data/lib/rio/doc/OPTIONAL.rb +130 -0
- data/lib/rio/doc/SYNOPSIS.rb +183 -0
- data/lib/rio/doc.rb +45 -0
- data/lib/rio/entrysel.rb +246 -0
- data/lib/rio/exception/copy.rb +97 -0
- data/lib/rio/exception/notimplemented.rb +57 -0
- data/lib/rio/exception/notsupported.rb +46 -0
- data/lib/rio/exception/open.rb +61 -0
- data/lib/rio/exception/state.rb +73 -0
- data/lib/rio/exception.rb +41 -0
- data/lib/rio/ext/csv.rb +351 -0
- data/lib/rio/ext/if.rb +45 -0
- data/lib/rio/ext/mp3info.rb +80 -0
- data/lib/rio/ext/splitlines.rb +253 -0
- data/lib/rio/ext/yaml/doc.rb +133 -0
- data/lib/rio/ext/yaml/tie.rb +149 -0
- data/lib/rio/ext/yaml.rb +164 -0
- data/lib/rio/ext/zipfile/fs.rb +116 -0
- data/lib/rio/ext/zipfile/rl.rb +251 -0
- data/lib/rio/ext/zipfile/rootdir.rb +117 -0
- data/lib/rio/ext/zipfile/state.rb +161 -0
- data/lib/rio/ext/zipfile/wrap.rb +204 -0
- data/lib/rio/ext/zipfile.rb +110 -0
- data/lib/rio/ext.rb +138 -0
- data/lib/rio/factory.rb +436 -0
- data/lib/rio/file.rb +118 -0
- data/lib/rio/filter/closeoneof.rb +103 -0
- data/lib/rio/filter/gzip.rb +70 -0
- data/lib/rio/filter.rb +94 -0
- data/lib/rio/fs/base.rb +41 -0
- data/lib/rio/fs/impl.rb +122 -0
- data/lib/rio/fs/native.rb +75 -0
- data/lib/rio/fs/stream.rb +61 -0
- data/lib/rio/fs/url.rb +63 -0
- data/lib/rio/ftp/conncache.rb +101 -0
- data/lib/rio/ftp/dir.rb +94 -0
- data/lib/rio/ftp/fs.rb +180 -0
- data/lib/rio/ftp/ftpfile.rb +20 -0
- data/lib/rio/grande.rb +97 -0
- data/lib/rio/handle.rb +100 -0
- data/lib/rio/if/basic.rb +64 -0
- data/lib/rio/if/csv.rb +76 -0
- data/lib/rio/if/dir.rb +157 -0
- data/lib/rio/if/file.rb +89 -0
- data/lib/rio/if/fileordir.rb +268 -0
- data/lib/rio/if/grande.rb +729 -0
- data/lib/rio/if/grande_entry.rb +379 -0
- data/lib/rio/if/grande_stream.rb +693 -0
- data/lib/rio/if/internal.rb +125 -0
- data/lib/rio/if/path.rb +462 -0
- data/lib/rio/if/rubyio.rb +681 -0
- data/lib/rio/if/string.rb +83 -0
- data/lib/rio/if/temp.rb +45 -0
- data/lib/rio/if/test.rb +282 -0
- data/lib/rio/if/yaml.rb +206 -0
- data/lib/rio/if.rb +64 -0
- data/lib/rio/ioh.rb +162 -0
- data/lib/rio/iomode.rb +109 -0
- data/lib/rio/ios/fail.rb +106 -0
- data/lib/rio/ios/generic.rb +119 -0
- data/lib/rio/ios/mode.rb +60 -0
- data/lib/rio/ios/null.rb +119 -0
- data/lib/rio/iowrap.rb +128 -0
- data/lib/rio/kernel.rb +54 -0
- data/lib/rio/local.rb +62 -0
- data/lib/rio/match.rb +53 -0
- data/lib/rio/matchrecord.rb +283 -0
- data/lib/rio/no_warn.rb +49 -0
- data/lib/rio/nullio.rb +159 -0
- data/lib/rio/open3.rb +68 -0
- data/lib/rio/ops/construct.rb +61 -0
- data/lib/rio/ops/create.rb +77 -0
- data/lib/rio/ops/dir.rb +346 -0
- data/lib/rio/ops/either.rb +134 -0
- data/lib/rio/ops/file.rb +102 -0
- data/lib/rio/ops/path.rb +296 -0
- data/lib/rio/ops/stream/input.rb +267 -0
- data/lib/rio/ops/stream/output.rb +100 -0
- data/lib/rio/ops/stream/read.rb +86 -0
- data/lib/rio/ops/stream/write.rb +57 -0
- data/lib/rio/ops/stream.rb +87 -0
- data/lib/rio/ops/symlink.rb +80 -0
- data/lib/rio/path/reset.rb +69 -0
- data/lib/rio/path.rb +129 -0
- data/lib/rio/piper/cp.rb +80 -0
- data/lib/rio/piper.rb +122 -0
- data/lib/rio/prompt.rb +66 -0
- data/lib/rio/rectype.rb +88 -0
- data/lib/rio/rl/base.rb +118 -0
- data/lib/rio/rl/builder.rb +117 -0
- data/lib/rio/rl/chmap.rb +66 -0
- data/lib/rio/rl/fs2url.rb +82 -0
- data/lib/rio/rl/ioi.rb +78 -0
- data/lib/rio/rl/path.rb +110 -0
- data/lib/rio/rl/pathmethods.rb +116 -0
- data/lib/rio/rl/uri.rb +200 -0
- data/lib/rio/rl/withpath.rb +296 -0
- data/lib/rio/scheme/aryio.rb +88 -0
- data/lib/rio/scheme/cmdio.rb +80 -0
- data/lib/rio/scheme/cmdpipe.rb +118 -0
- data/lib/rio/scheme/fd.rb +65 -0
- data/lib/rio/scheme/ftp.rb +141 -0
- data/lib/rio/scheme/http.rb +78 -0
- data/lib/rio/scheme/null.rb +55 -0
- data/lib/rio/scheme/path.rb +98 -0
- data/lib/rio/scheme/stderr.rb +55 -0
- data/lib/rio/scheme/stdio.rb +71 -0
- data/lib/rio/scheme/strio.rb +87 -0
- data/lib/rio/scheme/sysio.rb +63 -0
- data/lib/rio/scheme/tcp.rb +75 -0
- data/lib/rio/scheme/temp.rb +200 -0
- data/lib/rio/state/error.rb +72 -0
- data/lib/rio/state.rb +242 -0
- data/lib/rio/stream/base.rb +54 -0
- data/lib/rio/stream/duplex.rb +79 -0
- data/lib/rio/stream/open.rb +202 -0
- data/lib/rio/stream.rb +181 -0
- data/lib/rio/symantics.rb +45 -0
- data/lib/rio/tempdir.rb +132 -0
- data/lib/rio/to_rio/all.rb +39 -0
- data/lib/rio/to_rio/array.rb +39 -0
- data/lib/rio/to_rio/io.rb +40 -0
- data/lib/rio/to_rio/object.rb +42 -0
- data/lib/rio/to_rio/string.rb +40 -0
- data/lib/rio/to_rio.rb +67 -0
- data/lib/rio/uri/file.rb +198 -0
- data/lib/rio/util.rb +48 -0
- data/lib/rio/version.rb +51 -0
- data/lib/rio.rb +162 -0
- data/setup.rb +1360 -0
- data/test/bin/count_lines.rb +11 -0
- data/test/bin/find_lines.rb +13 -0
- data/test/bin/list_dir.rb +14 -0
- data/test/ftp/all.rb +9 -0
- data/test/ftp/anon_copy_data.rb +36 -0
- data/test/ftp/anon_misc.rb +124 -0
- data/test/ftp/anon_read.rb +105 -0
- data/test/ftp/anon_special.rb +68 -0
- data/test/ftp/anon_write.rb +70 -0
- data/test/ftp/ftp2ftp.rb +51 -0
- data/test/ftp/initftpfiles.rb +14 -0
- data/test/ftp/testdef.rb +55 -0
- data/test/gem_runtests.rb +15 -0
- data/test/http/all.rb +4 -0
- data/test/http/copy-from-http.rb +141 -0
- data/test/http/uri-meta.rb +72 -0
- data/test/lib/temp_server.rb +46 -0
- data/test/runalltests.rb +17 -0
- data/test/runftptests.rb +14 -0
- data/test/runhttp.rb +11 -0
- data/test/runhttptests.rb +14 -0
- data/test/runtests.rb +52 -0
- data/test/tc/abs.rb +355 -0
- data/test/tc/all.rb +80 -0
- data/test/tc/base.rb +31 -0
- data/test/tc/base2.rb +87 -0
- data/test/tc/cd1.rb +113 -0
- data/test/tc/clearsel.rb +68 -0
- data/test/tc/clone.rb +208 -0
- data/test/tc/closeoncopy.rb +102 -0
- data/test/tc/closeoneof.rb +194 -0
- data/test/tc/cmdpipe.rb +149 -0
- data/test/tc/copy-dir-samevar.rb +91 -0
- data/test/tc/copy-from.rb +129 -0
- data/test/tc/copy-to.rb +91 -0
- data/test/tc/copy.rb +74 -0
- data/test/tc/copyarray.rb +188 -0
- data/test/tc/copydest.rb +50 -0
- data/test/tc/copydir.rb +166 -0
- data/test/tc/copydirlines.rb +121 -0
- data/test/tc/copylines.rb +46 -0
- data/test/tc/copynonex.rb +118 -0
- data/test/tc/copysymlink.rb +39 -0
- data/test/tc/create.rb +114 -0
- data/test/tc/csv.rb +226 -0
- data/test/tc/csv2.rb +138 -0
- data/test/tc/csv_columns.rb +37 -0
- data/test/tc/csvutil.rb +56 -0
- data/test/tc/dir.rb +76 -0
- data/test/tc/dir_iter.rb +383 -0
- data/test/tc/dirautoclose.rb +67 -0
- data/test/tc/dirent.rb +178 -0
- data/test/tc/dirss.rb +81 -0
- data/test/tc/each.rb +111 -0
- data/test/tc/each_break.rb +243 -0
- data/test/tc/edf.rb +81 -0
- data/test/tc/empty.rb +51 -0
- data/test/tc/emptyriodir.rb +129 -0
- data/test/tc/entary.rb +227 -0
- data/test/tc/entsel.rb +110 -0
- data/test/tc/eq.rb +101 -0
- data/test/tc/expand_path.rb +69 -0
- data/test/tc/ext.rb +136 -0
- data/test/tc/fileno.rb +94 -0
- data/test/tc/files_select.rb +92 -0
- data/test/tc/get.rb +152 -0
- data/test/tc/getrec.rb +137 -0
- data/test/tc/gzip.rb +109 -0
- data/test/tc/io_each_byte.rb +60 -0
- data/test/tc/io_read.rb +80 -0
- data/test/tc/iometh.rb +149 -0
- data/test/tc/likeio.rb +116 -0
- data/test/tc/line_record_row.rb +51 -0
- data/test/tc/lineno.rb +196 -0
- data/test/tc/lines.rb +66 -0
- data/test/tc/misc.rb +432 -0
- data/test/tc/nolines.rb +204 -0
- data/test/tc/noqae.rb +879 -0
- data/test/tc/null.rb +45 -0
- data/test/tc/once.rb +6 -0
- data/test/tc/overload.rb +140 -0
- data/test/tc/pa.rb +158 -0
- data/test/tc/path_parts.rb +175 -0
- data/test/tc/pathop.rb +60 -0
- data/test/tc/paths.rb +145 -0
- data/test/tc/pid.rb +31 -0
- data/test/tc/piper.rb +143 -0
- data/test/tc/programs_util.rb +24 -0
- data/test/tc/qae.rb +493 -0
- data/test/tc/qae_riovar.rb +499 -0
- data/test/tc/readline.rb +30 -0
- data/test/tc/records.rb +68 -0
- data/test/tc/rename.rb +233 -0
- data/test/tc/rename_assign.rb +45 -0
- data/test/tc/riorl.rb +181 -0
- data/test/tc/route.rb +51 -0
- data/test/tc/selnosel.rb +33 -0
- data/test/tc/skip.rb +89 -0
- data/test/tc/skiplines.rb +71 -0
- data/test/tc/split.rb +28 -0
- data/test/tc/splitlines.rb +65 -0
- data/test/tc/splitpath.rb +83 -0
- data/test/tc/sub.rb +46 -0
- data/test/tc/symlink.rb +176 -0
- data/test/tc/symlink0.rb +348 -0
- data/test/tc/symlink1.rb +114 -0
- data/test/tc/synopsis.rb +75 -0
- data/test/tc/temp.rb +152 -0
- data/test/tc/tempdir.rb +60 -0
- data/test/tc/tempfile.rb +66 -0
- data/test/tc/testcase.rb +170 -0
- data/test/tc/tonl.rb +37 -0
- data/test/tc/truncate.rb +39 -0
- data/test/tc/yaml.rb +275 -0
- metadata +387 -0
data/test/tc/nolines.rb
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
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 'test/unit'
|
|
9
|
+
require 'test/unit/testsuite'
|
|
10
|
+
|
|
11
|
+
class TC_RIO_skiplines < Test::Unit::TestCase
|
|
12
|
+
def tdir() rio(%w/qp skiplines/) end
|
|
13
|
+
def assert!(a,msg="negative assertion")
|
|
14
|
+
assert((!(a)),msg)
|
|
15
|
+
end
|
|
16
|
+
def smap(a) a.map { |el| el.to_s } end
|
|
17
|
+
def mkafile(*args)
|
|
18
|
+
file = rio(*args)
|
|
19
|
+
file < (0..1).map { |i| "L#{i}:#{file.to_s}\n" }
|
|
20
|
+
file
|
|
21
|
+
end
|
|
22
|
+
def mkalinesfile(n_lines,*args)
|
|
23
|
+
file = rio(*args)
|
|
24
|
+
file < (0...n_lines).map { |i| "L#{i}:#{file.to_s}\n" }
|
|
25
|
+
file
|
|
26
|
+
end
|
|
27
|
+
def setup
|
|
28
|
+
#$trace_states = true
|
|
29
|
+
@cwd = ::Dir.getwd
|
|
30
|
+
tdir.mkpath.chdir
|
|
31
|
+
end
|
|
32
|
+
def teardown
|
|
33
|
+
::Dir.chdir @cwd
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def test_symbol
|
|
37
|
+
rio('a').delete!.mkpath.chdir
|
|
38
|
+
|
|
39
|
+
file,lines = file_lines()
|
|
40
|
+
|
|
41
|
+
lines[1] = "\n"
|
|
42
|
+
lines[6] = "\n"
|
|
43
|
+
file < lines
|
|
44
|
+
|
|
45
|
+
exp = lines[0..0] + lines[2..5] + lines[7...8]
|
|
46
|
+
ans = file.chomp.skiplines[:empty?]
|
|
47
|
+
assert_equal(exp.map{|el| el.chomp},ans)
|
|
48
|
+
|
|
49
|
+
ans = file.skiplines(:empty?).chomp.to_a
|
|
50
|
+
assert_equal(exp.map{|el| el.chomp},ans)
|
|
51
|
+
|
|
52
|
+
file.close
|
|
53
|
+
rio('..').chdir
|
|
54
|
+
end
|
|
55
|
+
def file_lines(n_lines=8)
|
|
56
|
+
file = mkalinesfile(n_lines,'f1')
|
|
57
|
+
lines = file[]
|
|
58
|
+
(2..4).each do |n|
|
|
59
|
+
lines[n] = '#' + lines[n]
|
|
60
|
+
end
|
|
61
|
+
(0..3).each do |n|
|
|
62
|
+
lines[n].sub!(/f1/,'f2')
|
|
63
|
+
end
|
|
64
|
+
file < lines
|
|
65
|
+
[file,lines]
|
|
66
|
+
end
|
|
67
|
+
def test_basic
|
|
68
|
+
rio('a').delete!.mkpath.chdir
|
|
69
|
+
file,lines = file_lines()
|
|
70
|
+
exp = lines[1..1] + lines[5...8]
|
|
71
|
+
|
|
72
|
+
# iterate over the first line and comment lines
|
|
73
|
+
begin
|
|
74
|
+
f0 = file.dup
|
|
75
|
+
ans = f0.skiplines[0,/^\s*#/]
|
|
76
|
+
assert_equal(exp,ans)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
begin
|
|
80
|
+
f0 = file.dup
|
|
81
|
+
ans = f0.skiplines[proc { |rec,rnum,rio| rnum == 0 || rec =~ /^\s*#/ }]
|
|
82
|
+
assert_equal(exp,ans)
|
|
83
|
+
end
|
|
84
|
+
begin
|
|
85
|
+
f0 = file.dup
|
|
86
|
+
|
|
87
|
+
#$trace_states = true
|
|
88
|
+
exp0 = lines[0..1] + lines[5...8]
|
|
89
|
+
ans = f0.skiplines[/^\s*#/]
|
|
90
|
+
#p f0.cx
|
|
91
|
+
#$trace_states = false
|
|
92
|
+
assert_equal(exp0,ans)
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
def test_proc
|
|
96
|
+
file,lines = file_lines()
|
|
97
|
+
#p lines
|
|
98
|
+
exp1 = lines[4...8]
|
|
99
|
+
ans = file.lines[proc { |rec,rnum,ario| rec =~ /#{ario.filename}/ }]
|
|
100
|
+
assert_equal(exp1,ans)
|
|
101
|
+
|
|
102
|
+
exp2 = lines[2..4]
|
|
103
|
+
exp = exp1 - exp2
|
|
104
|
+
ans = file.lines(proc { |rec,rnum,ario| rec =~ /#{ario.filename}/ }).skiplines[/^\s*#/]
|
|
105
|
+
assert_equal(exp,ans)
|
|
106
|
+
|
|
107
|
+
ans = file.skiplines(/^\s*#/).lines[proc { |rec,rnum,ario| rec =~ /#{ario.filename}/ }]
|
|
108
|
+
assert_equal(exp,ans)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def test_ranges_ss
|
|
112
|
+
# $trace_states = true
|
|
113
|
+
lfile,lines = file_lines()
|
|
114
|
+
|
|
115
|
+
ans = rio('f1').skiplines(2..4).lines[0..2]
|
|
116
|
+
exp = lines[6..6]
|
|
117
|
+
|
|
118
|
+
ans = rio('f1').skiprecords(0).records(0..2).skiprecords(2..4).records[6]
|
|
119
|
+
assert_equal(exp,ans)
|
|
120
|
+
|
|
121
|
+
ans = rio('f1').lines(0..2).skiplines(0,2..4).lines[6]
|
|
122
|
+
assert_equal(exp,ans)
|
|
123
|
+
ans = rio('f1').skiplines(0,2..4).lines[0..2,6]
|
|
124
|
+
|
|
125
|
+
assert_equal(lines[1..1]+lines[6..6],ans)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
ans = rio('f1').skiplines(0).lines(0..2).skiplines(2..4).lines[6]
|
|
129
|
+
assert_equal(exp,ans)
|
|
130
|
+
ans = rio('f1').skiplines(0).lines(0..2).skiplines(2..4).lines[6]
|
|
131
|
+
assert_equal(exp,ans)
|
|
132
|
+
ans = rio('f1').records(0..2).skiprecords(0,2..4).records[6]
|
|
133
|
+
assert_equal(exp,ans)
|
|
134
|
+
ans = rio('f1').skiprecords(0,2..4).records[0..2,6]
|
|
135
|
+
assert_equal(lines[1..1]+lines[6..6],ans)
|
|
136
|
+
|
|
137
|
+
exp = lines[1..1] + lines[5..7]
|
|
138
|
+
ans = rio('f1').skiplines(0,2..4).lines[0..2,6,/f1/]
|
|
139
|
+
assert_equal(exp,ans)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
lfile.close
|
|
143
|
+
rio('..').chdir
|
|
144
|
+
end
|
|
145
|
+
def iter_tests(file,exp)
|
|
146
|
+
ans = file.clone.to_a
|
|
147
|
+
assert_equal(exp,ans)
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
ans = []
|
|
151
|
+
file.clone.each { |rec| ans << rec }
|
|
152
|
+
assert_equal(exp,ans)
|
|
153
|
+
|
|
154
|
+
ans = []
|
|
155
|
+
file.clone.each_record { |rec| ans << rec }
|
|
156
|
+
assert_equal(exp,ans)
|
|
157
|
+
|
|
158
|
+
ans = []
|
|
159
|
+
f = file.clone
|
|
160
|
+
while rec = f.getrec
|
|
161
|
+
ans << rec
|
|
162
|
+
end
|
|
163
|
+
assert_equal(exp,ans)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
end
|
|
167
|
+
def test_ranges
|
|
168
|
+
# $trace_states = true
|
|
169
|
+
lfile,lines = file_lines()
|
|
170
|
+
|
|
171
|
+
file = lfile.dup.skiplines(2..4).lines(0..2)
|
|
172
|
+
exp = lines[0..1]
|
|
173
|
+
#p "HEE"
|
|
174
|
+
# breakpoint
|
|
175
|
+
iter_tests(file,exp)
|
|
176
|
+
|
|
177
|
+
file = lfile.dup.skiprecords(0).records(0..2).skiprecords(2..4).records(6)
|
|
178
|
+
exp = lines[6..6]
|
|
179
|
+
iter_tests(file,exp)
|
|
180
|
+
|
|
181
|
+
file = lfile.dup.lines(0..2).skiplines(0,2..4).lines(6)
|
|
182
|
+
iter_tests(file,exp)
|
|
183
|
+
|
|
184
|
+
file = lfile.dup.skiplines(0,2..4).lines(0..2,6)
|
|
185
|
+
iter_tests(file,lines[1..1]+lines[6..6])
|
|
186
|
+
|
|
187
|
+
file = lfile.dup.skiplines(0).lines(0..2).skiplines(2..4).lines(6)
|
|
188
|
+
iter_tests(file,exp)
|
|
189
|
+
|
|
190
|
+
file = lfile.dup.records(0..2).skiprecords(0,2..4).records(6)
|
|
191
|
+
iter_tests(file,exp)
|
|
192
|
+
|
|
193
|
+
file = lfile.dup.skiprecords(0,2..4).records(0..2,6)
|
|
194
|
+
iter_tests(file,lines[1..1]+lines[6..6])
|
|
195
|
+
|
|
196
|
+
exp = lines[1..1] + lines[5..7]
|
|
197
|
+
file = lfile.dup.skiplines(0,2..4).lines(0..2,6,/f1/)
|
|
198
|
+
iter_tests(file,exp)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
lfile.close
|
|
202
|
+
rio('..').chdir
|
|
203
|
+
end
|
|
204
|
+
end
|
data/test/tc/noqae.rb
ADDED
|
@@ -0,0 +1,879 @@
|
|
|
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
|
+
class TC_RIO_noqae < Test::Unit::TestCase
|
|
10
|
+
@@tdir = rio(%w/qp noqae/)
|
|
11
|
+
@@once = false
|
|
12
|
+
def initialize(*args)
|
|
13
|
+
super
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def assert!(a,msg="negative assertion")
|
|
17
|
+
assert((!(a)),msg)
|
|
18
|
+
end
|
|
19
|
+
def smap(a) a.map{|el| el.to_s} end
|
|
20
|
+
def setup
|
|
21
|
+
s_dir = ''
|
|
22
|
+
#$trace_states = true
|
|
23
|
+
unless @@once
|
|
24
|
+
@@once = true
|
|
25
|
+
|
|
26
|
+
@@tdir.rmtree.mkpath.chdir do
|
|
27
|
+
rio('d0').mkpath.chdir {
|
|
28
|
+
rio('d2').mkpath
|
|
29
|
+
rio('d1').mkpath.chdir {
|
|
30
|
+
rio('d2').mkpath.chdir {
|
|
31
|
+
rio('d1').mkpath.chdir {
|
|
32
|
+
rio('f1') < (0..1).map { |i| "L#{i}:d0/d1/d2/d1/f1\n" }
|
|
33
|
+
rio('f2') < (0..1).map { |i| "L#{i}:d0/d1/d2/d1/f2\n" }
|
|
34
|
+
}
|
|
35
|
+
rio('f1') < (0..1).map { |i| "L#{i}:d0/d1/d2/f1\n" }
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
rio('f1') < (0..1).map { |i| "L#{i}:d0/f1\n" }
|
|
39
|
+
rio('f2') < (0..1).map { |i| "L#{i}:d0/f2\n" }
|
|
40
|
+
if $supports_symlink
|
|
41
|
+
rio('x1').symlink('n1')
|
|
42
|
+
rio('x2').symlink('n2')
|
|
43
|
+
rio('f1').symlink('l1')
|
|
44
|
+
rio('f2').symlink('l2')
|
|
45
|
+
rio('d1').symlink('c1')
|
|
46
|
+
rio('d2').symlink('c2')
|
|
47
|
+
else
|
|
48
|
+
rio('f1') > rio('l1')
|
|
49
|
+
rio('f2') > rio('l2')
|
|
50
|
+
rio('d1') > rio('c1')
|
|
51
|
+
rio('d2') > rio('c2')
|
|
52
|
+
end
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
rio('d1').mkpath.chdir {
|
|
56
|
+
rio('d1').mkpath.chdir {
|
|
57
|
+
rio('f1') < (0..1).map { |i| "L#{i}:d1/d1/f1\n" }
|
|
58
|
+
rio('f2') < (0..1).map { |i| "L#{i}:d1/d1/f2\n" }
|
|
59
|
+
}
|
|
60
|
+
rio('d2').mkpath.chdir {
|
|
61
|
+
rio('d1').mkpath.chdir {
|
|
62
|
+
rio('f1') < (0..1).map { |i| "L#{i}:d1/d2/d1/f1\n" }
|
|
63
|
+
rio('f2') < (0..1).map { |i| "L#{i}:d1/d2/d1/f2\n" }
|
|
64
|
+
}
|
|
65
|
+
rio('d2').mkpath
|
|
66
|
+
}
|
|
67
|
+
rio('d3').mkpath.chdir {
|
|
68
|
+
rio('d1').mkpath.chdir {
|
|
69
|
+
rio('f1') < (0..1).map { |i| "L#{i}:d1/d3/d1/f1\n" }
|
|
70
|
+
rio('d1').mkpath
|
|
71
|
+
}
|
|
72
|
+
rio('f1') < (0..1).map { |i| "L#{i}:d1/d3/f1\n" }
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
def all()
|
|
80
|
+
all = ['d0/d1','d0/d2','d0/c1','d0/c2','d0/f1','d0/f2','d0/l1','d0/l2']
|
|
81
|
+
all += ['d0/n1','d0/n2'] if $supports_symlink
|
|
82
|
+
all
|
|
83
|
+
end
|
|
84
|
+
def test_noqae_fs
|
|
85
|
+
rio('qp/noqae').chdir do
|
|
86
|
+
begin
|
|
87
|
+
|
|
88
|
+
begin
|
|
89
|
+
ans = []
|
|
90
|
+
rio('d0').each { |el| ans << el }
|
|
91
|
+
exp = all.dup
|
|
92
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
93
|
+
ans = rio('d0').to_a
|
|
94
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
95
|
+
ans = rio('d0').entries[]
|
|
96
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
begin
|
|
102
|
+
begin
|
|
103
|
+
ans = []
|
|
104
|
+
rio('d0').skipdirs.each { |el| ans << el }
|
|
105
|
+
exp = all.reject { |el| el =~ /[cd]\d$/ }
|
|
106
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
107
|
+
ans = rio('d0').skipdirs[]
|
|
108
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
begin
|
|
112
|
+
ans = []
|
|
113
|
+
rio('d0').skipfiles.each { |el| ans << el }
|
|
114
|
+
exp = all.reject { |el| el =~ /[fl]\d$/ }
|
|
115
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
116
|
+
ans = rio('d0').skipfiles[]
|
|
117
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
begin
|
|
121
|
+
ans = []
|
|
122
|
+
rio('d0').skipentries.each { |el| ans << el }
|
|
123
|
+
exp = []
|
|
124
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
125
|
+
ans = rio('d0').skipentries[]
|
|
126
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
begin
|
|
131
|
+
begin
|
|
132
|
+
ans = []
|
|
133
|
+
rio('d0').skipdirs.skipfiles.each { |el| ans << el }
|
|
134
|
+
exp = all.reject { |el| el =~ /[cdfl]\d$/ }
|
|
135
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
136
|
+
ans = rio('d0').skipfiles.skipdirs[]
|
|
137
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
138
|
+
ans = rio('d0').skipdirs.skipfiles[]
|
|
139
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
begin
|
|
143
|
+
ans = []
|
|
144
|
+
rio('d0').skipdirs.files.each { |el| ans << el }
|
|
145
|
+
exp = all.select { |el| el =~ /[fl]\d$/ }
|
|
146
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
147
|
+
ans = rio('d0').skipdirs.files[]
|
|
148
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
149
|
+
ans = rio('d0').files.skipdirs[]
|
|
150
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
begin
|
|
154
|
+
exp = all.select { |el| el =~ /[n]\d$/ }
|
|
155
|
+
ans = []
|
|
156
|
+
rio('d0').entries.skipfiles.skipdirs.each { |el| ans << el }
|
|
157
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
158
|
+
|
|
159
|
+
ans = rio('d0').entries.skipfiles.skipdirs[]
|
|
160
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
161
|
+
ans = rio('d0').entries.skipdirs.skipfiles[]
|
|
162
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
163
|
+
ans = rio('d0').skipfiles.skipdirs.entries[]
|
|
164
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
165
|
+
ans = rio('d0').skipfiles.skipdirs[]
|
|
166
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
begin
|
|
170
|
+
exp = []
|
|
171
|
+
ans = []
|
|
172
|
+
rio('d0').skipentries.dirs.each { |el| ans << el }
|
|
173
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
174
|
+
rio('d0').skipentries.files.each { |el| ans << el }
|
|
175
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
176
|
+
|
|
177
|
+
ans = rio('d0').skipentries.files[]
|
|
178
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
179
|
+
ans = rio('d0').skipentries.dirs[]
|
|
180
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
begin
|
|
184
|
+
exp = []
|
|
185
|
+
ans = []
|
|
186
|
+
rio('d0').skipentries.each { |el| ans << el }
|
|
187
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
188
|
+
ans = rio('d0').skipentries[]
|
|
189
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
190
|
+
end
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
def test_noqae_fs_de
|
|
196
|
+
@@tdir.abs.chdir do
|
|
197
|
+
begin
|
|
198
|
+
begin
|
|
199
|
+
ans = []
|
|
200
|
+
rio('d0').dirs.each { |el|
|
|
201
|
+
assert(el.directory?)
|
|
202
|
+
}
|
|
203
|
+
rio('d0').skipdirs.each { |el|
|
|
204
|
+
assert!(el.directory?)
|
|
205
|
+
}
|
|
206
|
+
rio('d0').skipdirs('*').each { |el|
|
|
207
|
+
assert(el.directory?)
|
|
208
|
+
}
|
|
209
|
+
rio('d0').files.each { |el|
|
|
210
|
+
assert(el.file?)
|
|
211
|
+
}
|
|
212
|
+
rio('d0').skipfiles.each { |el|
|
|
213
|
+
assert!(el.file?)
|
|
214
|
+
}
|
|
215
|
+
rio('d0').skipfiles('*').each { |el|
|
|
216
|
+
assert(el.file?)
|
|
217
|
+
}
|
|
218
|
+
return unless $supports_symlink
|
|
219
|
+
begin
|
|
220
|
+
exp = all.select { |el| el =~ /[lnc]\d\Z/ }
|
|
221
|
+
ans = []
|
|
222
|
+
rio('d0').entries(:symlink?).each { |el|
|
|
223
|
+
assert(el.symlink?)
|
|
224
|
+
ans << el
|
|
225
|
+
}
|
|
226
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
227
|
+
end
|
|
228
|
+
begin
|
|
229
|
+
exp = all.select { |el| el =~ /[l]\d\Z/ }
|
|
230
|
+
ans = []
|
|
231
|
+
rio('d0').files(:symlink?).each { |el|
|
|
232
|
+
assert(el.file?)
|
|
233
|
+
assert(el.symlink?)
|
|
234
|
+
ans << el
|
|
235
|
+
}
|
|
236
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
237
|
+
end
|
|
238
|
+
begin
|
|
239
|
+
exp = all.select { |el| el =~ /[c]\d\Z/ }
|
|
240
|
+
ans = []
|
|
241
|
+
rio('d0').dirs(:symlink?).each { |el|
|
|
242
|
+
assert(el.directory?)
|
|
243
|
+
assert(el.symlink?)
|
|
244
|
+
ans << el
|
|
245
|
+
}
|
|
246
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
247
|
+
end
|
|
248
|
+
begin
|
|
249
|
+
exp = all.select { |el| el =~ /[df]\d\Z/ }
|
|
250
|
+
ans = []
|
|
251
|
+
rio('d0').skipentries(:symlink?).each { |el|
|
|
252
|
+
assert!(el.symlink?)
|
|
253
|
+
ans << el
|
|
254
|
+
}
|
|
255
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
256
|
+
end
|
|
257
|
+
begin
|
|
258
|
+
exp = all.select { |el| el =~ /[d]\d\Z/ }
|
|
259
|
+
ans = []
|
|
260
|
+
rio('d0').skipdirs(:symlink?).each { |el|
|
|
261
|
+
assert(el.directory?)
|
|
262
|
+
assert!(el.symlink?)
|
|
263
|
+
ans << el
|
|
264
|
+
}
|
|
265
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
266
|
+
end
|
|
267
|
+
begin
|
|
268
|
+
exp = all.select { |el| el =~ /[f]\d\Z/ }
|
|
269
|
+
ans = []
|
|
270
|
+
rio('d0').skipfiles(:symlink?).each { |el|
|
|
271
|
+
assert(el.file?)
|
|
272
|
+
assert!(el.symlink?)
|
|
273
|
+
ans << el
|
|
274
|
+
}
|
|
275
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
276
|
+
end
|
|
277
|
+
end
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
#rio(wd).chdir
|
|
281
|
+
end
|
|
282
|
+
def test_noqae_fs_re
|
|
283
|
+
|
|
284
|
+
@@tdir.abs.chdir do
|
|
285
|
+
begin
|
|
286
|
+
|
|
287
|
+
begin
|
|
288
|
+
ere = /1/
|
|
289
|
+
exp = all.reject { |el| el =~ ere }
|
|
290
|
+
ans = []
|
|
291
|
+
rio('d0').skipentries(ere).each { |el| ans << el }
|
|
292
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
293
|
+
ans = rio('d0').skipentries(ere).to_a
|
|
294
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
295
|
+
ans = rio('d0').skipentries[ere]
|
|
296
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
begin
|
|
302
|
+
begin
|
|
303
|
+
dre = /1/
|
|
304
|
+
exp = all.select { |el| el =~ /[cd]2$/ }
|
|
305
|
+
ans = []
|
|
306
|
+
rio('d0').skipdirs(dre).each { |el| ans << el }
|
|
307
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
308
|
+
ans = rio('d0').skipdirs[dre]
|
|
309
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
begin
|
|
313
|
+
dre = /1/
|
|
314
|
+
exp = all.select { |el| el =~ /[d]2$/ }
|
|
315
|
+
ans = []
|
|
316
|
+
if $supports_symlink
|
|
317
|
+
rio('d0').skipdirs(dre,:symlink?).each { |el| ans << el }
|
|
318
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
319
|
+
ans = rio('d0').skipdirs[dre,:symlink?]
|
|
320
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
321
|
+
end
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
begin
|
|
325
|
+
fre = /2/
|
|
326
|
+
exp = all.select { |el| el =~ /[fl]1$/ }
|
|
327
|
+
ans = []
|
|
328
|
+
rio('d0').skipfiles(fre).each { |el| ans << el }
|
|
329
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
330
|
+
ans = rio('d0').skipfiles[fre]
|
|
331
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
begin
|
|
335
|
+
ere = /1/
|
|
336
|
+
exp = all.select { |el| el =~ /2$/ }
|
|
337
|
+
ans = []
|
|
338
|
+
rio('d0').skipentries(ere).each { |el| ans << el }
|
|
339
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
340
|
+
ans = rio('d0').skipentries[ere]
|
|
341
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
342
|
+
end
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
begin
|
|
346
|
+
dre = /1/
|
|
347
|
+
fre = /2/
|
|
348
|
+
begin
|
|
349
|
+
exp = all.select { |el| el =~ /([cd]2|[fl]1)$/ }
|
|
350
|
+
ans = []
|
|
351
|
+
rio('d0').skipdirs(dre).skipfiles(fre).each { |el| ans << el }
|
|
352
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
353
|
+
ans = rio('d0').skipfiles(fre).skipdirs[dre]
|
|
354
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
355
|
+
ans = rio('d0').skipdirs(dre).skipfiles[fre]
|
|
356
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
begin
|
|
360
|
+
exp = all.select { |el| el =~ /([cd]2|[fl]2)$/ }
|
|
361
|
+
ans = []
|
|
362
|
+
rio('d0').skipdirs(dre).files(fre).each { |el| ans << el }
|
|
363
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
364
|
+
ans = rio('d0').skipdirs(dre).files[fre]
|
|
365
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
366
|
+
ans = rio('d0').files(fre).skipdirs[dre]
|
|
367
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
begin
|
|
371
|
+
exp = all.select { |el| el =~ /([cd]2|[fl]1|n[12])$/ }
|
|
372
|
+
ans = []
|
|
373
|
+
rio('d0').entries.skipfiles(fre).skipdirs(dre).each { |el| ans << el }
|
|
374
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
375
|
+
|
|
376
|
+
ans = rio('d0').entries.skipfiles(fre).skipdirs[dre]
|
|
377
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
378
|
+
ans = rio('d0').entries.skipdirs(dre).skipfiles[fre]
|
|
379
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
380
|
+
ans = rio('d0').skipfiles(fre).skipdirs(dre).entries[]
|
|
381
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
begin
|
|
385
|
+
ere = /1/
|
|
386
|
+
exp = all.select { |el| el =~ /([cd]2|[fl]1|n1)$/ }
|
|
387
|
+
ans = []
|
|
388
|
+
rio('d0').entries(ere).skipfiles(fre).skipdirs(dre).each { |el| ans << el }
|
|
389
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
390
|
+
|
|
391
|
+
ans = rio('d0').entries(ere).skipfiles(fre).skipdirs[dre]
|
|
392
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
393
|
+
ans = rio('d0').entries(ere).skipdirs(dre).skipfiles[fre]
|
|
394
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
395
|
+
ans = rio('d0').skipfiles(fre).skipdirs(dre).entries[ere]
|
|
396
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
begin
|
|
400
|
+
ere = /1/
|
|
401
|
+
dre = /c/
|
|
402
|
+
fre = /f/
|
|
403
|
+
exp = all.select { |el| el =~ /(d2|l2)$/ }
|
|
404
|
+
ans = []
|
|
405
|
+
rio('d0').skipentries(ere).skipfiles(fre).skipdirs(dre).each { |el| ans << el }
|
|
406
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
407
|
+
|
|
408
|
+
ans = rio('d0').skipentries(ere).skipfiles(fre).skipdirs[dre]
|
|
409
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
410
|
+
ans = rio('d0').skipentries(ere).skipdirs(dre).skipfiles[fre]
|
|
411
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
412
|
+
ans = rio('d0').skipfiles(fre).skipdirs(dre).skipentries[ere]
|
|
413
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
414
|
+
end
|
|
415
|
+
|
|
416
|
+
begin
|
|
417
|
+
exp = []
|
|
418
|
+
ans = []
|
|
419
|
+
rio('d0').skipentries.dirs.each { |el| ans << el }
|
|
420
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
421
|
+
rio('d0').skipentries.files.each { |el| ans << el }
|
|
422
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
423
|
+
|
|
424
|
+
ans = rio('d0').skipentries.files[]
|
|
425
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
426
|
+
ans = rio('d0').skipentries.dirs[]
|
|
427
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
begin
|
|
431
|
+
ere = /1/
|
|
432
|
+
exp = all.select { |el| el =~ /2$/ }
|
|
433
|
+
ans = []
|
|
434
|
+
rio('d0').skipentries(ere).each { |el| ans << el }
|
|
435
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
436
|
+
ans = rio('d0').skipentries[ere]
|
|
437
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
438
|
+
end
|
|
439
|
+
end
|
|
440
|
+
end
|
|
441
|
+
end
|
|
442
|
+
|
|
443
|
+
def ztest_noqae_fs_re
|
|
444
|
+
all = ['d0/d1','d0/d2','d0/c1','d0/c2','d0/f1','d0/f2','d0/n1','d0/n2','d0/l1','d0/l2']
|
|
445
|
+
rio('qp/noqae').chdir do
|
|
446
|
+
begin
|
|
447
|
+
begin
|
|
448
|
+
ans = []
|
|
449
|
+
rio('d0').skipfiles(/2/).each { |el| ans << el }
|
|
450
|
+
exp = all.reject { |el| el =~ /[fl]\d$/ }
|
|
451
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
452
|
+
end
|
|
453
|
+
|
|
454
|
+
begin
|
|
455
|
+
ans = []
|
|
456
|
+
rio('d0').skipfiles('*2').each { |el| ans << el }
|
|
457
|
+
exp = ['d0/f1']
|
|
458
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
459
|
+
end
|
|
460
|
+
|
|
461
|
+
end
|
|
462
|
+
|
|
463
|
+
begin
|
|
464
|
+
begin
|
|
465
|
+
ans = []
|
|
466
|
+
rio('d0').skipfiles.each { |el| ans << el }
|
|
467
|
+
exp = ['d0/d1','d0/d2']
|
|
468
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
469
|
+
end
|
|
470
|
+
|
|
471
|
+
begin
|
|
472
|
+
ans = []
|
|
473
|
+
rio('d0').skipdirs(/2/).each { |el| ans << el }
|
|
474
|
+
exp = ['d0/d1']
|
|
475
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
476
|
+
end
|
|
477
|
+
|
|
478
|
+
begin
|
|
479
|
+
ans = []
|
|
480
|
+
rio('d0').skipdirs('*2').each { |el| ans << el }
|
|
481
|
+
exp = ['d0/d1']
|
|
482
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
483
|
+
end
|
|
484
|
+
end
|
|
485
|
+
begin
|
|
486
|
+
begin
|
|
487
|
+
ans = []
|
|
488
|
+
rio('d0').skipfiles.dirs.each { |el| ans << el }
|
|
489
|
+
exp = ['d0/d1','d0/d2','d0/f1','d0/f2']
|
|
490
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
491
|
+
end
|
|
492
|
+
begin
|
|
493
|
+
ans = []
|
|
494
|
+
rio('d0').skipfiles.dirs.each { |el| ans << el }
|
|
495
|
+
exp = ['d0/d1','d0/d2','d0/f1','d0/f2']
|
|
496
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
497
|
+
end
|
|
498
|
+
begin
|
|
499
|
+
ans = []
|
|
500
|
+
rio('d0').skipfiles.dirs.each { |el| ans << el }
|
|
501
|
+
exp = ['d0/d1','d0/d2','d0/f1','d0/f2']
|
|
502
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
503
|
+
end
|
|
504
|
+
begin
|
|
505
|
+
ans = []
|
|
506
|
+
rio('d0').skipfiles.dirs.each { |el| ans << el }
|
|
507
|
+
exp = ['d0/d1','d0/d2','d0/f1','d0/f2']
|
|
508
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
509
|
+
end
|
|
510
|
+
end
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
begin
|
|
514
|
+
begin
|
|
515
|
+
ans = []
|
|
516
|
+
rio('d0').files(/1/).dirs.each { |el| ans << el }
|
|
517
|
+
exp = ['d0/d1','d0/d2','d0/f1']
|
|
518
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
519
|
+
end
|
|
520
|
+
|
|
521
|
+
begin
|
|
522
|
+
ans = []
|
|
523
|
+
rio('d0').files.dirs(/1/).each { |el| ans << el }
|
|
524
|
+
exp = ['d0/d1','d0/f1','d0/f2']
|
|
525
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
526
|
+
end
|
|
527
|
+
|
|
528
|
+
begin
|
|
529
|
+
ans = []
|
|
530
|
+
rio('d0').files(/1/).dirs(/1/).each { |el| ans << el }
|
|
531
|
+
exp = ['d0/d1','d0/f1']
|
|
532
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
533
|
+
end
|
|
534
|
+
|
|
535
|
+
end
|
|
536
|
+
end
|
|
537
|
+
end
|
|
538
|
+
def ztest_noqae_fs_lines
|
|
539
|
+
rio('qp/noqae').chdir do
|
|
540
|
+
begin
|
|
541
|
+
begin
|
|
542
|
+
ans = []
|
|
543
|
+
rio('d0').files.each { |f|
|
|
544
|
+
f.each { |el|
|
|
545
|
+
ans << el
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
exp = ["L0:d0/f1\n","L1:d0/f1\n","L0:d0/f2\n","L1:d0/f2\n"]
|
|
549
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
550
|
+
end
|
|
551
|
+
|
|
552
|
+
begin
|
|
553
|
+
ans = []
|
|
554
|
+
rio('d0').files.lines.each { |el| ans << el }
|
|
555
|
+
exp = ["L0:d0/f1\n","L1:d0/f1\n","L0:d0/f2\n","L1:d0/f2\n"]
|
|
556
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
557
|
+
end
|
|
558
|
+
|
|
559
|
+
begin
|
|
560
|
+
ans = []
|
|
561
|
+
rio('d0').lines.files.each { |el| ans << el }
|
|
562
|
+
exp = ["L0:d0/f1\n","L1:d0/f1\n","L0:d0/f2\n","L1:d0/f2\n"]
|
|
563
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
564
|
+
end
|
|
565
|
+
|
|
566
|
+
begin
|
|
567
|
+
ans = []
|
|
568
|
+
rio('d0').files.lines(/L1/).each { |el| ans << el }
|
|
569
|
+
exp = ["L1:d0/f1\n","L1:d0/f2\n"]
|
|
570
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
571
|
+
end
|
|
572
|
+
|
|
573
|
+
begin
|
|
574
|
+
ans = []
|
|
575
|
+
rio('d0').lines(/L1/).files.each { |el| ans << el }
|
|
576
|
+
exp = ["L1:d0/f1\n","L1:d0/f2\n"]
|
|
577
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
578
|
+
end
|
|
579
|
+
|
|
580
|
+
begin
|
|
581
|
+
ans = []
|
|
582
|
+
rio('d0').lines.each { |el| ans << el }
|
|
583
|
+
exp = ["L0:d0/f1\n","L1:d0/f1\n","L0:d0/f2\n","L1:d0/f2\n"]
|
|
584
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
585
|
+
end
|
|
586
|
+
|
|
587
|
+
begin
|
|
588
|
+
ans = []
|
|
589
|
+
rio('d0').lines(/L1/).each { |el| ans << el }
|
|
590
|
+
exp = ["L1:d0/f1\n","L1:d0/f2\n"]
|
|
591
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
592
|
+
end
|
|
593
|
+
|
|
594
|
+
end
|
|
595
|
+
end
|
|
596
|
+
end
|
|
597
|
+
|
|
598
|
+
def ztest_noqae_fs_lines_ss
|
|
599
|
+
rio('qp/noqae').chdir do
|
|
600
|
+
begin
|
|
601
|
+
begin
|
|
602
|
+
ans = []
|
|
603
|
+
rio('d0').files.each { |f|
|
|
604
|
+
f.each { |el|
|
|
605
|
+
ans << el
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
exp = ["L0:d0/f1\n","L1:d0/f1\n","L0:d0/f2\n","L1:d0/f2\n"]
|
|
609
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
610
|
+
end
|
|
611
|
+
|
|
612
|
+
begin
|
|
613
|
+
ans = rio('d0').files.lines[]
|
|
614
|
+
exp = ["L0:d0/f1\n","L1:d0/f1\n","L0:d0/f2\n","L1:d0/f2\n"]
|
|
615
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
616
|
+
end
|
|
617
|
+
|
|
618
|
+
begin
|
|
619
|
+
ans = rio('d0').lines.files[]
|
|
620
|
+
exp = ["L0:d0/f1\n","L1:d0/f1\n","L0:d0/f2\n","L1:d0/f2\n"]
|
|
621
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
622
|
+
end
|
|
623
|
+
|
|
624
|
+
begin
|
|
625
|
+
ans = rio('d0').files.lines[/L1/]
|
|
626
|
+
exp = ["L1:d0/f1\n","L1:d0/f2\n"]
|
|
627
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
628
|
+
end
|
|
629
|
+
|
|
630
|
+
begin
|
|
631
|
+
ans = rio('d0').lines(/L1/).files[]
|
|
632
|
+
exp = ["L1:d0/f1\n","L1:d0/f2\n"]
|
|
633
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
634
|
+
end
|
|
635
|
+
|
|
636
|
+
begin
|
|
637
|
+
ans = rio('d0').lines[]
|
|
638
|
+
exp = ["L0:d0/f1\n","L1:d0/f1\n","L0:d0/f2\n","L1:d0/f2\n"]
|
|
639
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
640
|
+
end
|
|
641
|
+
|
|
642
|
+
begin
|
|
643
|
+
ans = rio('d0').lines[/L1/]
|
|
644
|
+
exp = ["L1:d0/f1\n","L1:d0/f2\n"]
|
|
645
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
646
|
+
end
|
|
647
|
+
|
|
648
|
+
end
|
|
649
|
+
end
|
|
650
|
+
end
|
|
651
|
+
|
|
652
|
+
def ztest_noqae_chomp
|
|
653
|
+
rio('qp/noqae').chdir do
|
|
654
|
+
begin
|
|
655
|
+
begin
|
|
656
|
+
ans = []
|
|
657
|
+
rio('d0/f1').each { |el|
|
|
658
|
+
ans << el
|
|
659
|
+
}
|
|
660
|
+
exp = ["L0:d0/f1\n","L1:d0/f1\n"]
|
|
661
|
+
assert_equal(exp,ans)
|
|
662
|
+
end
|
|
663
|
+
|
|
664
|
+
begin
|
|
665
|
+
ans = []
|
|
666
|
+
rio('d0/f1').chomp.each { |el|
|
|
667
|
+
ans << el
|
|
668
|
+
}
|
|
669
|
+
exp = ["L0:d0/f1","L1:d0/f1"]
|
|
670
|
+
assert_equal(exp,ans)
|
|
671
|
+
end
|
|
672
|
+
|
|
673
|
+
end
|
|
674
|
+
end
|
|
675
|
+
end
|
|
676
|
+
|
|
677
|
+
def ztest_noqae_fs_nest
|
|
678
|
+
ds = ['d1/d1','d1/d2','d1/d1/f1','d1/d1/f2','d1/d2/d1','d1/d2/d1/f1','d1/d2/d1/f2','d1/d2/d2',
|
|
679
|
+
'd1/d3','d1/d3/d1','d1/d3/f1','d1/d3/d1/f1','d1/d3/d1/d1']
|
|
680
|
+
rio('qp/noqae').chdir do
|
|
681
|
+
begin
|
|
682
|
+
begin
|
|
683
|
+
ans = []
|
|
684
|
+
rio('d1').dirs.each { |dir|
|
|
685
|
+
dir.each { |ent|
|
|
686
|
+
ans << ent
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
exp = ds.select { |el| el =~ %r|^d1/d\d/.\d$| }
|
|
690
|
+
assert_equal(smap(exp).sort,smap(ans).sort)
|
|
691
|
+
end
|
|
692
|
+
|
|
693
|
+
begin
|
|
694
|
+
ans = []
|
|
695
|
+
rio('d1').dirs.each { |dir|
|
|
696
|
+
dir.dirs.each { |ent|
|
|
697
|
+
ans << ent
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
exp = ds.select { |el| el =~ %r|^d1/d\d/d\d$| }
|
|
701
|
+
assert_equal(smap(exp).sort,smap(ans).sort)
|
|
702
|
+
end
|
|
703
|
+
|
|
704
|
+
begin
|
|
705
|
+
ans = []
|
|
706
|
+
rio('d1').dirs.each { |dir|
|
|
707
|
+
dir.dirs(/1/).each { |ent|
|
|
708
|
+
ans << ent
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
exp = ds.select { |el| el =~ %r|^d1/d\d/d1$| }
|
|
712
|
+
assert_equal(smap(exp).sort,smap(ans).sort)
|
|
713
|
+
end
|
|
714
|
+
|
|
715
|
+
begin
|
|
716
|
+
ans = []
|
|
717
|
+
rio('d1').dirs.each { |dir|
|
|
718
|
+
dir.all.dirs.each { |ent|
|
|
719
|
+
ans << ent
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
exp = ds.select { |el| el =~ %r|^d1/d\d/| && el =~ %r|d\d$|}
|
|
723
|
+
assert_equal(smap(exp).sort,smap(ans).sort)
|
|
724
|
+
end
|
|
725
|
+
|
|
726
|
+
begin
|
|
727
|
+
ans = []
|
|
728
|
+
rio('d1').dirs.each { |dir|
|
|
729
|
+
dir.all.dirs(/1/).each { |ent|
|
|
730
|
+
ans << ent
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
exp = ds.select { |el| el =~ %r|^d1/d\d/| && el =~ %r|d1$|}
|
|
734
|
+
assert_equal(smap(exp).sort,smap(ans).sort)
|
|
735
|
+
end
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
begin
|
|
739
|
+
ans = []
|
|
740
|
+
rio('d1').dirs.each { |dir|
|
|
741
|
+
dir.files.each { |ent|
|
|
742
|
+
ans << ent
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
exp = ds.select { |el| el =~ %r|^d1/d\d/q\d$| }
|
|
746
|
+
assert_equal(smap(exp).sort,smap(ans).sort)
|
|
747
|
+
end
|
|
748
|
+
|
|
749
|
+
begin
|
|
750
|
+
ans = []
|
|
751
|
+
rio('d1').dirs.each { |dir|
|
|
752
|
+
dir.files(/1/).each { |ent|
|
|
753
|
+
ans << ent
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
exp = ds.select { |el| el =~ %r|^d1/d\d/f1$| }
|
|
757
|
+
assert_equal(smap(exp).sort,smap(ans).sort)
|
|
758
|
+
end
|
|
759
|
+
|
|
760
|
+
begin
|
|
761
|
+
ans = []
|
|
762
|
+
rio('d1').dirs.each { |dir|
|
|
763
|
+
dir.all.files.each { |ent|
|
|
764
|
+
ans << ent
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
exp = ds.select { |el| el =~ %r|^d1/d\d/| && el =~ %r|q\d$|}
|
|
768
|
+
assert_equal(smap(exp).sort,smap(ans).sort)
|
|
769
|
+
end
|
|
770
|
+
|
|
771
|
+
begin
|
|
772
|
+
ans = []
|
|
773
|
+
rio('d1').dirs.each { |dir|
|
|
774
|
+
dir.all.files(/1/).each { |ent|
|
|
775
|
+
ans << ent
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
exp = ds.select { |el| el =~ %r|^d1/d\d/| && el =~ %r|f1$|}
|
|
779
|
+
assert_equal(smap(exp).sort,smap(ans).sort)
|
|
780
|
+
end
|
|
781
|
+
|
|
782
|
+
end
|
|
783
|
+
end
|
|
784
|
+
end
|
|
785
|
+
|
|
786
|
+
def ztest_noqae_fs_all
|
|
787
|
+
ds = ['d0/d1','d0/d2','d0/f1','d0/f2','d0/d1/d2','d0/d1/d2/d1','d0/d1/d2/f1','d0/d1/d2/d1/f1','d0/d1/d2/d1/f2']
|
|
788
|
+
rio('qp/noqae').chdir do
|
|
789
|
+
begin
|
|
790
|
+
begin
|
|
791
|
+
ans = []
|
|
792
|
+
rio('d0').all.each { |el| ans << el }
|
|
793
|
+
exp = ds.dup
|
|
794
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
795
|
+
end
|
|
796
|
+
|
|
797
|
+
end
|
|
798
|
+
|
|
799
|
+
begin
|
|
800
|
+
begin
|
|
801
|
+
ans = []
|
|
802
|
+
rio('d0').all.files.dirs.each { |el| ans << el }
|
|
803
|
+
exp = ds.select { |el| el =~ /[qd]\d$/ }
|
|
804
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
805
|
+
end
|
|
806
|
+
|
|
807
|
+
begin
|
|
808
|
+
ans = []
|
|
809
|
+
rio('d0').all.files(/1/).dirs.each { |el| ans << el }
|
|
810
|
+
exp = ds.select { |el| el =~ /(d\d|f1)$/ }
|
|
811
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
812
|
+
end
|
|
813
|
+
|
|
814
|
+
begin
|
|
815
|
+
ans = []
|
|
816
|
+
rio('d0').all.files.dirs(/1/).each { |el| ans << el }
|
|
817
|
+
exp = ds.select { |el| el =~ /(q\d|d1)$/ }
|
|
818
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
819
|
+
end
|
|
820
|
+
|
|
821
|
+
begin
|
|
822
|
+
ans = []
|
|
823
|
+
rio('d0').all.files(/1/).dirs(/1/).each { |el| ans << el }
|
|
824
|
+
exp = ds.select { |el| el =~ /[qd]1$/ }
|
|
825
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
826
|
+
end
|
|
827
|
+
|
|
828
|
+
end
|
|
829
|
+
|
|
830
|
+
begin
|
|
831
|
+
begin
|
|
832
|
+
ans = []
|
|
833
|
+
rio('d0').all.files.each { |el| ans << el }
|
|
834
|
+
exp = ds.select { |el| el =~ /q\d$/ }
|
|
835
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
836
|
+
end
|
|
837
|
+
|
|
838
|
+
begin
|
|
839
|
+
ans = []
|
|
840
|
+
rio('d0').all.files(/1/).each { |el| ans << el }
|
|
841
|
+
exp = ds.select { |el| el =~ /f1$/ }
|
|
842
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
843
|
+
end
|
|
844
|
+
|
|
845
|
+
begin
|
|
846
|
+
ans = []
|
|
847
|
+
rio('d0').all.files('*1').each { |el| ans << el }
|
|
848
|
+
exp = ds.select { |el| el =~ /f1$/ }
|
|
849
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
850
|
+
end
|
|
851
|
+
|
|
852
|
+
end
|
|
853
|
+
|
|
854
|
+
begin
|
|
855
|
+
begin
|
|
856
|
+
ans = []
|
|
857
|
+
rio('d0').all.dirs.each { |el| ans << el }
|
|
858
|
+
exp = ds.reject { |el| el =~ /q\d$/ }
|
|
859
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
860
|
+
end
|
|
861
|
+
|
|
862
|
+
begin
|
|
863
|
+
ans = []
|
|
864
|
+
rio('d0').all.dirs(/1/).each { |el| ans << el }
|
|
865
|
+
exp = ds.select { |el| el =~ /d1$/ }
|
|
866
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
867
|
+
end
|
|
868
|
+
|
|
869
|
+
begin
|
|
870
|
+
ans = []
|
|
871
|
+
rio('d0').all.dirs('*1').each { |el| ans << el }
|
|
872
|
+
exp = ds.select { |el| el =~ /d1$/ }
|
|
873
|
+
assert_equal(exp.sort,smap(ans).sort)
|
|
874
|
+
end
|
|
875
|
+
|
|
876
|
+
end
|
|
877
|
+
end
|
|
878
|
+
end
|
|
879
|
+
end
|