rio 0.3.8 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. data/README +18 -12
  2. data/Rakefile +57 -87
  3. data/build_doc.rb +19 -17
  4. data/doc/ANNOUNCE +3 -32
  5. data/doc/RELEASE_NOTES +4 -5
  6. data/doc/RIOIS +215 -0
  7. data/doc/generators/template/html/rio.css +428 -0
  8. data/doc/generators/template/html/rio.rb +18 -389
  9. data/doc/generators/template/html/ugly.rb +130 -0
  10. data/doc/pkg_def.rb +66 -0
  11. data/ex/catcsv.rb +64 -0
  12. data/ex/colx.rb +8 -0
  13. data/ex/findinruby +15 -0
  14. data/ex/findruby +14 -0
  15. data/ex/passwd_report.rb +8 -0
  16. data/ex/prompt.rb +25 -0
  17. data/ex/rgb.txt.gz +0 -0
  18. data/ex/riocat +42 -0
  19. data/ex/riogunzip +31 -0
  20. data/ex/riogzip +24 -0
  21. data/ex/rioprompt.rb +10 -0
  22. data/ex/targz2zip +17 -0
  23. data/ex/tonl +10 -0
  24. data/lib/rio.rb +16 -10
  25. data/lib/rio/abstract_method.rb +3 -4
  26. data/lib/rio/argv.rb +3 -4
  27. data/lib/rio/arycopy.rb +3 -4
  28. data/lib/rio/assert.rb +3 -4
  29. data/lib/rio/base.rb +3 -4
  30. data/lib/rio/callstr.rb +3 -4
  31. data/lib/rio/const.rb +3 -4
  32. data/lib/rio/construct.rb +3 -4
  33. data/lib/rio/constructor.rb +12 -8
  34. data/lib/rio/context.rb +15 -30
  35. data/lib/rio/context/autoclose.rb +3 -4
  36. data/lib/rio/context/copying.rb +3 -4
  37. data/lib/rio/context/cxx.rb +3 -4
  38. data/lib/rio/context/dir.rb +3 -4
  39. data/lib/rio/context/gzip.rb +3 -4
  40. data/lib/rio/context/methods.rb +16 -5
  41. data/lib/rio/context/skip.rb +3 -4
  42. data/lib/rio/context/stream.rb +42 -5
  43. data/lib/rio/cp.rb +7 -7
  44. data/lib/rio/def.rb +3 -4
  45. data/lib/rio/dir.rb +3 -4
  46. data/lib/rio/doc.rb +4 -5
  47. data/lib/rio/doc/EXAMPLES.rb +299 -0
  48. data/lib/rio/doc/HOWTO.rb +3 -4
  49. data/lib/rio/doc/INTRO.rb +86 -105
  50. data/lib/rio/doc/OPTIONAL.rb +4 -5
  51. data/lib/rio/doc/SYNOPSIS.rb +7 -6
  52. data/lib/rio/entrysel.rb +21 -23
  53. data/lib/rio/exception.rb +3 -4
  54. data/lib/rio/exception/copy.rb +3 -4
  55. data/lib/rio/exception/notimplemented.rb +57 -0
  56. data/lib/rio/exception/notsupported.rb +3 -4
  57. data/lib/rio/exception/open.rb +3 -4
  58. data/lib/rio/exception/state.rb +3 -4
  59. data/lib/rio/ext.rb +47 -13
  60. data/lib/rio/ext/csv.rb +4 -5
  61. data/lib/rio/ext/if.rb +45 -0
  62. data/lib/rio/ext/mp3info.rb +80 -0
  63. data/lib/rio/ext/splitlines.rb +253 -0
  64. data/lib/rio/ext/yaml.rb +9 -5
  65. data/lib/rio/ext/yaml/doc.rb +133 -0
  66. data/lib/rio/ext/yaml/tie.rb +149 -0
  67. data/lib/rio/ext/zipfile.rb +23 -4
  68. data/lib/rio/ext/zipfile/fs.rb +116 -0
  69. data/lib/rio/ext/zipfile/rl.rb +251 -0
  70. data/lib/rio/ext/zipfile/rootdir.rb +117 -0
  71. data/lib/rio/ext/zipfile/state.rb +161 -0
  72. data/lib/rio/ext/zipfile/wrap.rb +204 -0
  73. data/lib/rio/factory.rb +235 -27
  74. data/lib/rio/file.rb +4 -4
  75. data/lib/rio/filter.rb +3 -4
  76. data/lib/rio/filter/closeoneof.rb +3 -4
  77. data/lib/rio/filter/gzip.rb +9 -4
  78. data/lib/rio/fs/base.rb +3 -4
  79. data/lib/rio/fs/impl.rb +4 -5
  80. data/lib/rio/fs/native.rb +3 -4
  81. data/lib/rio/fs/stream.rb +3 -4
  82. data/lib/rio/fs/url.rb +3 -4
  83. data/lib/rio/ftp/conncache.rb +19 -5
  84. data/lib/rio/ftp/dir.rb +3 -4
  85. data/lib/rio/ftp/fs.rb +30 -24
  86. data/lib/rio/grande.rb +27 -7
  87. data/lib/rio/handle.rb +3 -4
  88. data/lib/rio/if.rb +19 -15
  89. data/lib/rio/if/basic.rb +7 -7
  90. data/lib/rio/if/csv.rb +5 -6
  91. data/lib/rio/if/dir.rb +120 -114
  92. data/lib/rio/if/file.rb +52 -44
  93. data/lib/rio/if/fileordir.rb +217 -211
  94. data/lib/rio/if/grande.rb +674 -644
  95. data/lib/rio/if/grande_entry.rb +321 -313
  96. data/lib/rio/if/grande_stream.rb +653 -553
  97. data/lib/rio/if/internal.rb +3 -4
  98. data/lib/rio/if/path.rb +425 -426
  99. data/lib/rio/if/rubyio.rb +681 -0
  100. data/lib/rio/if/string.rb +42 -5
  101. data/lib/rio/if/temp.rb +3 -4
  102. data/lib/rio/if/test.rb +245 -238
  103. data/lib/rio/if/yaml.rb +15 -41
  104. data/lib/rio/ioh.rb +7 -5
  105. data/lib/rio/iomode.rb +19 -7
  106. data/lib/rio/ios/fail.rb +4 -5
  107. data/lib/rio/ios/generic.rb +4 -5
  108. data/lib/rio/ios/mode.rb +4 -5
  109. data/lib/rio/ios/null.rb +6 -7
  110. data/lib/rio/iowrap.rb +3 -4
  111. data/lib/rio/kernel.rb +3 -5
  112. data/lib/rio/local.rb +3 -4
  113. data/lib/rio/match.rb +3 -4
  114. data/lib/rio/matchrecord.rb +3 -4
  115. data/lib/rio/no_warn.rb +3 -4
  116. data/lib/rio/nullio.rb +3 -4
  117. data/lib/rio/open3.rb +4 -5
  118. data/lib/rio/ops/construct.rb +3 -4
  119. data/lib/rio/ops/create.rb +11 -6
  120. data/lib/rio/ops/dir.rb +19 -8
  121. data/lib/rio/ops/either.rb +6 -5
  122. data/lib/rio/ops/file.rb +3 -4
  123. data/lib/rio/ops/path.rb +14 -35
  124. data/lib/rio/ops/stream.rb +3 -4
  125. data/lib/rio/ops/stream/input.rb +4 -7
  126. data/lib/rio/ops/stream/output.rb +3 -4
  127. data/lib/rio/ops/stream/read.rb +6 -5
  128. data/lib/rio/ops/stream/write.rb +3 -4
  129. data/lib/rio/ops/symlink.rb +3 -4
  130. data/lib/rio/path.rb +22 -18
  131. data/lib/rio/path/reset.rb +4 -5
  132. data/lib/rio/piper.rb +3 -4
  133. data/lib/rio/piper/cp.rb +3 -4
  134. data/lib/rio/prompt.rb +10 -5
  135. data/lib/rio/rectype.rb +5 -5
  136. data/lib/rio/rl/base.rb +17 -71
  137. data/lib/rio/rl/builder.rb +14 -38
  138. data/lib/rio/rl/chmap.rb +66 -0
  139. data/lib/rio/rl/fs2url.rb +82 -0
  140. data/lib/rio/rl/ioi.rb +4 -4
  141. data/lib/rio/rl/path.rb +44 -122
  142. data/lib/rio/rl/pathmethods.rb +19 -8
  143. data/lib/rio/rl/uri.rb +137 -60
  144. data/lib/rio/rl/withpath.rb +295 -0
  145. data/lib/rio/scheme/aryio.rb +3 -4
  146. data/lib/rio/scheme/cmdio.rb +3 -4
  147. data/lib/rio/scheme/cmdpipe.rb +4 -4
  148. data/lib/rio/scheme/fd.rb +3 -4
  149. data/lib/rio/scheme/ftp.rb +7 -7
  150. data/lib/rio/scheme/http.rb +4 -5
  151. data/lib/rio/scheme/null.rb +3 -4
  152. data/lib/rio/scheme/path.rb +3 -4
  153. data/lib/rio/scheme/stderr.rb +3 -4
  154. data/lib/rio/scheme/stdio.rb +3 -4
  155. data/lib/rio/scheme/strio.rb +3 -4
  156. data/lib/rio/scheme/sysio.rb +3 -4
  157. data/lib/rio/scheme/tcp.rb +3 -4
  158. data/lib/rio/scheme/temp.rb +6 -6
  159. data/lib/rio/state.rb +18 -46
  160. data/lib/rio/state/error.rb +3 -4
  161. data/lib/rio/stream.rb +4 -4
  162. data/lib/rio/stream/base.rb +3 -4
  163. data/lib/rio/stream/duplex.rb +3 -4
  164. data/lib/rio/stream/open.rb +3 -8
  165. data/lib/rio/symantics.rb +3 -4
  166. data/lib/rio/tempdir.rb +2 -2
  167. data/lib/rio/to_rio.rb +3 -4
  168. data/lib/rio/to_rio/all.rb +3 -4
  169. data/lib/rio/to_rio/array.rb +4 -5
  170. data/lib/rio/to_rio/io.rb +4 -5
  171. data/lib/rio/to_rio/object.rb +4 -5
  172. data/lib/rio/to_rio/string.rb +4 -5
  173. data/lib/rio/uri/file.rb +41 -5
  174. data/lib/rio/util.rb +3 -4
  175. data/lib/rio/version.rb +4 -5
  176. data/setup.rb +368 -339
  177. data/test/bin/list_dir.rb +1 -1
  178. data/test/ftp/anon_misc.rb +13 -1
  179. data/test/ftp/anon_special.rb +6 -6
  180. data/test/ftp/anon_write.rb +10 -3
  181. data/test/ftp/ftp2ftp.rb +2 -2
  182. data/test/ftp/testdef.rb +9 -6
  183. data/test/http/all.rb +3 -0
  184. data/test/http/copy-from-http.rb +140 -0
  185. data/test/lib/temp_server.rb +44 -0
  186. data/test/runalltests.rb +3 -1
  187. data/test/runhttp.rb +12 -0
  188. data/test/runhttptests.rb +1 -1
  189. data/test/runtests.rb +41 -3
  190. data/test/tc/abs.rb +9 -5
  191. data/test/tc/all.rb +9 -4
  192. data/test/tc/base.rb +1 -1
  193. data/test/tc/base2.rb +87 -0
  194. data/test/tc/{methods.rb → clone.rb} +72 -50
  195. data/test/tc/closeoncopy.rb +13 -2
  196. data/test/tc/copy-dir-samevar.rb +91 -0
  197. data/test/tc/dir_iter.rb +0 -1
  198. data/test/tc/empty.rb +6 -2
  199. data/test/tc/expand_path.rb +36 -54
  200. data/test/tc/ext.rb +42 -18
  201. data/test/tc/gzip.rb +30 -3
  202. data/test/tc/likeio.rb +5 -1
  203. data/test/tc/line_record_row.rb +51 -0
  204. data/test/tc/noqae.rb +71 -70
  205. data/test/tc/path_parts.rb +175 -0
  206. data/test/tc/programs_util.rb +3 -3
  207. data/test/tc/rename.rb +4 -5
  208. data/test/tc/riorl.rb +9 -7
  209. data/test/tc/skip.rb +35 -6
  210. data/test/tc/skiplines.rb +34 -5
  211. data/test/tc/split.rb +8 -50
  212. data/test/tc/splitlines.rb +65 -0
  213. data/test/tc/splitpath.rb +83 -0
  214. data/test/tc/testcase.rb +1 -1
  215. data/test/tc/truncate.rb +39 -0
  216. data/test/tc/yaml.rb +9 -8
  217. metadata +261 -207
  218. data/ChangeLog +0 -1418
  219. data/VERSION +0 -1
  220. data/lib/rio/doc/MISC.rb +0 -259
  221. data/lib/rio/if/stream.rb +0 -680
  222. data/lib/rio/impl/path.rb +0 -87
  223. data/test/tc/copy-from-http.rb +0 -89
@@ -260,7 +260,6 @@ class TC_dir_iter < Test::RIO::TestCase
260
260
  assert_equal(expa,ans)
261
261
  end
262
262
 
263
- return
264
263
  # $trace_states = true
265
264
 
266
265
  # iterate twice using #get (no auto close)
@@ -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(?-,'ls d0').empty?)
43
+ assert(rio(?-,PROG['list_dir'] + ' d0').empty?)
40
44
  end
41
45
  def test_ps_not_empty
42
- assert!(rio(?-,'ls d1').empty?)
46
+ assert!(rio(?-,PROG['list_dir'] + ' d1').empty?)
43
47
  end
44
48
  def test_dev_null_empty
45
49
  assert(rio(nil).empty?)
@@ -5,34 +5,24 @@ if $0 == __FILE__
5
5
  end
6
6
 
7
7
  require 'rio'
8
- require 'test/unit'
9
- require 'test/unit/testsuite'
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
- def smap(a) a.map{|el| el.to_s} end
16
+
21
17
  def setup
22
- s_dir = ''
23
- #$trace_states = true
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
- tmp = rio('/tmp')
33
- unless tmp.dir?
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
- @tdir.chdir do
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(base)
53
- assert_kind_of(RIO::Rio,ans)
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
- @tdir.chdir do
60
- srel = 'groovy'
61
- sbase = '/tmp'
62
- rel = rio(srel)
63
- base = rio(sbase)
64
- exp = File.expand_path(srel,sbase)
65
- ans = rel.expand_path(sbase)
66
- assert_kind_of(RIO::Rio,ans)
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
- @tdir.chdir do
73
- srel = 'groovy'
74
- sbase = '~'
75
- rel = rio(srel)
76
- base = rio(sbase)
77
- exp = File.expand_path(srel,sbase)
78
- ans = rel.expand_path(sbase)
79
- assert_kind_of(RIO::Rio,ans)
80
- assert_equal(exp,ans)
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
@@ -6,26 +6,30 @@ end
6
6
 
7
7
  require 'rio'
8
8
  require 'tc/testcase'
9
- class TC_ext < Test::Unit::TestCase
9
+ class TC_ext < Test::RIO::TestCase
10
10
  @@once = false
11
- include RIO_TestCase
12
- def setup()
13
- super
14
- unless @@once
15
- @@once = true
16
- end
11
+ def self.once
12
+ @@once = true
13
+
17
14
  end
18
- def test_mvdir
19
- rio('a').rmtree.mkpath
20
- rio('a/b').mkpath
21
- rio('a/c').mkpath
22
- rio('a/b/f').touch
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 = mkafile('afile.tar.gz')
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
@@ -49,21 +49,48 @@ class TC_gzip < Test::RIO::TestCase
49
49
  end
50
50
 
51
51
  def test_file
52
- str = "Hello World\n"
53
- rio('src').print!(str)
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').contents)
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
@@ -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
- assert_equal(fruby.__send__(sym,*args),frio.__send__(sym,*args))
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
@@ -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').entries(:symlink?).each { |el|
223
- assert(el.symlink?)
224
- ans << el
200
+ rio('d0').dirs.each { |el|
201
+ assert(el.directory?)
225
202
  }
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
203
+ rio('d0').skipdirs.each { |el|
204
+ assert!(el.directory?)
235
205
  }
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|
206
+ rio('d0').skipdirs('*').each { |el|
242
207
  assert(el.directory?)
243
- assert(el.symlink?)
244
- ans << el
245
208
  }
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
209
+ rio('d0').files.each { |el|
210
+ assert(el.file?)
254
211
  }
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
212
+ rio('d0').skipfiles.each { |el|
213
+ assert!(el.file?)
264
214
  }
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|
215
+ rio('d0').skipfiles('*').each { |el|
271
216
  assert(el.file?)
272
- assert!(el.symlink?)
273
- ans << el
274
217
  }
275
- assert_equal(exp.sort,smap(ans).sort)
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
- #rio(wd).chdir
280
+ #rio(wd).chdir
280
281
  end
281
282
  def test_noqae_fs_re
282
283