Project

General

Profile

Bug #5536 ยป 0002-test-ruby-test_string.rb-add-test_start_with-and-tes.patch

Eregon (Benoit Daloze), 11/02/2011 12:03 AM

View differences:

test/ruby/test_string.rb
649 649
    assert(!S("not").empty?)
650 650
  end
651 651

  
652
  def test_end_with?
653
    assert "hello".end_with?("llo")
654
    assert !"hello".end_with?("ll")
655
    assert "hello".end_with?("el", "lo")
656
    assert_raise(TypeError) { "str".end_with? :not_convertible_to_string }
657
  end
658

  
652 659
  def test_eql?
653 660
    a = S("hello")
654 661
    assert(a.eql?(S("hello")))
......
1191 1198
    assert_nil(a.squeeze!)
1192 1199
  end
1193 1200

  
1201
  def test_start_with?
1202
    assert "hello".start_with?("hel")
1203
    assert !"hello".start_with?("el")
1204
    assert "hello".start_with?("el", "he")
1205
    assert_raise(TypeError) { "str".start_with? :not_convertible_to_string }
1206
  end
1207

  
1194 1208
  def test_strip
1195 1209
    assert_equal(S("x"), S("      x        ").strip)
1196 1210
    assert_equal(S("x"), S(" \n\r\t     x  \t\r\n\n      ").strip)
......
1747 1761
    assert_nil(l.slice!(/\A.*\n/), "[ruby-dev:31665]")
1748 1762
  end
1749 1763

  
1750
  def test_end_with?
1751
    assert("abc".end_with?("c"))
1752
  end
1753

  
1754 1764
  def test_times2
1755 1765
    s1 = ''
1756 1766
    100.times {|n|
1757
-