Sha256: e50ce20647442bc63701140f836531b0b1d31321f3216e4fb4d54602575e1198

Contents?: true

Size: 614 Bytes

Versions: 3

Compression:

Stored size: 614 Bytes

Contents

require File.expand_path(File.dirname(__FILE__)) + '/helper'

class TestExtio < Test::Unit::TestCase
  def e(st)
    Tracksperanto::ExtIO.new(StringIO.new(st))
  end
  
  def test_gets
    assert_equal "Mary had\n", e("Mary had\n").gets
  end

  def test_gets_and_strip
    assert_equal "Mary had", e("Mary had\na little lamb\n").gets_and_strip
  end

  def test_gets_and_strip_at_end
    s = e("Mary had\na little lamb\n")
    s.gets_and_strip
    s.gets_and_strip
    
    assert_nil s.gets_and_strip
  end
  
  def test_gets_non_empty
    s = e("\n\n\n\nfoo")
    assert_equal "foo", s.gets_non_empty
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tracksperanto-4.1.2 test/test_extio.rb
tracksperanto-4.1.0 test/test_extio.rb
tracksperanto-4.0.0 test/test_extio.rb