rio 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +340 -0
- data/ChangeLog +755 -0
- data/README +65 -0
- data/RUNME.1st.rb +75 -0
- data/Rakefile +312 -0
- data/VERSION +1 -0
- data/doc/README_MSWIN32.txt +39 -0
- data/doc/RELEASE_NOTES +130 -0
- data/doc/generators/template/html/rio.rb +895 -0
- data/doc/rdoc/classes/Kernel.html +181 -0
- data/doc/rdoc/classes/Kernel.src/M000183.html +18 -0
- data/doc/rdoc/classes/RIO.html +508 -0
- data/doc/rdoc/classes/RIO.src/M000001.html +18 -0
- data/doc/rdoc/classes/RIO.src/M000002.html +18 -0
- data/doc/rdoc/classes/RIO.src/M000003.html +18 -0
- data/doc/rdoc/classes/RIO/Doc.html +138 -0
- data/doc/rdoc/classes/RIO/Doc/HOWTO.html +1031 -0
- data/doc/rdoc/classes/RIO/Doc/INTRO.html +1116 -0
- data/doc/rdoc/classes/RIO/Doc/MISC.html +443 -0
- data/doc/rdoc/classes/RIO/Doc/SYNOPSIS.html +325 -0
- data/doc/rdoc/classes/RIO/Rio.html +6333 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000004.html +18 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000005.html +20 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000006.html +27 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000007.html +27 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000008.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000009.html +18 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000010.html +20 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000011.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000012.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000013.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000014.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000015.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000016.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000017.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000018.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000019.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000020.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000021.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000022.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000023.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000024.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000025.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000026.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000027.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000028.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000029.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000030.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000031.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000032.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000033.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000034.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000035.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000036.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000037.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000038.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000039.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000040.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000041.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000042.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000043.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000044.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000045.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000046.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000047.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000048.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000049.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000050.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000051.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000052.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000053.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000054.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000055.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000056.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000057.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000058.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000059.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000060.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000061.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000062.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000063.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000064.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000065.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000066.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000067.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000068.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000069.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000070.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000071.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000072.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000073.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000074.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000075.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000076.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000077.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000078.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000079.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000080.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000081.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000082.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000083.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000084.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000085.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000086.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000087.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000088.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000089.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000090.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000091.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000092.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000093.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000094.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000095.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000096.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000097.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000098.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000099.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000100.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000101.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000102.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000103.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000104.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000105.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000106.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000107.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000108.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000109.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000110.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000111.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000112.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000113.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000114.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000115.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000116.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000117.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000118.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000119.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000120.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000121.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000122.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000123.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000124.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000125.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000126.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000127.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000128.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000129.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000130.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000131.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000132.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000133.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000134.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000135.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000136.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000137.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000138.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000139.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000140.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000141.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000142.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000143.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000144.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000145.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000146.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000147.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000148.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000149.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000150.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000151.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000152.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000153.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000154.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000155.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000156.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000157.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000158.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000159.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000160.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000161.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000162.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000163.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000164.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000165.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000166.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000167.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000168.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000169.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000170.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000171.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000172.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000173.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000174.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000175.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000176.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000177.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000178.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000179.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000180.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000181.html +16 -0
- data/doc/rdoc/classes/RIO/Rio.src/M000182.html +16 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/README.html +215 -0
- data/doc/rdoc/files/lib/rio/constructor_rb.html +142 -0
- data/doc/rdoc/files/lib/rio/doc/HOWTO_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/doc/INTRO_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/doc/MISC_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/doc/SYNOPSIS_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/if/basic_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/if/dir_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/if/file_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/if/fileordir_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/if/grande_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/if/internal_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/if/methods_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/if/path_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/if/stream_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/if/test_rb.html +135 -0
- data/doc/rdoc/files/lib/rio/kernel_rb.html +142 -0
- data/doc/rdoc/files/lib/rio_rb.html +153 -0
- data/doc/rdoc/fr_class_index.html +34 -0
- data/doc/rdoc/fr_file_index.html +44 -0
- data/doc/rdoc/fr_method_index.html +210 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +384 -0
- data/doc/rfc1738.txt +1403 -0
- data/doc/rfc959.txt +3933 -0
- data/ex/colx.rb +6 -0
- data/ex/findinruby +19 -0
- data/ex/findruby +11 -0
- data/ex/prompt.rb +25 -0
- data/ex/rgb.txt.gz +0 -0
- data/ex/riocat +35 -0
- data/ex/riogunzip +31 -0
- data/ex/riogzip +24 -0
- data/ex/tolf +11 -0
- data/lib/rio.rb +163 -0
- data/lib/rio/abstract_method.rb +57 -0
- data/lib/rio/argv.rb +57 -0
- data/lib/rio/arrayio.rb +199 -0
- data/lib/rio/arycopy.rb +44 -0
- data/lib/rio/assert.rb +115 -0
- data/lib/rio/base.rb +59 -0
- data/lib/rio/constructor.rb +183 -0
- data/lib/rio/context.rb +117 -0
- data/lib/rio/context/chomp.rb +53 -0
- data/lib/rio/context/closeoneof.rb +50 -0
- data/lib/rio/context/cxx.rb +67 -0
- data/lib/rio/context/dir.rb +92 -0
- data/lib/rio/context/gzip.rb +51 -0
- data/lib/rio/context/methods.rb +196 -0
- data/lib/rio/context/stream.rb +170 -0
- data/lib/rio/cp.rb +305 -0
- data/lib/rio/cxdir.rb +79 -0
- data/lib/rio/dir.rb +145 -0
- data/lib/rio/doc.rb +45 -0
- data/lib/rio/doc/HOWTO.rb +691 -0
- data/lib/rio/doc/INTRO.rb +579 -0
- data/lib/rio/doc/MISC.rb +257 -0
- data/lib/rio/doc/SYNOPSIS.rb +170 -0
- data/lib/rio/entrysel.rb +162 -0
- data/lib/rio/exception.rb +42 -0
- data/lib/rio/exception/copy.rb +98 -0
- data/lib/rio/exception/open.rb +62 -0
- data/lib/rio/exception/state.rb +74 -0
- data/lib/rio/ext.rb +62 -0
- data/lib/rio/ext/csv.rb +261 -0
- data/lib/rio/factory.rb +236 -0
- data/lib/rio/file.rb +77 -0
- data/lib/rio/filter/chomp.rb +61 -0
- data/lib/rio/filter/closeoneof.rb +103 -0
- data/lib/rio/filter/gzip.rb +58 -0
- data/lib/rio/ftp.rb +275 -0
- data/lib/rio/ftp/conn.rb +167 -0
- data/lib/rio/ftp/ioh.rb +88 -0
- data/lib/rio/grande.rb +126 -0
- data/lib/rio/handle.rb +101 -0
- data/lib/rio/if.rb +53 -0
- data/lib/rio/if/basic.rb +64 -0
- data/lib/rio/if/dir.rb +362 -0
- data/lib/rio/if/file.rb +57 -0
- data/lib/rio/if/fileordir.rb +247 -0
- data/lib/rio/if/grande.rb +510 -0
- data/lib/rio/if/internal.rb +53 -0
- data/lib/rio/if/methods.rb +612 -0
- data/lib/rio/if/path.rb +413 -0
- data/lib/rio/if/stream.rb +599 -0
- data/lib/rio/if/test.rb +219 -0
- data/lib/rio/impl/path.rb +82 -0
- data/lib/rio/ioh.rb +137 -0
- data/lib/rio/iomode.rb +96 -0
- data/lib/rio/kernel.rb +47 -0
- data/lib/rio/local.rb +63 -0
- data/lib/rio/match.rb +51 -0
- data/lib/rio/matchrecord.rb +254 -0
- data/lib/rio/open3.rb +69 -0
- data/lib/rio/ops/create.rb +78 -0
- data/lib/rio/ops/dir.rb +302 -0
- data/lib/rio/ops/either.rb +117 -0
- data/lib/rio/ops/file.rb +94 -0
- data/lib/rio/ops/path.rb +292 -0
- data/lib/rio/ops/stream.rb +84 -0
- data/lib/rio/ops/stream/input.rb +237 -0
- data/lib/rio/ops/stream/output.rb +96 -0
- data/lib/rio/ops/stream/read.rb +84 -0
- data/lib/rio/ops/stream/write.rb +58 -0
- data/lib/rio/ops/symlink.rb +70 -0
- data/lib/rio/path.rb +117 -0
- data/lib/rio/path/reset.rb +70 -0
- data/lib/rio/record.rb +59 -0
- data/lib/rio/rectype.rb +86 -0
- data/lib/rio/rl/base.rb +147 -0
- data/lib/rio/rl/builder.rb +166 -0
- data/lib/rio/rl/ioi.rb +66 -0
- data/lib/rio/rl/path.rb +141 -0
- data/lib/rio/rl/uri.rb +118 -0
- data/lib/rio/scheme/aryio.rb +89 -0
- data/lib/rio/scheme/cmdio.rb +74 -0
- data/lib/rio/scheme/fd.rb +65 -0
- data/lib/rio/scheme/ftp.rb +73 -0
- data/lib/rio/scheme/http.rb +81 -0
- data/lib/rio/scheme/path.rb +100 -0
- data/lib/rio/scheme/stderr.rb +56 -0
- data/lib/rio/scheme/stdio.rb +71 -0
- data/lib/rio/scheme/strio.rb +82 -0
- data/lib/rio/scheme/sysio.rb +61 -0
- data/lib/rio/scheme/tcp.rb +74 -0
- data/lib/rio/scheme/tempfile.rb +104 -0
- data/lib/rio/state.rb +209 -0
- data/lib/rio/state/error.rb +73 -0
- data/lib/rio/stream.rb +181 -0
- data/lib/rio/stream/base.rb +50 -0
- data/lib/rio/stream/duplex.rb +76 -0
- data/lib/rio/stream/open.rb +203 -0
- data/lib/rio/symantics.rb +46 -0
- data/lib/rio/to_rio.rb +57 -0
- data/lib/rio/uri/file.rb +145 -0
- data/lib/rio/version.rb +52 -0
- data/setup.rb +1331 -0
- data/test/1.rb +14 -0
- data/test/mswin32.rb +28 -0
- data/test/once.rb +7 -0
- data/test/runtests.rb +12 -0
- data/test/runtests_gem.rb +15 -0
- data/test/tc/abs.rb +349 -0
- data/test/tc/all.rb +42 -0
- data/test/tc/cd1.rb +116 -0
- data/test/tc/clearsel.rb +69 -0
- data/test/tc/closeoncopy.rb +91 -0
- data/test/tc/closeoneof.rb +194 -0
- data/test/tc/copy-from.rb +183 -0
- data/test/tc/copy-to.rb +94 -0
- data/test/tc/copy.rb +72 -0
- data/test/tc/copyarray.rb +191 -0
- data/test/tc/copydest.rb +50 -0
- data/test/tc/copydir.rb +192 -0
- data/test/tc/copydirlines.rb +124 -0
- data/test/tc/copylines.rb +40 -0
- data/test/tc/copynonex.rb +121 -0
- data/test/tc/create.rb +104 -0
- data/test/tc/csv.rb +229 -0
- data/test/tc/dir.rb +79 -0
- data/test/tc/dirautoclose.rb +70 -0
- data/test/tc/dirent.rb +180 -0
- data/test/tc/dirss.rb +84 -0
- data/test/tc/each.rb +111 -0
- data/test/tc/each_break.rb +241 -0
- data/test/tc/edf.rb +82 -0
- data/test/tc/entary.rb +230 -0
- data/test/tc/eq.rb +101 -0
- data/test/tc/expand_path.rb +94 -0
- data/test/tc/ext.rb +115 -0
- data/test/tc/fileno.rb +95 -0
- data/test/tc/getrec.rb +140 -0
- data/test/tc/lineno.rb +197 -0
- data/test/tc/lines.rb +66 -0
- data/test/tc/methods.rb +185 -0
- data/test/tc/misc.rb +473 -0
- data/test/tc/nolines.rb +205 -0
- data/test/tc/noqae.rb +873 -0
- data/test/tc/once.rb +6 -0
- data/test/tc/overload.rb +137 -0
- data/test/tc/pa.rb +159 -0
- data/test/tc/pathop.rb +63 -0
- data/test/tc/paths.rb +147 -0
- data/test/tc/qae.rb +494 -0
- data/test/tc/qae_riovar.rb +500 -0
- data/test/tc/records.rb +69 -0
- data/test/tc/rename.rb +224 -0
- data/test/tc/rename_assign.rb +48 -0
- data/test/tc/sub.rb +49 -0
- data/test/tc/symlink.rb +177 -0
- data/test/tc/symlink0.rb +298 -0
- data/test/tc/symlink1.rb +115 -0
- data/test/tc/testcase.rb +152 -0
- metadata +461 -0
data/test/tc/lines.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
#!/usr/local/bin/ruby
|
2
|
+
if $0 == __FILE__
|
3
|
+
Dir.chdir File.dirname(__FILE__)+'/../'
|
4
|
+
$:.unshift File.expand_path('../lib/')
|
5
|
+
end
|
6
|
+
require 'rio'
|
7
|
+
require 'test/unit'
|
8
|
+
require 'test/unit/testsuite'
|
9
|
+
|
10
|
+
class TC_RIO_lines < Test::Unit::TestCase
|
11
|
+
def test_basic
|
12
|
+
qp = rio('qp')
|
13
|
+
|
14
|
+
rio(qp,'test_lines').rmtree.mkpath.chdir {
|
15
|
+
|
16
|
+
f = rio('basic.txt')
|
17
|
+
0.upto(6) do |n|
|
18
|
+
f.puts("L#{n}: #{n*3}:#{n*2}")
|
19
|
+
end
|
20
|
+
f.puts!("Line Z")
|
21
|
+
|
22
|
+
expa = ["L0: 0:0\n", "L1: 3:2\n", "L2: 6:4\n", "L3: 9:6\n", "L4: 12:8\n", "L5: 15:10\n", "L6: 18:12\n",
|
23
|
+
"Line Z\n"]
|
24
|
+
|
25
|
+
ans = []
|
26
|
+
|
27
|
+
rio('basic.txt').lines { |line| ans.push(line) }
|
28
|
+
assert_equal(expa,ans)
|
29
|
+
ans.clear
|
30
|
+
|
31
|
+
rio('basic.txt').lines.each { |line| ans.push(line) }
|
32
|
+
assert_equal(expa,ans)
|
33
|
+
ans.clear
|
34
|
+
|
35
|
+
rio('basic.txt').each { |line| ans.push(line) }
|
36
|
+
assert_equal(expa,ans)
|
37
|
+
ans.clear
|
38
|
+
|
39
|
+
# proxy of IO#each_line -- lines() is ignored
|
40
|
+
rio('basic.txt').each_line { |line| ans.push(line) }
|
41
|
+
assert_equal(expa,ans)
|
42
|
+
ans.clear
|
43
|
+
|
44
|
+
assert_equal(expa,rio('basic.txt').lines.to_a)
|
45
|
+
assert_equal(expa,rio('basic.txt').to_a)
|
46
|
+
|
47
|
+
|
48
|
+
expa = ["L1: 3:2\n", "L2: 6:4\n", "L4: 12:8\n", "L6: 18:12\n"]
|
49
|
+
assert_equal(expa,rio('basic.txt').lines(/2/).to_a)
|
50
|
+
|
51
|
+
expa = ["L0: 0:0\nL1: 3:2\nL2: 6:4\nL3: 9:6\n", "L4: 12:8\nL5: 15:10\nL6: 18:12\nLin", "e Z\n"]
|
52
|
+
assert_equal(expa,rio('basic.txt').bytes(32).to_a)
|
53
|
+
|
54
|
+
# expa = [["15", "10"], ["18", "12"]]
|
55
|
+
# assert_equal(expa,rio('basic.txt').lines(/(\d\d):(\d\d)/).to_a)
|
56
|
+
|
57
|
+
# ans = []
|
58
|
+
# rio('basic.txt').lines(/(\d\d):(\d\d)/) { |ary|
|
59
|
+
# ans.push(ary)
|
60
|
+
# }
|
61
|
+
# assert_equal(expa,ans)
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
data/test/tc/methods.rb
ADDED
@@ -0,0 +1,185 @@
|
|
1
|
+
#!/usr/local/bin/ruby
|
2
|
+
if $0 == __FILE__
|
3
|
+
Dir.chdir File.dirname(__FILE__)+'/../'
|
4
|
+
$:.unshift File.expand_path('../lib/')
|
5
|
+
end
|
6
|
+
require 'rio'
|
7
|
+
require 'test/unit'
|
8
|
+
require 'test/unit/testsuite'
|
9
|
+
|
10
|
+
class TC_RIO_methods < Test::Unit::TestCase
|
11
|
+
def assert!(a,msg="negative assertion")
|
12
|
+
assert((!(a)),msg)
|
13
|
+
end
|
14
|
+
|
15
|
+
def check_clone(ios)
|
16
|
+
oexp = []
|
17
|
+
cexp = []
|
18
|
+
|
19
|
+
oexp << ios.gets
|
20
|
+
ioc = ios.clone
|
21
|
+
|
22
|
+
cexp << ioc.gets
|
23
|
+
oexp << ios.gets
|
24
|
+
until ioc.eof?
|
25
|
+
cexp << ioc.gets
|
26
|
+
end
|
27
|
+
|
28
|
+
until ios.eof?
|
29
|
+
oexp << ios.gets
|
30
|
+
end
|
31
|
+
return ioc,oexp,cexp
|
32
|
+
end
|
33
|
+
|
34
|
+
def check_dup(ios)
|
35
|
+
oexp = []
|
36
|
+
cexp = []
|
37
|
+
|
38
|
+
oexp << ios.gets
|
39
|
+
ioc = ios.dup
|
40
|
+
assert_not_nil(ioc,"dup returns nil")
|
41
|
+
cexp << ioc.gets
|
42
|
+
oexp << ios.gets
|
43
|
+
until ioc.eof?
|
44
|
+
cexp << ioc.gets
|
45
|
+
end
|
46
|
+
|
47
|
+
until ios.eof?
|
48
|
+
oexp << ios.gets
|
49
|
+
end
|
50
|
+
return ioc,oexp,cexp
|
51
|
+
end
|
52
|
+
|
53
|
+
def check_clone_close(ios,ioc)
|
54
|
+
assert!(ios.closed?,"original not closed")
|
55
|
+
assert!(ioc.closed?,"clone not closed")
|
56
|
+
ioc.close
|
57
|
+
assert(ioc.closed?,"clone closed?")
|
58
|
+
assert!(ios.closed?," orignal still not closed?")
|
59
|
+
ios.close
|
60
|
+
assert(ios.closed?,"now original closed")
|
61
|
+
end
|
62
|
+
|
63
|
+
def check_dup_close(ios,ioc)
|
64
|
+
assert!(ios.closed?,"original not closed")
|
65
|
+
assert(ioc.closed?,"dup closed")
|
66
|
+
ios.close
|
67
|
+
assert(ios.closed?,"now original closed")
|
68
|
+
end
|
69
|
+
def setup
|
70
|
+
@cwd = rio(::Dir.getwd)
|
71
|
+
@dir = rio('qp/methods')
|
72
|
+
# $trace_states = true
|
73
|
+
@dir.mkpath.chdir
|
74
|
+
@lines = (0..5).map { |n| "Line#{n}" }
|
75
|
+
@chlines = @lines.map(&:chomp)
|
76
|
+
::File.open('lines','w') do |f|
|
77
|
+
@lines.each do |li|
|
78
|
+
f.puts(li)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
@lines = rio('lines').to_a
|
82
|
+
end
|
83
|
+
def teardown
|
84
|
+
@cwd.chdir
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_clone_like_IO
|
88
|
+
|
89
|
+
ios = ::File.open('lines')
|
90
|
+
ioc,oexp,cexp = check_clone(ios)
|
91
|
+
check_clone_close(ios,ioc)
|
92
|
+
ioc.close unless ioc.closed?
|
93
|
+
ios.close unless ios.closed?
|
94
|
+
|
95
|
+
ario = rio('lines').nocloseoneof
|
96
|
+
crio,oans,cans = check_clone(ario)
|
97
|
+
assert_equal(oexp,oans)
|
98
|
+
assert_equal(cexp,cans)
|
99
|
+
check_clone_close(ario,crio)
|
100
|
+
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_dup_not_like_IO
|
104
|
+
|
105
|
+
ios = ::File.open('lines')
|
106
|
+
ioc,oexp,cexp = check_dup(ios)
|
107
|
+
check_clone_close(ios,ioc)
|
108
|
+
ario = rio('lines').nocloseoneof
|
109
|
+
crio,oans,cans = check_dup(ario)
|
110
|
+
assert_equal(@lines,oans)
|
111
|
+
assert_equal(@lines,cans)
|
112
|
+
check_dup_close(ario,crio)
|
113
|
+
|
114
|
+
end
|
115
|
+
|
116
|
+
|
117
|
+
def test_clone_own_context
|
118
|
+
|
119
|
+
assert(rio.closeoncopy?,"closeoncopy is on")
|
120
|
+
assert!(rio.nocloseoncopy.closeoncopy?,"nocloseoncopy is off")
|
121
|
+
assert!(rio.chomp?,"chomp is off")
|
122
|
+
chomper = rio.chomp
|
123
|
+
assert(chomper.chomp?,"chomp is on")
|
124
|
+
cl = chomper.clone
|
125
|
+
assert(cl.chomp?,"cloned chomp is on")
|
126
|
+
cl.nochomp
|
127
|
+
assert!(cl.chomp?,"cloned chomp is off")
|
128
|
+
assert(chomper.chomp?,"original chomp is still on")
|
129
|
+
|
130
|
+
chomper.join!('lines')
|
131
|
+
ans = chomper.to_a
|
132
|
+
assert_equal(@chlines,ans)
|
133
|
+
|
134
|
+
cl.join!('lines')
|
135
|
+
ans = cl.to_a
|
136
|
+
assert_equal(@lines,ans)
|
137
|
+
|
138
|
+
end
|
139
|
+
def ztest_clone_read_ruby
|
140
|
+
|
141
|
+
#$trace_states = true
|
142
|
+
afile = ::File.open('lines')
|
143
|
+
arec = afile.gets
|
144
|
+
assert_equal(@lines[0],arec)
|
145
|
+
cfile = afile.dup
|
146
|
+
#p "POS: a(#{afile.pos}) c(#{cfile.pos})"
|
147
|
+
crec = cfile.gets
|
148
|
+
#p "crec=#{crec} POS: a(#{afile.pos}) cfile(#{cfile.pos})"
|
149
|
+
afile.close
|
150
|
+
end
|
151
|
+
def test_clone_read
|
152
|
+
return unless $supports_symlink
|
153
|
+
#$trace_states = true
|
154
|
+
ario = rio('lines')
|
155
|
+
arec = ario.getrec
|
156
|
+
assert_equal(@lines[0],arec)
|
157
|
+
#$trace_states = true
|
158
|
+
crio = ario.clone.chomp
|
159
|
+
#p "POS: ario(#{ario.pos}) crio(#{crio.pos})"
|
160
|
+
crec = crio.getrec
|
161
|
+
#p "crec=#{crec} POS: ario(#{ario.pos}) crio(#{crio.pos})"
|
162
|
+
|
163
|
+
assert_equal(@chlines[1],crec)
|
164
|
+
|
165
|
+
arec = ario.getrec
|
166
|
+
#$trace_states = false
|
167
|
+
assert_equal(@lines[1],arec)
|
168
|
+
cremaining = crio.to_a
|
169
|
+
|
170
|
+
assert_equal(@chlines[2...@lines.size],cremaining)
|
171
|
+
#p "#{crio.eof?} #{crio.closed?}"
|
172
|
+
assert(crio.eof?,"clone eof?") unless crio.closed?
|
173
|
+
assert(crio.closed?,"clone closed?")
|
174
|
+
|
175
|
+
assert!(ario.eof?,"orignal eof?") unless ario.closed?
|
176
|
+
assert!(ario.closed?,"original closed?")
|
177
|
+
|
178
|
+
aremaining = ario.readlines
|
179
|
+
assert_equal(@lines[2...@lines.size],aremaining)
|
180
|
+
assert(ario.eof?,"orignal eof?") unless ario.closed?
|
181
|
+
assert(ario.closed?,"original closed?")
|
182
|
+
|
183
|
+
end
|
184
|
+
|
185
|
+
end
|
data/test/tc/misc.rb
ADDED
@@ -0,0 +1,473 @@
|
|
1
|
+
#!/usr/local/bin/ruby
|
2
|
+
if $0 == __FILE__
|
3
|
+
Dir.chdir File.dirname(__FILE__)+'/../'
|
4
|
+
$:.unshift File.expand_path('../lib/')
|
5
|
+
end
|
6
|
+
require 'rio'
|
7
|
+
require 'test/unit'
|
8
|
+
require 'test/unit/testsuite'
|
9
|
+
require 'tc/testcase'
|
10
|
+
|
11
|
+
#require 'tc_myfirsttests'
|
12
|
+
#require 'tc_moretestsbyme'
|
13
|
+
#require 'ts_anothersetoftests'
|
14
|
+
|
15
|
+
class TC_RIO_misc < Test::Unit::TestCase
|
16
|
+
def rio(*args) RIO.rio(*args) end
|
17
|
+
def rootrio(*args) RIO.root(*args) end
|
18
|
+
def ttdir() RIO.rio('qp').mkpath end
|
19
|
+
def assert_equal_s(a,b) assert_equal(a.to_s,b.to_s) end
|
20
|
+
|
21
|
+
def test_iomodes
|
22
|
+
exp = (0..5).to_a.map { |n| "Line #{n}" }
|
23
|
+
f = rio('qp/rwlines.txt').chomp
|
24
|
+
0.upto(4) do |n|
|
25
|
+
f.puts("Line #{n}")
|
26
|
+
end
|
27
|
+
got = f.a.puts("Line 5").readlines
|
28
|
+
assert_equal(exp,got)
|
29
|
+
|
30
|
+
f = rio('qp/rwlines.txt').nocloseoneof.autorewind.chomp.mode('w+')
|
31
|
+
0.upto(4) do |n|
|
32
|
+
f.puts("Line #{n}")
|
33
|
+
end
|
34
|
+
got = f.puts("Line 5").readlines
|
35
|
+
assert_equal(exp,got)
|
36
|
+
|
37
|
+
f = rio('qp/rwlines.txt').nocloseoneof.autorewind.chomp.mode('w+')
|
38
|
+
0.upto(4) do |n|
|
39
|
+
f.puts("Line #{n}")
|
40
|
+
end
|
41
|
+
got = f.puts!("line 5").readlines
|
42
|
+
assert_equal([],got)
|
43
|
+
|
44
|
+
f = rio('qp/rwlines.txt').nocloseoneof.autorewind.chomp.mode('w+')
|
45
|
+
0.upto(4) do |n|
|
46
|
+
f.puts("Line #{n}")
|
47
|
+
end
|
48
|
+
f.close
|
49
|
+
got = rio('qp/rwlines.txt').a.nocloseoneof.autorewind.chomp.puts!("Line 5").readlines
|
50
|
+
assert_equal(exp,got)
|
51
|
+
|
52
|
+
f = rio('qp/rwlines.txt').mode('w')
|
53
|
+
0.upto(4) { |n| f.puts("Line #{n}") }
|
54
|
+
assert_raise(IOError) {
|
55
|
+
f.readlines
|
56
|
+
}
|
57
|
+
|
58
|
+
f = rio('qp/rwlines.txt').a
|
59
|
+
assert_equal_s('a',f.outputmode?)
|
60
|
+
f.puts("Line 0\n\n")
|
61
|
+
# assert_match(/Output$/,.handled_by)
|
62
|
+
assert_equal_s('a',f.mode?)
|
63
|
+
assert_equal("Line 0\n",f.rewind.gets);
|
64
|
+
assert_equal_s('r',f.mode?)
|
65
|
+
# assert_match(/Input$/,f.handled_by)
|
66
|
+
|
67
|
+
f = rio('qp/rwlines.txt').a!
|
68
|
+
assert_equal_s('a+',f.outputmode?)
|
69
|
+
f.puts("Line 0\n\n")
|
70
|
+
# assert_match(/InOut$/,f.puts("Line 0\n\n").handled_by)
|
71
|
+
assert_equal_s('a+',f.mode?)
|
72
|
+
assert_equal("Line 0\n",f.rewind.gets);
|
73
|
+
assert_equal_s('a+',f.mode?)
|
74
|
+
# assert_match(/InOut$/,f.handled_by)
|
75
|
+
|
76
|
+
f = rio('qp/rwlines.txt').w
|
77
|
+
assert_equal_s('w',f.outputmode?)
|
78
|
+
f.puts("Line 0\n\n")
|
79
|
+
# assert_match(/Output$/,f.puts("Line 0\n\n").handled_by)
|
80
|
+
assert_equal_s('w',f.mode?)
|
81
|
+
assert_equal("Line 0\n",f.rewind.gets);
|
82
|
+
assert_equal_s('r',f.mode?)
|
83
|
+
# assert_match(/Input$/,f.handled_by)
|
84
|
+
|
85
|
+
f = rio('qp/rwlines.txt').w!
|
86
|
+
assert_equal_s('w+',f.outputmode?)
|
87
|
+
f.puts("Line 0").puts("Line 1")
|
88
|
+
# assert_match(/InOut$/,f.puts("Line 0").puts("Line 1").handled_by)
|
89
|
+
assert_equal_s('w+',f.mode?)
|
90
|
+
assert_equal("Line 0\n",f.rewind.gets);
|
91
|
+
assert_equal_s('w+',f.mode?)
|
92
|
+
# assert_match(/InOut$/,f.handled_by)
|
93
|
+
|
94
|
+
f = rio('qp/rwlines.txt').r
|
95
|
+
assert_equal_s('r',f.inputmode?)
|
96
|
+
f.puts("Line 0").puts("Line 1")
|
97
|
+
# assert_match(/Output$/,f.puts("Line 0").puts("Line 1").handled_by)
|
98
|
+
assert_equal_s('w',f.mode?)
|
99
|
+
assert_equal("Line 0\n",f.rewind.gets);
|
100
|
+
assert_equal_s('r',f.mode?)
|
101
|
+
# assert_match(/Input$/,f.handled_by)
|
102
|
+
|
103
|
+
f = rio('qp/rwlines.txt').r!
|
104
|
+
assert_equal_s('r+',f.inputmode?)
|
105
|
+
f.puts("Line 0").puts("Line 1")
|
106
|
+
# assert_match(/InOut$/,f.puts("Line 0").puts("Line 1").handled_by)
|
107
|
+
assert_equal_s('r+',f.mode?)
|
108
|
+
assert_equal("Line 0\n",f.rewind.gets);
|
109
|
+
# assert_match(/InOut$/,f.handled_by)
|
110
|
+
assert_equal_s('r+',f.mode?)
|
111
|
+
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
def test_readwrite
|
116
|
+
require 'rio'
|
117
|
+
tdir = rio(%w/qp test_readwrite/)
|
118
|
+
tdir.rmtree.mkpath.chdir {
|
119
|
+
exp = (0..5).to_a.map { |n| "Line #{n}" }
|
120
|
+
|
121
|
+
f = rio('rwlines.txt').chomp
|
122
|
+
0.upto(4) { |n| f.puts("Line #{n}") }
|
123
|
+
got = f.a.puts("Line 5").readlines
|
124
|
+
assert_equal(exp,got)
|
125
|
+
|
126
|
+
f = rio('rwlines.txt').nocloseoneof.autorewind.chomp.mode('w+')
|
127
|
+
0.upto(4) { |n| f.puts("Line #{n}") }
|
128
|
+
got = f.puts("Line 5").readlines
|
129
|
+
assert_equal(exp,got)
|
130
|
+
|
131
|
+
f = rio('rwlines.txt').nocloseoneof.autorewind.chomp.mode('w+')
|
132
|
+
0.upto(4) { |n| f.puts("Line #{n}") }
|
133
|
+
got = f.puts!("line 5").readlines
|
134
|
+
assert_equal([],got)
|
135
|
+
|
136
|
+
f = rio('rwlines.txt').nocloseoneof.autorewind.chomp.mode('w+')
|
137
|
+
0.upto(4) { |n| f.puts("Line #{n}") }
|
138
|
+
f.close
|
139
|
+
got = rio('rwlines.txt').a.nocloseoneof.autorewind.chomp.puts!("Line 5").readlines
|
140
|
+
assert_equal(exp,got)
|
141
|
+
|
142
|
+
f = rio('rwlines.txt').a
|
143
|
+
assert_equal_s('a',f.outputmode?)
|
144
|
+
f.puts("Line 0\n\n")
|
145
|
+
# assert_match(/Output$/,f.puts("Line 0\n\n").handled_by)
|
146
|
+
assert_equal_s('a',f.mode?)
|
147
|
+
assert_equal("Line 0\n",f.rewind.gets);
|
148
|
+
assert_equal_s('r',f.mode?)
|
149
|
+
# assert_match(/Input$/,f.handled_by)
|
150
|
+
|
151
|
+
f = rio('rwlines.txt').a!
|
152
|
+
assert_equal_s('a+',f.outputmode?)
|
153
|
+
f.puts("Line 0\n\n")
|
154
|
+
# assert_match(/InOut$/,f.puts("Line 0\n\n").handled_by)
|
155
|
+
assert_equal_s('a+',f.mode?)
|
156
|
+
assert_equal("Line 0\n",f.rewind.gets);
|
157
|
+
assert_equal_s('a+',f.mode?)
|
158
|
+
# assert_match(/InOut$/,f.handled_by)
|
159
|
+
|
160
|
+
f = rio('rwlines.txt').w
|
161
|
+
assert_equal_s('w',f.outputmode?)
|
162
|
+
f.puts("Line 0\n\n")
|
163
|
+
# assert_match(/Output$/,f.puts("Line 0\n\n").handled_by)
|
164
|
+
assert_equal_s('w',f.mode?)
|
165
|
+
assert_equal("Line 0\n",f.rewind.gets);
|
166
|
+
assert_equal_s('r',f.mode?)
|
167
|
+
# assert_match(/Input$/,f.handled_by)
|
168
|
+
|
169
|
+
f = rio('rwlines.txt').w!
|
170
|
+
assert_equal_s('w+',f.outputmode?)
|
171
|
+
f.puts("Line 0").puts("Line 1")
|
172
|
+
# assert_match(/InOut$/,f.puts("Line 0").puts("Line 1").handled_by)
|
173
|
+
assert_equal_s('w+',f.mode?)
|
174
|
+
assert_equal("Line 0\n",f.rewind.gets);
|
175
|
+
assert_equal_s('w+',f.mode?)
|
176
|
+
# assert_match(/InOut$/,f.handled_by)
|
177
|
+
|
178
|
+
f = rio('rwlines.txt').r
|
179
|
+
assert_equal_s('r',f.inputmode?)
|
180
|
+
f.puts("Line 0").puts("Line 1")
|
181
|
+
# assert_match(/Output$/,f.puts("Line 0").puts("Line 1").handled_by)
|
182
|
+
assert_equal_s('w',f.mode?)
|
183
|
+
assert_equal("Line 0\n",f.rewind.gets);
|
184
|
+
assert_equal_s('r',f.mode?)
|
185
|
+
# assert_match(/Input$/,f.handled_by)
|
186
|
+
|
187
|
+
f = rio('rwlines.txt').r!
|
188
|
+
assert_equal_s('r+',f.inputmode?)
|
189
|
+
f.puts("Line 0").puts("Line 1")
|
190
|
+
# assert_match(/InOut$/,f.puts("Line 0").puts("Line 1").handled_by)
|
191
|
+
assert_equal_s('r+',f.mode?)
|
192
|
+
assert_equal("Line 0\n",f.rewind.gets);
|
193
|
+
# assert_match(/InOut$/,f.handled_by)
|
194
|
+
assert_equal_s('r+',f.mode?)
|
195
|
+
}
|
196
|
+
end
|
197
|
+
def test_copy2
|
198
|
+
require 'rio'
|
199
|
+
tdir = rio(%w/qp test_copy2/)
|
200
|
+
tdir.rmtree.mkpath.chdir {
|
201
|
+
txt = "Hello f1.txt"
|
202
|
+
o = rio('o').puts(txt).close
|
203
|
+
oslurp = o.slurp
|
204
|
+
|
205
|
+
n = rio('n')
|
206
|
+
o.copy(n)
|
207
|
+
assert_equal(oslurp,n.slurp)
|
208
|
+
|
209
|
+
d = rio('d1').rmtree.mkpath
|
210
|
+
n = rio(d,'o')
|
211
|
+
o.copy(d)
|
212
|
+
assert_equal(oslurp,n.slurp)
|
213
|
+
|
214
|
+
# d = rio('d2').rmtree
|
215
|
+
# n = rio(d,'o')
|
216
|
+
# assert_raise(::RIO::Exception::Copy) {
|
217
|
+
# o.copy(n)
|
218
|
+
# }
|
219
|
+
|
220
|
+
|
221
|
+
d = rio('d3').rmtree.mkpath
|
222
|
+
n = rio(d,'o').touch
|
223
|
+
o.copy(d)
|
224
|
+
assert_equal(oslurp,n.slurp)
|
225
|
+
|
226
|
+
|
227
|
+
return unless $supports_symlink
|
228
|
+
d = rio('d5').rmtree.mkpath
|
229
|
+
q = rio(d,'qf').touch
|
230
|
+
d.chdir {
|
231
|
+
rio('qf').symlink('o')
|
232
|
+
}
|
233
|
+
n = rio(d,'o')
|
234
|
+
o.copy(d)
|
235
|
+
assert_equal(oslurp,n.slurp)
|
236
|
+
|
237
|
+
d = rio('d6').rmtree.mkpath
|
238
|
+
q = rio(d,'qd').mkdir
|
239
|
+
d.chdir {
|
240
|
+
rio('qd').symlink('o')
|
241
|
+
}
|
242
|
+
n = rio(d,'o')
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
}
|
248
|
+
end
|
249
|
+
require 'extensions/symbol'
|
250
|
+
def pa(a) p a.map( &:to_s ) end
|
251
|
+
def smap(a) a.map( &:to_s ) end
|
252
|
+
def emap(d,a)
|
253
|
+
exp = a.map { |f| File.join(d,f) }.sort
|
254
|
+
end
|
255
|
+
def gmap(io)
|
256
|
+
smap(io.to_a).sort
|
257
|
+
end
|
258
|
+
|
259
|
+
def test_find
|
260
|
+
s_dir = 'qp/test_find'
|
261
|
+
dir = RIO.cwd(s_dir).rmtree.mkpath
|
262
|
+
f1 = RIO.rio(dir,'f1.txt').puts("This is f1")
|
263
|
+
f2 = RIO.rio(dir,'f2.txt').puts("This is f2")
|
264
|
+
d2 = RIO.rio(dir,'d1','d2').mkpath
|
265
|
+
f3 = RIO.rio(dir,'d1','f3.txt').puts("This is f3")
|
266
|
+
f4 = d2.join('f4.emp').touch
|
267
|
+
|
268
|
+
io = rio(s_dir)
|
269
|
+
exp = %w{f1.txt f2.txt d1}
|
270
|
+
assert_equal(emap(s_dir,exp), gmap(io))
|
271
|
+
|
272
|
+
io = rio(s_dir).files('*.txt')
|
273
|
+
exp = %w{f1.txt f2.txt}
|
274
|
+
assert_equal(emap(s_dir,exp), gmap(io))
|
275
|
+
|
276
|
+
io = rio(s_dir).dirs
|
277
|
+
exp = %w{d1}
|
278
|
+
assert_equal(emap(s_dir,exp), gmap(io))
|
279
|
+
|
280
|
+
io = rio(s_dir).all.dirs
|
281
|
+
exp = %w{d1 d1/d2}
|
282
|
+
assert_equal(emap(s_dir,exp), gmap(io))
|
283
|
+
|
284
|
+
io = rio(s_dir).all.dirs("*2")
|
285
|
+
exp = %w{d1/d2}
|
286
|
+
assert_equal(emap(s_dir,exp), gmap(io))
|
287
|
+
|
288
|
+
io = rio(s_dir).all.files("*.emp")
|
289
|
+
exp = %w{d1/d2/f4.emp}
|
290
|
+
assert_equal(emap(s_dir,exp), gmap(io))
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
end
|
296
|
+
def test_mkdir
|
297
|
+
datadir = rio('qp/test_mkdir').rmtree.mkpath
|
298
|
+
dir2 = rio(datadir,'dir2').rmtree.mkpath
|
299
|
+
dir2 = rio(datadir,'dir2').rmtree.mkpath
|
300
|
+
# sd1 > dir2
|
301
|
+
# oline = rio(datadir,'dir1/sd1/f1.txt').readline
|
302
|
+
# nline = rio(datadir,'dir2/sd1/f1.txt').readline
|
303
|
+
# assert_equal(oline,nline)
|
304
|
+
|
305
|
+
# dir2 = rio(datadir,'dir2').rmtree.mkpath
|
306
|
+
# dir2 < sd1
|
307
|
+
# oline = rio(datadir,'dir1/sd1/f1.txt').readline
|
308
|
+
# nline = rio(datadir,'dir2/sd1/f1.txt').readline
|
309
|
+
# assert_equal(oline,nline)
|
310
|
+
|
311
|
+
end
|
312
|
+
def test_specialio
|
313
|
+
return unless $supports_symlink
|
314
|
+
tdir = rio(ttdir,'test_specialio').rmtree.mkpath
|
315
|
+
msg = "Hello File\n"
|
316
|
+
fname = 'f.txt'
|
317
|
+
rio(tdir,fname).puts(msg).close
|
318
|
+
str = rio(tdir,fname).readline
|
319
|
+
assert_equal(msg,str)
|
320
|
+
|
321
|
+
# require 'open3'
|
322
|
+
|
323
|
+
# IO.popen("-") {|f|
|
324
|
+
# if f.nil?
|
325
|
+
# rio(?-).puts('Hello Stdout')
|
326
|
+
# else
|
327
|
+
# assert_equal("Hello Stdout\n",f.gets)
|
328
|
+
# end
|
329
|
+
# }
|
330
|
+
|
331
|
+
# For some reason the use of popen3 stopped working FIXME
|
332
|
+
# stdin,stdout,stderr = Open3.popen3(%q~ruby -e "require 'rio';rio(?=).puts('Hello Stderr')"~)
|
333
|
+
#errput = stderr.gets
|
334
|
+
#assert_equal("Hello Stderr\n",errput)
|
335
|
+
|
336
|
+
smsg = str.sub(/File/,'StringIO')
|
337
|
+
srio = rio(?$).print(smsg)
|
338
|
+
assert_equal(smsg,srio.string)
|
339
|
+
# lines = rio('?').mode('w+').puts(str.sub(/File/,'Tempfile')).readlines
|
340
|
+
|
341
|
+
end
|
342
|
+
|
343
|
+
def test_copy
|
344
|
+
require 'rio'
|
345
|
+
datadir = rio('qp/test_copy').rmtree.mkpath
|
346
|
+
inline = "Source Stuff\n"
|
347
|
+
src = rio(datadir,'src')
|
348
|
+
src.print(inline)
|
349
|
+
src.close
|
350
|
+
src = rio(datadir,'src')
|
351
|
+
dst1 = rio(datadir,'dst1')
|
352
|
+
src.copy(dst1)
|
353
|
+
dst2 = rio(datadir,'dst2').mkdir
|
354
|
+
src.copy(dst2)
|
355
|
+
sline = rio(datadir,'src').readline
|
356
|
+
l1 = rio(datadir,'dst1').readline
|
357
|
+
l2 = rio(datadir,'dst2/src').readline
|
358
|
+
assert_equal(inline,sline)
|
359
|
+
assert_equal(inline,l1)
|
360
|
+
assert_equal(inline,l2)
|
361
|
+
|
362
|
+
# copy directories
|
363
|
+
sd1 = rio(datadir,'dir1/sd1').rmtree.mkpath
|
364
|
+
txt = "Hello f1.txt"
|
365
|
+
sd1.join('f1.txt').puts(txt).close
|
366
|
+
oline = rio(datadir,'dir1/sd1/f1.txt').readline
|
367
|
+
|
368
|
+
dir2 = rio(datadir,'dir2').rmtree.mkpath
|
369
|
+
sd1.copy(dir2)
|
370
|
+
nline = rio(datadir,'dir2/sd1/f1.txt').readline
|
371
|
+
assert_equal(oline,nline)
|
372
|
+
|
373
|
+
end
|
374
|
+
def cmpfiles(z1,z2)
|
375
|
+
o = rio(z1).slurp
|
376
|
+
n = rio(z2).slurp
|
377
|
+
o == n
|
378
|
+
end
|
379
|
+
|
380
|
+
# def test_dirstream
|
381
|
+
# datadir = rio('qp','test_dirstream').rmtree.mkpath
|
382
|
+
# rio(datadir,'afile').touch.symlink(rio(datadir,'asymlink'))
|
383
|
+
# rio(datadir,'adir').mkdir
|
384
|
+
|
385
|
+
# #pp datadir.open
|
386
|
+
# positions = {}
|
387
|
+
# while 1
|
388
|
+
# ps = datadir.tell
|
389
|
+
# ent = datadir.read
|
390
|
+
# break if ent.nil?
|
391
|
+
# positions[ent] = ps
|
392
|
+
# end
|
393
|
+
|
394
|
+
# positions.each { |k,v|
|
395
|
+
# datadir.seek(v)
|
396
|
+
# ent = datadir.read
|
397
|
+
# assert_equal(k.to_s,ent.to_s)
|
398
|
+
# }
|
399
|
+
# end
|
400
|
+
def test_path
|
401
|
+
dir = RIO.cwd(%w/qp test_path/).rmtree.mkpath
|
402
|
+
s_dir = 'qp/test_path'
|
403
|
+
assert_equal(true,::FileTest.directory?(s_dir))
|
404
|
+
f1 = RIO.rio(dir,'f1.txt').puts("This is f1")
|
405
|
+
assert_equal(true,::FileTest.file?(::File.join(s_dir,'f1.txt')))
|
406
|
+
f2 = RIO.rio(dir,'f2.txt').puts("This is f2")
|
407
|
+
assert_equal(true,::FileTest.file?(::File.join(s_dir,'f2.txt')))
|
408
|
+
f3 = RIO.rio(dir,'d1').mkpath.join('f3.txt').puts("This is f2")
|
409
|
+
assert_equal(true,::FileTest.directory?(::File.join(s_dir,'d1')))
|
410
|
+
assert_equal(true,::FileTest.file?(::File.join(s_dir,'d1/f3.txt')))
|
411
|
+
f4 = RIO.rio(dir,'d1').mkpath.join('f4.emp').touch
|
412
|
+
assert_equal(0,::FileTest.size(::File.join(s_dir,'d1/f4.emp')))
|
413
|
+
end
|
414
|
+
def test_glob
|
415
|
+
end
|
416
|
+
|
417
|
+
def test_sdio
|
418
|
+
|
419
|
+
# qpd = rio(%w/qp/).mkpath
|
420
|
+
# rio(qpd,'hw.txt').puts("This\nis\na\nqesi")
|
421
|
+
# ObjectSpace.each_object(File) { |o|
|
422
|
+
# p o.to_s
|
423
|
+
# }
|
424
|
+
|
425
|
+
|
426
|
+
# io = rio(qpd,'hw.txt').readlines
|
427
|
+
# p io.inspect
|
428
|
+
end
|
429
|
+
end
|
430
|
+
# extend Forwardable
|
431
|
+
# def_instance_delegators(:state,
|
432
|
+
# :to_i,
|
433
|
+
# :mode,
|
434
|
+
# :mkdir,:mkpath,
|
435
|
+
# :rmdir,:rmtree,
|
436
|
+
# :chdir,
|
437
|
+
# :each_entry,:each_line,:each,:each_byte,
|
438
|
+
# :each_tested,:each_file,:each_directory,:each_symlink,
|
439
|
+
# :to_str,:to_a,:slurp,
|
440
|
+
# :length,:size,:zero?,
|
441
|
+
# :eof?,
|
442
|
+
# :read,:readchar,:readline,:readlines,
|
443
|
+
# :putc,:puts,:print,:printf,
|
444
|
+
# :chomp,:chop,
|
445
|
+
# :atime,:ctime,:mtime,
|
446
|
+
# :blockdev?,:chardev?,:pipe?,:socket?,:symlink?,:sticky?,
|
447
|
+
# :dir?,:directory?,:file?,:exist?,
|
448
|
+
# :executable?,:executable_real?,
|
449
|
+
# :readable?,:readable_real?,:writeable?,:writeable_real?,
|
450
|
+
# :grpowned?,:owned?,:setgid?,:setuid?,
|
451
|
+
# :ftype,:extname,
|
452
|
+
# :lstat,:stat,
|
453
|
+
# :fnmatch?)
|
454
|
+
# class LogDecorator
|
455
|
+
# def initialize(target)
|
456
|
+
# @target = target
|
457
|
+
# end
|
458
|
+
# def method_missing( sym, *args )
|
459
|
+
# call = "#{@target}.#{sym}(" + (args.map {|a|a.inspect}).join(",") + ")"
|
460
|
+
# puts "calling #{call}"
|
461
|
+
# result = @target.__send__( sym, *args )
|
462
|
+
# puts "returned #{result.inspect} from #{call}"
|
463
|
+
# result
|
464
|
+
# end
|
465
|
+
# end
|
466
|
+
|
467
|
+
#module RIO
|
468
|
+
# module RIOState
|
469
|
+
# def new_rio(*args)
|
470
|
+
# self.class.new(*args)
|
471
|
+
# end
|
472
|
+
# end
|
473
|
+
#end # module RIO
|