Sha256: 1c06d003bd3ddee72aaab268ffb375e10faf36540915becdf2bb9f4be0e670b3
Contents?: true
Size: 1.63 KB
Versions: 5
Compression:
Stored size: 1.63 KB
Contents
#!/usr/local/bin/ruby if $0 == __FILE__ Dir.chdir File.dirname(__FILE__)+'/../' $:.unshift File.expand_path('../lib/') end require 'rio' require 'tc/testcase' class TC_splitlines < Test::RIO::TestCase @@once = false def self.once @@once = true end def setup super self.class.once unless @@once @str = "a,b,c,d\n" @infile = rio('infile') < @str * 3 end def test_get ans = rio(@infile).split(',').get exp = @str.split(',') assert_equal(exp,ans) ans = rio(@infile).chomp.split(',').get exp = @str.chop exp = exp.split(',') assert(exp,ans) end def test_each exp = @str.chomp.split(',') @infile.chomp.split(',') { |ary| assert_equal(exp,ary) } end def test_copy_array_in expstr = @str.chomp.split(',').join(':') exp = rio(?").puts(expstr).puts(expstr).puts!(expstr) aoa = rio(@infile).split(',')[] rio('ans').split(':') < aoa ans = rio('ans') assert_equal(exp.chomp[],ans.chomp[]) end def test_copy_array_out expary = @str.chomp.split(',') exp = [expary,expary,expary] aoa = [] rio(@infile).chomp.split(',') > aoa assert_equal(exp,aoa) end def test_copy_left expstr = @str.chomp.split(',').join(':') exp = rio(?").puts(expstr).puts(expstr).puts!(expstr) rio('ans').split(':') < rio(@infile).split(',') ans = rio('ans') assert_equal(exp.chomp[],ans.chomp[]) end def test_copy_right expstr = @str.chomp.split(',').join(':') exp = rio(?").puts(expstr).puts(expstr).puts!(expstr) rio(@infile).split(',') > rio('ans').split(':') ans = rio('ans') assert_equal(exp.chomp[],ans.chomp[]) end end
Version data entries
5 entries across 5 versions & 2 rubygems
Version | Path |
---|---|
wishdev-rio-0.4.3.1 | test/tc/splitlines.rb |
rio-0.3.9 | test/tc/splitlines.rb |
rio-0.4.0 | test/tc/splitlines.rb |
rio-0.4.2 | test/tc/splitlines.rb |
rio-0.4.1 | test/tc/splitlines.rb |