[前][次][番号順一覧][スレッド一覧]

ruby-changes:50717

From: naruse <ko1@a...>
Date: Thu, 22 Mar 2018 16:00:02 +0900 (JST)
Subject: [ruby-changes:50717] naruse:r62888 (trunk): each_grapheme_cluster shouldn't return size [Bug #14363]

naruse	2018-03-22 15:59:54 +0900 (Thu, 22 Mar 2018)

  New Revision: 62888

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62888

  Log:
    each_grapheme_cluster shouldn't return size [Bug #14363]
    
    From: Stefan Sch?\195?\188?\195?\159ler <mail@s...>

  Modified files:
    trunk/string.c
    trunk/test/ruby/test_string.rb
Index: string.c
===================================================================
--- string.c	(revision 62887)
+++ string.c	(revision 62888)
@@ -8426,7 +8426,7 @@ rb_str_enumerate_grapheme_clusters(VALUE https://github.com/ruby/ruby/blob/trunk/string.c#L8426
 static VALUE
 rb_str_each_grapheme_cluster(VALUE str)
 {
-    RETURN_SIZED_ENUMERATOR(str, 0, 0, rb_str_each_char_size);
+    RETURN_ENUMERATOR(str, 0, 0);
     return rb_str_enumerate_grapheme_clusters(str, 0);
 }
 
Index: test/ruby/test_string.rb
===================================================================
--- test/ruby/test_string.rb	(revision 62887)
+++ test/ruby/test_string.rb	(revision 62888)
@@ -989,6 +989,9 @@ CODE https://github.com/ruby/ruby/blob/trunk/test/ruby/test_string.rb#L989
     assert_equal ["a", "b", "c"], "abc".b.each_grapheme_cluster.to_a
     s = ("x"+"\u{10ABCD}"*250000)
     assert_empty(s.each_grapheme_cluster {s.clear})
+
+    assert_nil "\u{20 200d}".each_grapheme_cluster.size
+    assert_nil "\u{a 308}".each_grapheme_cluster.size
   end
 
   def test_grapheme_clusters

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]