rio 0.3.8 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- data/README +18 -12
- data/Rakefile +57 -87
- data/build_doc.rb +19 -17
- data/doc/ANNOUNCE +3 -32
- data/doc/RELEASE_NOTES +4 -5
- data/doc/RIOIS +215 -0
- data/doc/generators/template/html/rio.css +428 -0
- data/doc/generators/template/html/rio.rb +18 -389
- data/doc/generators/template/html/ugly.rb +130 -0
- data/doc/pkg_def.rb +66 -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.rb +16 -10
- data/lib/rio/abstract_method.rb +3 -4
- data/lib/rio/argv.rb +3 -4
- data/lib/rio/arycopy.rb +3 -4
- data/lib/rio/assert.rb +3 -4
- data/lib/rio/base.rb +3 -4
- data/lib/rio/callstr.rb +3 -4
- data/lib/rio/const.rb +3 -4
- data/lib/rio/construct.rb +3 -4
- data/lib/rio/constructor.rb +12 -8
- data/lib/rio/context.rb +15 -30
- data/lib/rio/context/autoclose.rb +3 -4
- data/lib/rio/context/copying.rb +3 -4
- data/lib/rio/context/cxx.rb +3 -4
- data/lib/rio/context/dir.rb +3 -4
- data/lib/rio/context/gzip.rb +3 -4
- data/lib/rio/context/methods.rb +16 -5
- data/lib/rio/context/skip.rb +3 -4
- data/lib/rio/context/stream.rb +42 -5
- data/lib/rio/cp.rb +7 -7
- data/lib/rio/def.rb +3 -4
- data/lib/rio/dir.rb +3 -4
- data/lib/rio/doc.rb +4 -5
- data/lib/rio/doc/EXAMPLES.rb +299 -0
- data/lib/rio/doc/HOWTO.rb +3 -4
- data/lib/rio/doc/INTRO.rb +86 -105
- data/lib/rio/doc/OPTIONAL.rb +4 -5
- data/lib/rio/doc/SYNOPSIS.rb +7 -6
- data/lib/rio/entrysel.rb +21 -23
- data/lib/rio/exception.rb +3 -4
- data/lib/rio/exception/copy.rb +3 -4
- data/lib/rio/exception/notimplemented.rb +57 -0
- data/lib/rio/exception/notsupported.rb +3 -4
- data/lib/rio/exception/open.rb +3 -4
- data/lib/rio/exception/state.rb +3 -4
- data/lib/rio/ext.rb +47 -13
- data/lib/rio/ext/csv.rb +4 -5
- 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.rb +9 -5
- data/lib/rio/ext/yaml/doc.rb +133 -0
- data/lib/rio/ext/yaml/tie.rb +149 -0
- data/lib/rio/ext/zipfile.rb +23 -4
- 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/factory.rb +235 -27
- data/lib/rio/file.rb +4 -4
- data/lib/rio/filter.rb +3 -4
- data/lib/rio/filter/closeoneof.rb +3 -4
- data/lib/rio/filter/gzip.rb +9 -4
- data/lib/rio/fs/base.rb +3 -4
- data/lib/rio/fs/impl.rb +4 -5
- data/lib/rio/fs/native.rb +3 -4
- data/lib/rio/fs/stream.rb +3 -4
- data/lib/rio/fs/url.rb +3 -4
- data/lib/rio/ftp/conncache.rb +19 -5
- data/lib/rio/ftp/dir.rb +3 -4
- data/lib/rio/ftp/fs.rb +30 -24
- data/lib/rio/grande.rb +27 -7
- data/lib/rio/handle.rb +3 -4
- data/lib/rio/if.rb +19 -15
- data/lib/rio/if/basic.rb +7 -7
- data/lib/rio/if/csv.rb +5 -6
- data/lib/rio/if/dir.rb +120 -114
- data/lib/rio/if/file.rb +52 -44
- data/lib/rio/if/fileordir.rb +217 -211
- data/lib/rio/if/grande.rb +674 -644
- data/lib/rio/if/grande_entry.rb +321 -313
- data/lib/rio/if/grande_stream.rb +653 -553
- data/lib/rio/if/internal.rb +3 -4
- data/lib/rio/if/path.rb +425 -426
- data/lib/rio/if/rubyio.rb +681 -0
- data/lib/rio/if/string.rb +42 -5
- data/lib/rio/if/temp.rb +3 -4
- data/lib/rio/if/test.rb +245 -238
- data/lib/rio/if/yaml.rb +15 -41
- data/lib/rio/ioh.rb +7 -5
- data/lib/rio/iomode.rb +19 -7
- data/lib/rio/ios/fail.rb +4 -5
- data/lib/rio/ios/generic.rb +4 -5
- data/lib/rio/ios/mode.rb +4 -5
- data/lib/rio/ios/null.rb +6 -7
- data/lib/rio/iowrap.rb +3 -4
- data/lib/rio/kernel.rb +3 -5
- data/lib/rio/local.rb +3 -4
- data/lib/rio/match.rb +3 -4
- data/lib/rio/matchrecord.rb +3 -4
- data/lib/rio/no_warn.rb +3 -4
- data/lib/rio/nullio.rb +3 -4
- data/lib/rio/open3.rb +4 -5
- data/lib/rio/ops/construct.rb +3 -4
- data/lib/rio/ops/create.rb +11 -6
- data/lib/rio/ops/dir.rb +19 -8
- data/lib/rio/ops/either.rb +6 -5
- data/lib/rio/ops/file.rb +3 -4
- data/lib/rio/ops/path.rb +14 -35
- data/lib/rio/ops/stream.rb +3 -4
- data/lib/rio/ops/stream/input.rb +4 -7
- data/lib/rio/ops/stream/output.rb +3 -4
- data/lib/rio/ops/stream/read.rb +6 -5
- data/lib/rio/ops/stream/write.rb +3 -4
- data/lib/rio/ops/symlink.rb +3 -4
- data/lib/rio/path.rb +22 -18
- data/lib/rio/path/reset.rb +4 -5
- data/lib/rio/piper.rb +3 -4
- data/lib/rio/piper/cp.rb +3 -4
- data/lib/rio/prompt.rb +10 -5
- data/lib/rio/rectype.rb +5 -5
- data/lib/rio/rl/base.rb +17 -71
- data/lib/rio/rl/builder.rb +14 -38
- data/lib/rio/rl/chmap.rb +66 -0
- data/lib/rio/rl/fs2url.rb +82 -0
- data/lib/rio/rl/ioi.rb +4 -4
- data/lib/rio/rl/path.rb +44 -122
- data/lib/rio/rl/pathmethods.rb +19 -8
- data/lib/rio/rl/uri.rb +137 -60
- data/lib/rio/rl/withpath.rb +295 -0
- data/lib/rio/scheme/aryio.rb +3 -4
- data/lib/rio/scheme/cmdio.rb +3 -4
- data/lib/rio/scheme/cmdpipe.rb +4 -4
- data/lib/rio/scheme/fd.rb +3 -4
- data/lib/rio/scheme/ftp.rb +7 -7
- data/lib/rio/scheme/http.rb +4 -5
- data/lib/rio/scheme/null.rb +3 -4
- data/lib/rio/scheme/path.rb +3 -4
- data/lib/rio/scheme/stderr.rb +3 -4
- data/lib/rio/scheme/stdio.rb +3 -4
- data/lib/rio/scheme/strio.rb +3 -4
- data/lib/rio/scheme/sysio.rb +3 -4
- data/lib/rio/scheme/tcp.rb +3 -4
- data/lib/rio/scheme/temp.rb +6 -6
- data/lib/rio/state.rb +18 -46
- data/lib/rio/state/error.rb +3 -4
- data/lib/rio/stream.rb +4 -4
- data/lib/rio/stream/base.rb +3 -4
- data/lib/rio/stream/duplex.rb +3 -4
- data/lib/rio/stream/open.rb +3 -8
- data/lib/rio/symantics.rb +3 -4
- data/lib/rio/tempdir.rb +2 -2
- data/lib/rio/to_rio.rb +3 -4
- data/lib/rio/to_rio/all.rb +3 -4
- data/lib/rio/to_rio/array.rb +4 -5
- data/lib/rio/to_rio/io.rb +4 -5
- data/lib/rio/to_rio/object.rb +4 -5
- data/lib/rio/to_rio/string.rb +4 -5
- data/lib/rio/uri/file.rb +41 -5
- data/lib/rio/util.rb +3 -4
- data/lib/rio/version.rb +4 -5
- data/setup.rb +368 -339
- data/test/bin/list_dir.rb +1 -1
- data/test/ftp/anon_misc.rb +13 -1
- data/test/ftp/anon_special.rb +6 -6
- data/test/ftp/anon_write.rb +10 -3
- data/test/ftp/ftp2ftp.rb +2 -2
- data/test/ftp/testdef.rb +9 -6
- data/test/http/all.rb +3 -0
- data/test/http/copy-from-http.rb +140 -0
- data/test/lib/temp_server.rb +44 -0
- data/test/runalltests.rb +3 -1
- data/test/runhttp.rb +12 -0
- data/test/runhttptests.rb +1 -1
- data/test/runtests.rb +41 -3
- data/test/tc/abs.rb +9 -5
- data/test/tc/all.rb +9 -4
- data/test/tc/base.rb +1 -1
- data/test/tc/base2.rb +87 -0
- data/test/tc/{methods.rb → clone.rb} +72 -50
- data/test/tc/closeoncopy.rb +13 -2
- data/test/tc/copy-dir-samevar.rb +91 -0
- data/test/tc/dir_iter.rb +0 -1
- data/test/tc/empty.rb +6 -2
- data/test/tc/expand_path.rb +36 -54
- data/test/tc/ext.rb +42 -18
- data/test/tc/gzip.rb +30 -3
- data/test/tc/likeio.rb +5 -1
- data/test/tc/line_record_row.rb +51 -0
- data/test/tc/noqae.rb +71 -70
- data/test/tc/path_parts.rb +175 -0
- data/test/tc/programs_util.rb +3 -3
- data/test/tc/rename.rb +4 -5
- data/test/tc/riorl.rb +9 -7
- data/test/tc/skip.rb +35 -6
- data/test/tc/skiplines.rb +34 -5
- data/test/tc/split.rb +8 -50
- data/test/tc/splitlines.rb +65 -0
- data/test/tc/splitpath.rb +83 -0
- data/test/tc/testcase.rb +1 -1
- data/test/tc/truncate.rb +39 -0
- data/test/tc/yaml.rb +9 -8
- metadata +261 -207
- data/ChangeLog +0 -1418
- data/VERSION +0 -1
- data/lib/rio/doc/MISC.rb +0 -259
- data/lib/rio/if/stream.rb +0 -680
- data/lib/rio/impl/path.rb +0 -87
- data/test/tc/copy-from-http.rb +0 -89
data/test/tc/dir_iter.rb
CHANGED
data/test/tc/empty.rb
CHANGED
@@ -9,6 +9,10 @@ require 'tc/testcase'
|
|
9
9
|
|
10
10
|
class TC_empty < Test::RIO::TestCase
|
11
11
|
@@once = false
|
12
|
+
|
13
|
+
require 'tc/programs_util'
|
14
|
+
include Test::RIO::Programs
|
15
|
+
|
12
16
|
def self.once
|
13
17
|
@@once = true
|
14
18
|
|
@@ -36,10 +40,10 @@ class TC_empty < Test::RIO::TestCase
|
|
36
40
|
assert!(rio('f1').empty?)
|
37
41
|
end
|
38
42
|
def test_ps_empty
|
39
|
-
assert(rio(?-,'
|
43
|
+
assert(rio(?-,PROG['list_dir'] + ' d0').empty?)
|
40
44
|
end
|
41
45
|
def test_ps_not_empty
|
42
|
-
assert!(rio(?-,'
|
46
|
+
assert!(rio(?-,PROG['list_dir'] + ' d1').empty?)
|
43
47
|
end
|
44
48
|
def test_dev_null_empty
|
45
49
|
assert(rio(nil).empty?)
|
data/test/tc/expand_path.rb
CHANGED
@@ -5,34 +5,24 @@ if $0 == __FILE__
|
|
5
5
|
end
|
6
6
|
|
7
7
|
require 'rio'
|
8
|
-
require '
|
9
|
-
|
8
|
+
require 'tc/testcase'
|
9
|
+
|
10
|
+
class TC_RIO_expand_path < Test::RIO::TestCase
|
11
|
+
@@once = false
|
12
|
+
def self.once
|
13
|
+
@@once = true
|
10
14
|
|
11
|
-
class TC_RIO_expand_path < Test::Unit::TestCase
|
12
|
-
def initialize(*args)
|
13
|
-
super
|
14
|
-
@once = false
|
15
|
-
@tdir = rio('qp/expand_path')
|
16
|
-
end
|
17
|
-
def assert!(a,msg="negative assertion")
|
18
|
-
assert((!(a)),msg)
|
19
15
|
end
|
20
|
-
|
16
|
+
|
21
17
|
def setup
|
22
|
-
|
23
|
-
|
24
|
-
unless @once
|
25
|
-
@once = true
|
26
|
-
@tdir.rmtree.mkpath
|
27
|
-
end
|
18
|
+
super
|
19
|
+
self.class.once unless @@once
|
28
20
|
end
|
29
21
|
|
30
22
|
def test_expand_path_from_cwd
|
31
23
|
require 'tmpdir'
|
32
|
-
|
33
|
-
|
34
|
-
tmp = rio(RIO::RL.fs2url(::Dir.tmpdir))
|
35
|
-
end
|
24
|
+
|
25
|
+
tmp = rio(::Dir.tmpdir)
|
36
26
|
tmp.chdir do
|
37
27
|
rel = rio('groovy')
|
38
28
|
exp = rio(tmp,rel)
|
@@ -43,45 +33,37 @@ class TC_RIO_expand_path < Test::Unit::TestCase
|
|
43
33
|
end
|
44
34
|
|
45
35
|
def test_expand_path_from_base_rio
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
assert_equal(exp,ans)
|
55
|
-
end
|
36
|
+
srel = 'groovy'
|
37
|
+
sbase = '/tmp'
|
38
|
+
rel = rio(srel)
|
39
|
+
base = rio(sbase)
|
40
|
+
exp = File.expand_path(srel,sbase)
|
41
|
+
ans = rel.expand_path(base)
|
42
|
+
assert_kind_of(RIO::Rio,ans)
|
43
|
+
assert_equal(exp,ans)
|
56
44
|
end
|
57
45
|
|
58
46
|
def test_expand_path_from_base_string
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
assert_equal(exp,ans)
|
68
|
-
end
|
47
|
+
srel = 'groovy'
|
48
|
+
sbase = '/tmp'
|
49
|
+
rel = rio(srel)
|
50
|
+
base = rio(sbase)
|
51
|
+
exp = File.expand_path(srel,sbase)
|
52
|
+
ans = rel.expand_path(sbase)
|
53
|
+
assert_kind_of(RIO::Rio,ans)
|
54
|
+
assert_equal(exp,ans)
|
69
55
|
end
|
70
56
|
|
71
57
|
def test_expand_path_from_tilde
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
end
|
58
|
+
return if $mswin32
|
59
|
+
srel = 'groovy'
|
60
|
+
sbase = '~'
|
61
|
+
rel = rio(srel)
|
62
|
+
base = rio(sbase)
|
63
|
+
exp = File.expand_path(srel,sbase)
|
64
|
+
ans = rel.expand_path(sbase)
|
65
|
+
assert_kind_of(RIO::Rio,ans)
|
66
|
+
assert_equal(exp,ans)
|
82
67
|
end
|
83
68
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
69
|
end
|
data/test/tc/ext.rb
CHANGED
@@ -6,26 +6,30 @@ end
|
|
6
6
|
|
7
7
|
require 'rio'
|
8
8
|
require 'tc/testcase'
|
9
|
-
class TC_ext < Test::
|
9
|
+
class TC_ext < Test::RIO::TestCase
|
10
10
|
@@once = false
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
unless @@once
|
15
|
-
@@once = true
|
16
|
-
end
|
11
|
+
def self.once
|
12
|
+
@@once = true
|
13
|
+
|
17
14
|
end
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
rio('a/b/f').rename('a/c')
|
24
|
-
rio('a/b/d').mkdir
|
25
|
-
rio('a/b/d').rename('a/c')
|
26
|
-
assert(rio('a/c/f').exist?)
|
27
|
-
assert(rio('a/c/d').exist?)
|
15
|
+
|
16
|
+
def setup
|
17
|
+
super
|
18
|
+
self.class.once unless @@once
|
19
|
+
|
28
20
|
end
|
21
|
+
|
22
|
+
# def test_mvdir
|
23
|
+
# rio('a').rmtree.mkpath
|
24
|
+
# rio('a/b').mkpath
|
25
|
+
# rio('a/c').mkpath
|
26
|
+
# rio('a/b/f').touch
|
27
|
+
# rio('a/b/f').rename('a/c')
|
28
|
+
# rio('a/b/d').mkdir
|
29
|
+
# rio('a/b/d').rename('a/c')
|
30
|
+
# assert(rio('a/c/f').exist?)
|
31
|
+
# assert(rio('a/c/d').exist?)
|
32
|
+
# end
|
29
33
|
def test_change_ext_in_dir
|
30
34
|
rio('ch').rmtree.mkpath
|
31
35
|
rio('ch/0.a').touch
|
@@ -66,7 +70,7 @@ class TC_ext < Test::Unit::TestCase
|
|
66
70
|
assert(rio('tgz/z.tgz').exist?)
|
67
71
|
end
|
68
72
|
def test_ext
|
69
|
-
ario =
|
73
|
+
ario = rio('afile.tar.gz').touch
|
70
74
|
$trace_states = false
|
71
75
|
ario.rename!('cfile.tgz')
|
72
76
|
# ario.ext('.tar.gz').basename = 'bfile'
|
@@ -109,4 +113,24 @@ class TC_ext < Test::Unit::TestCase
|
|
109
113
|
abs2 = rio(RIO.cwd,path.dirname,path.basename(path.extname).to_s+path.extname).to_s
|
110
114
|
assert_equal(abs0,abs2.to_s)
|
111
115
|
end
|
116
|
+
def test_documented_example
|
117
|
+
ario = rio('afile.txt')
|
118
|
+
assert_equal('.txt',ario.ext?)
|
119
|
+
assert_equal('afile',ario.ext('.txt').basename)
|
120
|
+
assert_equal('.txt',ario.ext?)
|
121
|
+
assert_equal('afile.txt',ario.ext('.zip').basename)
|
122
|
+
assert_equal('.zip',ario.ext?)
|
123
|
+
assert_equal('afile.txt',ario.basename('.tar'))
|
124
|
+
assert_equal('.tar',ario.ext?)
|
125
|
+
assert_equal('afile',ario.ext.basename)
|
126
|
+
assert_equal('.txt',ario.ext?)
|
127
|
+
assert_equal('afile.txt',ario.noext.basename)
|
128
|
+
assert_equal('',ario.ext?)
|
129
|
+
|
130
|
+
ario = rio('afile.tar.gz')
|
131
|
+
assert_equal('.gz',ario.ext?)
|
132
|
+
assert_equal('afile.tar',ario.basename)
|
133
|
+
assert_equal('afile',ario.ext('.tar.gz').basename)
|
134
|
+
assert_equal('.tar.gz',ario.ext?)
|
135
|
+
end
|
112
136
|
end
|
data/test/tc/gzip.rb
CHANGED
@@ -49,21 +49,48 @@ class TC_gzip < Test::RIO::TestCase
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def test_file
|
52
|
-
str = "Hello World
|
53
|
-
rio('src').
|
52
|
+
str = "Hello World"
|
53
|
+
rio('src').puts!(str)
|
54
54
|
|
55
55
|
rio('src.gz').delete!
|
56
56
|
rio('ans').delete!
|
57
57
|
rio('src') > rio('src.gz').gzip
|
58
58
|
rio('src.gz').gzip > rio('ans')
|
59
|
-
assert_equal(str,rio('ans').
|
59
|
+
assert_equal(str,rio('ans').chomp.line[0])
|
60
60
|
|
61
61
|
rio('src.gz').delete!
|
62
62
|
rio('ans').delete!
|
63
63
|
rio('src.gz').gzip < rio('src')
|
64
64
|
rio('ans') < rio('src.gz').gzip
|
65
|
+
assert_equal(str,rio('ans').chomp.line[0])
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_file_each
|
70
|
+
str = "Hello World\n"
|
71
|
+
rio('src').print!(str)
|
72
|
+
|
73
|
+
rio('src.gz').delete!
|
74
|
+
rio('ans').delete!
|
75
|
+
dst = rio('src.gz').gzip
|
76
|
+
rio('src').each do |l|
|
77
|
+
dst.print(l)
|
78
|
+
end
|
79
|
+
dst.close
|
80
|
+
ans = rio('ans')
|
81
|
+
rio('src.gz').gzip do |l|
|
82
|
+
ans.print(l)
|
83
|
+
end
|
84
|
+
ans.close
|
85
|
+
|
65
86
|
assert_equal(str,rio('ans').contents)
|
66
87
|
|
88
|
+
# rio('src.gz').delete!
|
89
|
+
# rio('ans').delete!
|
90
|
+
# rio('src.gz').gzip < rio('src')
|
91
|
+
# rio('ans') < rio('src.gz').gzip
|
92
|
+
# assert_equal(str,rio('ans').contents)
|
93
|
+
|
67
94
|
end
|
68
95
|
|
69
96
|
def test_tempfile
|
data/test/tc/likeio.rb
CHANGED
@@ -42,10 +42,14 @@ class TC_likeio < Test::RIO::TestCase
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def check_read_method(fruby,frio,n,sym,*args)
|
45
|
+
#$trace_states = true
|
45
46
|
n.times {
|
46
|
-
|
47
|
+
exp = fruby.__send__(sym,*args)
|
48
|
+
ans = frio.__send__(sym,*args)
|
49
|
+
assert_equal(exp,ans)
|
47
50
|
assert_equal(fruby.eof?,frio.eof?)
|
48
51
|
}
|
52
|
+
#$trace_states = false
|
49
53
|
end
|
50
54
|
|
51
55
|
def check_read_method_raises_eof(fruby,frio,n,sym,*args)
|
@@ -0,0 +1,51 @@
|
|
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_line_record_row < Test::RIO::TestCase
|
11
|
+
@@once = false
|
12
|
+
def self.once
|
13
|
+
@@once = true
|
14
|
+
rio('f0') < ['zero','one','two','three'].map{ |w| w + $/ }
|
15
|
+
end
|
16
|
+
def setup
|
17
|
+
super
|
18
|
+
self.class.once unless @@once
|
19
|
+
@f0 = rio('f0')
|
20
|
+
end
|
21
|
+
def test_line
|
22
|
+
assert_equal(rio(@f0).lines[0][0],rio(@f0).line[0])
|
23
|
+
assert_equal(rio(@f0).lines[1][0],rio(@f0).line[1])
|
24
|
+
assert_equal(rio(@f0).lines[2][0],rio(@f0).line[2])
|
25
|
+
assert_equal(rio(@f0).lines[3][0],rio(@f0).line[3])
|
26
|
+
assert_equal(rio(@f0).lines[4][0],rio(@f0).line[4])
|
27
|
+
assert_equal(rio(@f0).lines[1..2][0],rio(@f0).line[1])
|
28
|
+
assert_equal(rio(@f0).lines[/t/][0],rio(@f0).line[/t/])
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_record
|
32
|
+
assert_equal(rio(@f0).records[0][0],rio(@f0).record[0])
|
33
|
+
assert_equal(rio(@f0).records[1][0],rio(@f0).record[1])
|
34
|
+
assert_equal(rio(@f0).records[2][0],rio(@f0).record[2])
|
35
|
+
assert_equal(rio(@f0).records[3][0],rio(@f0).record[3])
|
36
|
+
assert_equal(rio(@f0).records[4][0],rio(@f0).record[4])
|
37
|
+
assert_equal(rio(@f0).records[1..2][0],rio(@f0).record[1])
|
38
|
+
assert_equal(rio(@f0).records[/t/][0],rio(@f0).record[/t/])
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_row
|
42
|
+
assert_equal(rio(@f0).rows[0][0],rio(@f0).row[0])
|
43
|
+
assert_equal(rio(@f0).rows[1][0],rio(@f0).row[1])
|
44
|
+
assert_equal(rio(@f0).rows[2][0],rio(@f0).row[2])
|
45
|
+
assert_equal(rio(@f0).rows[3][0],rio(@f0).row[3])
|
46
|
+
assert_equal(rio(@f0).rows[4][0],rio(@f0).row[4])
|
47
|
+
assert_equal(rio(@f0).rows[1..2][0],rio(@f0).row[1])
|
48
|
+
assert_equal(rio(@f0).rows[/t/][0],rio(@f0).row[/t/])
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
data/test/tc/noqae.rb
CHANGED
@@ -193,90 +193,91 @@ class TC_RIO_noqae < Test::Unit::TestCase
|
|
193
193
|
end
|
194
194
|
|
195
195
|
def test_noqae_fs_de
|
196
|
-
@@tdir.abs.chdir
|
197
|
-
begin
|
196
|
+
@@tdir.abs.chdir do
|
198
197
|
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
198
|
begin
|
220
|
-
exp = all.select { |el| el =~ /[lnc]\d\Z/ }
|
221
199
|
ans = []
|
222
|
-
rio('d0').
|
223
|
-
assert(el.
|
224
|
-
ans << el
|
200
|
+
rio('d0').dirs.each { |el|
|
201
|
+
assert(el.directory?)
|
225
202
|
}
|
226
|
-
|
227
|
-
|
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
|
203
|
+
rio('d0').skipdirs.each { |el|
|
204
|
+
assert!(el.directory?)
|
235
205
|
}
|
236
|
-
|
237
|
-
end
|
238
|
-
begin
|
239
|
-
exp = all.select { |el| el =~ /[c]\d\Z/ }
|
240
|
-
ans = []
|
241
|
-
rio('d0').dirs(:symlink?).each { |el|
|
206
|
+
rio('d0').skipdirs('*').each { |el|
|
242
207
|
assert(el.directory?)
|
243
|
-
assert(el.symlink?)
|
244
|
-
ans << el
|
245
208
|
}
|
246
|
-
|
247
|
-
|
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
|
209
|
+
rio('d0').files.each { |el|
|
210
|
+
assert(el.file?)
|
254
211
|
}
|
255
|
-
|
256
|
-
|
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
|
212
|
+
rio('d0').skipfiles.each { |el|
|
213
|
+
assert!(el.file?)
|
264
214
|
}
|
265
|
-
|
266
|
-
end
|
267
|
-
begin
|
268
|
-
exp = all.select { |el| el =~ /[f]\d\Z/ }
|
269
|
-
ans = []
|
270
|
-
rio('d0').skipfiles(:symlink?).each { |el|
|
215
|
+
rio('d0').skipfiles('*').each { |el|
|
271
216
|
assert(el.file?)
|
272
|
-
assert!(el.symlink?)
|
273
|
-
ans << el
|
274
217
|
}
|
275
|
-
|
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
|
276
277
|
end
|
277
278
|
end
|
278
279
|
end
|
279
|
-
|
280
|
+
#rio(wd).chdir
|
280
281
|
end
|
281
282
|
def test_noqae_fs_re
|
282
283
|
|