test/tc/lines.rb in rio-0.4.2 vs test/tc/lines.rb in rio-0.5.1
- old
+ new
@@ -3,17 +3,18 @@
Dir.chdir File.dirname(__FILE__)+'/../'
$:.unshift File.expand_path('../lib/')
end
require 'rio'
require 'test/unit'
-require 'test/unit/testsuite'
+require 'qpdir'
+#require 'test/unit/testsuite'
class TC_RIO_lines < Test::Unit::TestCase
def test_basic
qp = rio('qp')
- rio(qp,'test_lines').rmtree.mkpath.chdir {
+ rio($QPDIR,'test_lines').rmtree.mkpath.chdir {
f = rio('basic.txt')
0.upto(6) do |n|
f.puts("L#{n}: #{n*3}:#{n*2}")
end
@@ -44,13 +45,12 @@
assert_equal(expa,rio('basic.txt').lines.to_a)
assert_equal(expa,rio('basic.txt').to_a)
expa = ["L1: 3:2\n", "L2: 6:4\n", "L4: 12:8\n", "L6: 18:12\n"]
+ assert_equal(expa,rio('basic.txt').lines[/2/])
assert_equal(expa,rio('basic.txt').lines(/2/).to_a)
- 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"]
- assert_equal(expa,rio('basic.txt').bytes(32).to_a)
# expa = [["15", "10"], ["18", "12"]]
# assert_equal(expa,rio('basic.txt').lines(/(\d\d):(\d\d)/).to_a)
# ans = []