Project

General

Profile

Bug #14363 ยป each_grapheme_cluster_size_nil.patch

hugopeixoto (Hugo Peixoto), 03/21/2018 04:17 PM

View differences:

string.c
8426 8426
static VALUE
8427 8427
rb_str_each_grapheme_cluster(VALUE str)
8428 8428
{
8429
    RETURN_SIZED_ENUMERATOR(str, 0, 0, rb_str_each_char_size);
8429
    RETURN_ENUMERATOR(str, 0, 0);
8430 8430
    return rb_str_enumerate_grapheme_clusters(str, 0);
8431 8431
}
8432 8432

  
test/ruby/test_string.rb
989 989
    assert_equal ["a", "b", "c"], "abc".b.each_grapheme_cluster.to_a
990 990
    s = ("x"+"\u{10ABCD}"*250000)
991 991
    assert_empty(s.each_grapheme_cluster {s.clear})
992

  
993
    assert_nil "\u{20 200d}".each_grapheme_cluster.size
994
    assert_nil "\u{a 308}".each_grapheme_cluster.size
992 995
  end
993 996

  
994 997
  def test_grapheme_clusters