class TestUtilSafe

Public Instance Methods

test_safe_gets() click to toggle source
# File vendor/qwik/lib/qwik/util-safe.rb, line 53
def test_safe_gets
  # under max
  line = 'a' * 1024
  assert_equal line, StringIO.new(line).gets
  assert_equal line, StringIO.new(line).safe_gets

  # over max
  line = 'a' * 1025
  assert_equal line, StringIO.new(line).gets
  assert_raise(TooLongLine) {
    assert_equal line, StringIO.new(line).safe_gets
  }
end