Project

General

Profile

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

second set of patchs (tests) - Eregon (Benoit Daloze), 03/25/2012 09:11 PM

View differences:

test/ruby/test_string.rb
659 659
    assert(!S("not").empty?)
660 660
  end
661 661

  
662
  def test_end_with?
663
    assert S("hello").end_with?(S("llo"))
664
    assert !S("hello").end_with?(S("ll"))
665
    assert S("hello").end_with?(S("el"), S("lo"))
666

  
667
    assert_raise(TypeError) { S("str").end_with? :not_convertible_to_string }
668
  end
669

  
662 670
  def test_eql?
663 671
    a = S("hello")
664 672
    assert(a.eql?(S("hello")))
......
1201 1209
    assert_nil(a.squeeze!)
1202 1210
  end
1203 1211

  
1212
  def test_start_with?
1213
    assert S("hello").start_with?(S("hel"))
1214
    assert !S("hello").start_with?(S("el"))
1215
    assert S("hello").start_with?(S("el"), S("he"))
1216

  
1217
    assert_raise(TypeError) { S("str").start_with? :not_convertible_to_string }
1218
  end
1219

  
1204 1220
  def test_strip
1205 1221
    assert_equal(S("x"), S("      x        ").strip)
1206 1222
    assert_equal(S("x"), S(" \n\r\t     x  \t\r\n\n      ").strip)
......
1768 1784
    assert_nil(l.slice!(/\A.*\n/), "[ruby-dev:31665]")
1769 1785
  end
1770 1786

  
1771
  def test_end_with?
1772
    assert("abc".end_with?("c"))
1773
  end
1774

  
1775 1787
  def test_times2
1776 1788
    s1 = ''
1777 1789
    100.times {|n|
1778
-