summaryrefslogtreecommitdiff
path: root/test/ruby/test_string.rb
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-26 14:43:25 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-12-26 14:43:25 +0000
commit94bdc4edf0583109ce97e244f6423d840b11c092 (patch)
treeca33c6f95ae76e296c8fb8678823bcba84f9d970 /test/ruby/test_string.rb
parent0df1de8b32f98793f596fd8d3b608fc6f3104e01 (diff)
string.c: remove the deprecation warnings of `String#bytes` with block
And its friends: lines, chars, grapheme_clusters, and codepoints. [Feature #6670] [ruby-core:90728] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_string.rb')
-rw-r--r--test/ruby/test_string.rb88
1 files changed, 35 insertions, 53 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index 1fa5126931..f308cccbcd 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -878,20 +878,15 @@ CODE
assert_equal [65, 66, 67], s.bytes {}
}
else
- warning = /passing a block to String#bytes is deprecated/
- assert_warning(warning) {
- res = []
- assert_equal s.object_id, s.bytes {|x| res << x }.object_id
- assert_equal(65, res[0])
- assert_equal(66, res[1])
- assert_equal(67, res[2])
- }
- assert_warning(warning) {
- s = S("ABC")
- res = []
- assert_same s, s.bytes {|x| res << x }
- assert_equal [65, 66, 67], res
- }
+ res = []
+ assert_equal s.object_id, s.bytes {|x| res << x }.object_id
+ assert_equal(65, res[0])
+ assert_equal(66, res[1])
+ assert_equal(67, res[2])
+ s = S("ABC")
+ res = []
+ assert_same s, s.bytes {|x| res << x }
+ assert_equal [65, 66, 67], res
end
end
@@ -922,20 +917,15 @@ CODE
assert_equal [0x3042, 0x3044, 0x3046], s.codepoints {}
}
else
- warning = /passing a block to String#codepoints is deprecated/
- assert_warning(warning) {
- res = []
- assert_equal s.object_id, s.codepoints {|x| res << x }.object_id
- assert_equal(0x3042, res[0])
- assert_equal(0x3044, res[1])
- assert_equal(0x3046, res[2])
- }
- assert_warning(warning) {
- s = S("ABC")
- res = []
- assert_same s, s.codepoints {|x| res << x }
- assert_equal [65, 66, 67], res
- }
+ res = []
+ assert_equal s.object_id, s.codepoints {|x| res << x }.object_id
+ assert_equal(0x3042, res[0])
+ assert_equal(0x3044, res[1])
+ assert_equal(0x3046, res[2])
+ s = S("ABC")
+ res = []
+ assert_same s, s.codepoints {|x| res << x }
+ assert_equal [65, 66, 67], res
end
end
@@ -960,14 +950,11 @@ CODE
assert_equal ["A", "B", "C"], s.chars {}
}
else
- warning = /passing a block to String#chars is deprecated/
- assert_warning(warning) {
- res = []
- assert_equal s.object_id, s.chars {|x| res << x }.object_id
- assert_equal("A", res[0])
- assert_equal("B", res[1])
- assert_equal("C", res[2])
- }
+ res = []
+ assert_equal s.object_id, s.chars {|x| res << x }.object_id
+ assert_equal("A", res[0])
+ assert_equal("B", res[1])
+ assert_equal("C", res[2])
end
end
@@ -1032,17 +1019,14 @@ CODE
assert_equal ["A", "B", "C"], "ABC".grapheme_clusters {}
}
else
- warning = /passing a block to String#grapheme_clusters is deprecated/
- assert_warning(warning) {
- 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?)}
- }
+ 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
@@ -1155,12 +1139,10 @@ CODE
assert_equal ["hello\n", "world"], s.lines {}
}
else
- assert_warning(/passing a block to String#lines is deprecated/) {
- res = []
- assert_equal s.object_id, s.lines {|x| res << x }.object_id
- assert_equal(S("hello\n"), res[0])
- assert_equal(S("world"), res[1])
- }
+ res = []
+ assert_equal s.object_id, s.lines {|x| res << x }.object_id
+ assert_equal(S("hello\n"), res[0])
+ assert_equal(S("world"), res[1])
end
end