diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2015-10-01 19:27:35 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2015-10-01 19:27:35 +0900 |
| commit | cb76ed8ec43b32b9e389b7904ac9d68fcb771d2b (patch) | |
| tree | 0c9a6f676d55791c9f4671129147e29d5b644b53 /test | |
| parent | 744578687d915dea05626d0d04a455d946b59dee (diff) | |
| parent | 7ad75a4a19f9917bc555b53bffbc6e57b67f1f56 (diff) | |
| download | mruby-cb76ed8ec43b32b9e389b7904ac9d68fcb771d2b.tar.gz mruby-cb76ed8ec43b32b9e389b7904ac9d68fcb771d2b.zip | |
Merge pull request #2971 from mattn/utf8-chop
chop with utf-8. fix #2967
Diffstat (limited to 'test')
| -rw-r--r-- | test/t/string.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/t/string.rb b/test/t/string.rb index f9a521edd..da75bdd84 100644 --- a/test/t/string.rb +++ b/test/t/string.rb @@ -262,6 +262,16 @@ assert('String#chop', '15.2.10.5.11') do assert_equal 'abc', c end +assert('String#chop', '15.2.10.5.11') do + a = ''.chop + b = 'あいう'.chop + c = "あ\nい".chop.chop + + assert_equal '', a + assert_equal 'あい', b + assert_equal 'あ', c +end if UTF8STRING + assert('String#chop!', '15.2.10.5.12') do a = '' b = 'abc' @@ -273,6 +283,21 @@ assert('String#chop!', '15.2.10.5.12') do assert_equal b, 'ab' end +assert('String#chop!', '15.2.10.5.12') do + a = '' + b = "あいうえ\n" + c = "あいうえ\n" + + a.chop! + b.chop! + c.chop! + c.chop! + + assert_equal a, '' + assert_equal b, 'あいうえ' + assert_equal c, 'あいう' +end if UTF8STRING + assert('String#downcase', '15.2.10.5.13') do a = 'ABC'.downcase b = 'ABC' |
