[ruby/openssl] Add support for gets(chomp: true).

8aa3849cff
This commit is contained in:
Samuel Williams 2024-01-01 22:50:32 +13:00 committed by git
parent 08d4e5ebef
commit f7178045bb
2 changed files with 17 additions and 2 deletions

View file

@ -115,6 +115,17 @@ module OpenSSL::TestPairM
}
end
def test_gets_chomp
ssl_pair {|s1, s2|
s1 << "line1\r\nline2\r\nline3\r\n"
s1.close
assert_equal("line1", s2.gets("\r\n", chomp: true))
assert_equal("line2\r\n", s2.gets("\r\n", chomp: false))
assert_equal("line3", s2.gets(chomp: true))
}
end
def test_gets_eof_limit
ssl_pair {|s1, s2|
s1.write("hello")