1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

assertions for r65956

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-11-24 12:48:56 +00:00
parent 33afc9e0b9
commit 865313dfac

View file

@ -987,6 +987,7 @@ CODE
].each do |g|
assert_equal [g], g.each_grapheme_cluster.to_a
assert_equal 1, g.each_grapheme_cluster.size
assert_predicate g.dup.taint.each_grapheme_cluster.to_a[0], :tainted?
end
[
@ -996,6 +997,9 @@ CODE
].each do |str, grapheme_clusters|
assert_equal grapheme_clusters, str.each_grapheme_cluster.to_a
assert_equal grapheme_clusters.size, str.each_grapheme_cluster.size
str.dup.taint.each_grapheme_cluster do |g|
assert_predicate g, :tainted?
end
end
s = ("x"+"\u{10ABCD}"*250000)
@ -1016,6 +1020,7 @@ CODE
"\u{1f469 200d 2764 fe0f 200d 1f469}",
].each do |g|
assert_equal [g], g.grapheme_clusters
assert_predicate g.dup.taint.grapheme_clusters[0], :tainted?
end
assert_equal ["\u000A", "\u0308"], "\u{a 308}".grapheme_clusters
@ -1029,12 +1034,14 @@ CODE
else
warning = /passing a block to String#grapheme_clusters is deprecated/
assert_warning(warning) {
s = "ABC".b
s = "ABC".b.taint
res = []
assert_same s, s.grapheme_clusters {|x| res << x }
assert_equal(3, res.size)
assert_equal("A", res[0])
assert_equal("B", res[1])
assert_equal("C", res[2])
res.each {|g| assert_predicate(g, :tainted?)}
}
end
end