Sha256: a68745d9b940485226e05c0fde3955b0f89907ed140be038598194134621e56f

Contents?: true

Size: 1.1 KB

Versions: 9

Compression:

Stored size: 1.1 KB

Contents

# unit tests for IOString in iostring.rb

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
require 'unittests/iostring'
require 'test/unit'

class IOStringTests < Test::Unit::TestCase
  include MockStdoutTestCase
  def setup
    @mockout = IOString.new ""
    $stdout = @mockout
  end
  def test_io_string_write
    puts "hello"
    assert_equal "hello\n", @mockout
  end
  def test_iostring_readline
    puts "hello"
    puts "there"
    $stdout = STDOUT
    assert_equal "hello", @mockout.readline!
    assert_equal "there", @mockout.readline!
  end
  def test_iostring_realine_no_final_cr
    print "hello"
    $stdout = STDOUT
    assert_equal "hello", @mockout.readline!
  end
  def test_ending_with_cr
    puts "hello"
    @mockout.readline!
    assert_equal nil, @mockout.readline!
  end
  def test_ending_without_cr
    print "hello"
    @mockout.readline!
    assert_equal nil, @mockout.readline!
  end
  def test_blank_line
    puts "hello"
    puts
    puts "there"
    @mockout.readline!
    assert_equal "", @mockout.readline!
  end
end


Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
firewatir-1.1.1 unittests/iostring_test.rb
firewatir-1.2.0 unittests/iostring_test.rb
firewatir-1.2.1 unittests/iostring_test.rb
watir-1.5.4 unittests/iostring_test.rb
watir-1.5.3 unittests/iostring_test.rb
watir-1.4.1 unittests/iostring_test.rb
watir-1.5.2 unittests/iostring_test.rb
watir-1.5.5 unittests/iostring_test.rb
watir-1.5.6 unittests/iostring_test.rb