Project

General

Profile

Bug #4382 ยป test_string.rb.sub_bang_encoding.patch

Test patch to illustrate the bug - drbrain (Eric Hodel), 02/08/2011 05:27 AM

View differences:

test/ruby/test_string.rb (working copy)
1308 1308
    assert(a.untrusted?)
1309 1309
  end
1310 1310

  
1311
  def test_sub_bang_encoding
1312
    a = S("a")
1313
    a.force_encoding Encoding::BINARY
1314

  
1315
    r = ' '
1316
    r.force_encoding Encoding::UTF_8
1317

  
1318
    a.sub!(/a/) do r end
1319

  
1320
    assert_equal Encoding::BINARY, a.encoding
1321
  end
1322

  
1311 1323
  def test_succ
1312 1324
    assert_equal(S("abd"), S("abc").succ)
1313 1325
    assert_equal(S("z"),   S("y").succ)