summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-04-15 23:50:34 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-04-15 23:50:34 +0900
commitc136d871b99644c9593bd73a51e026d3f9257e7f (patch)
tree93cb1ab03b235bdc8e32668e7b4463a5791cc9a4
parent1c9ad8a5808d263be2f29a5c5a6f7a5e9d4b65ff (diff)
parent96f40c9ec42097c8ecac515c2470405152ab149a (diff)
downloadmruby-c136d871b99644c9593bd73a51e026d3f9257e7f.tar.gz
mruby-c136d871b99644c9593bd73a51e026d3f9257e7f.zip
Merge pull request #2065 from take-cheeze/utf8_string_size_test
Add test for UTF-8 string String#size .
-rw-r--r--mrbgems/mruby-string-utf8/test/string.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/mrbgems/mruby-string-utf8/test/string.rb b/mrbgems/mruby-string-utf8/test/string.rb
index bfa5f0170..325c6eb39 100644
--- a/mrbgems/mruby-string-utf8/test/string.rb
+++ b/mrbgems/mruby-string-utf8/test/string.rb
@@ -30,3 +30,10 @@ assert('Invalid sequence') do
assert_equal 5, "\xF8\x88\x80\x80\x80".size
assert_equal 6, "\xFC\x84\x80\x80\x80\x80".size
end
+
+assert('String#size') do
+ str = 'こんにちわ世界!'
+ assert_equal 8, str.size
+ assert_not_equal str.bytesize, str.size
+ assert_equal 2, str[1, 2].size
+end