Sha256: 667ea5575f9f7b3a1414de60be3e6d9c6d72dcbbab116bb106d846ef2ce2525d

Contents?: true

Size: 1.15 KB

Versions: 8

Compression:

Stored size: 1.15 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_null < Test::RIO::TestCase
  @@once = false
  def self.once
    @@once = true
  end
  def setup
    super
    self.class.once unless @@once
  end
  def compare_rtn(sym,*args)
    r1 = rio('/dev/null')
    r2 = rio(nil)
    rtn1 = r1.__send__(sym,*args)
    rtn2 = r2.__send__(sym,*args)
    assert_equal(rtn1,rtn2)
  end
  
  def compare_raiseeof(sym,*args)
    r1 = rio('/dev/null')
    r2 = rio(nil)
    assert_raise(EOFError) { r1.__send__(sym,*args) }
    assert_raise(EOFError) { r2.__send__(sym,*args) }
  end
  
  def test_gets() compare_rtn(:gets) end
  def test_lineno() compare_rtn(:lineno) end
  def test_lineno_assign() compare_rtn(:lineno=,20) end
  def test_pos() compare_rtn(:pos) end
  def test_pos_assign() compare_rtn(:pos=,20) end
  def test_read() compare_rtn(:read) end
  def test_readl() compare_rtn(:read,1) end
  def test_readline() compare_raiseeof(:readline) end
  def test_readlines() compare_rtn(:readlines) end
  def test_readchar() compare_raiseeof(:readchar) end
  
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
rio-0.6.0 test/tc/null.rb
wishdev-rio-0.4.3.1 test/tc/null.rb
rio-0.5.1 test/tc/null.rb
rio-0.3.9 test/tc/null.rb
rio-0.3.8 test/tc/null.rb
rio-0.4.0 test/tc/null.rb
rio-0.4.2 test/tc/null.rb
rio-0.4.1 test/tc/null.rb