Bug #5536 » 0002-test-ruby-test_string.rb-add-test_start_with-and-tes.patch
test/ruby/test_string.rb | ||
---|---|---|
assert(!S("not").empty?)
|
||
end
|
||
def test_end_with?
|
||
assert "hello".end_with?("llo")
|
||
assert !"hello".end_with?("ll")
|
||
assert "hello".end_with?("el", "lo")
|
||
assert_raise(TypeError) { "str".end_with? :not_convertible_to_string }
|
||
end
|
||
def test_eql?
|
||
a = S("hello")
|
||
assert(a.eql?(S("hello")))
|
||
... | ... | |
assert_nil(a.squeeze!)
|
||
end
|
||
def test_start_with?
|
||
assert "hello".start_with?("hel")
|
||
assert !"hello".start_with?("el")
|
||
assert "hello".start_with?("el", "he")
|
||
assert_raise(TypeError) { "str".start_with? :not_convertible_to_string }
|
||
end
|
||
def test_strip
|
||
assert_equal(S("x"), S(" x ").strip)
|
||
assert_equal(S("x"), S(" \n\r\t x \t\r\n\n ").strip)
|
||
... | ... | |
assert_nil(l.slice!(/\A.*\n/), "[ruby-dev:31665]")
|
||
end
|
||
def test_end_with?
|
||
assert("abc".end_with?("c"))
|
||
end
|
||
def test_times2
|
||
s1 = ''
|
||
100.times {|n|
|