summaryrefslogtreecommitdiff
path: root/spec/ruby/core/string/split_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/string/split_spec.rb')
-rw-r--r--spec/ruby/core/string/split_spec.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/ruby/core/string/split_spec.rb b/spec/ruby/core/string/split_spec.rb
index 0d2c6211c4..b89a28c149 100644
--- a/spec/ruby/core/string/split_spec.rb
+++ b/spec/ruby/core/string/split_spec.rb
@@ -402,4 +402,14 @@ describe "String#split with Regexp" do
broken_str.force_encoding('utf-8')
lambda{ broken_str.split(/\r\n|\r|\n/) }.should raise_error(ArgumentError)
end
+
+ ruby_version_is "2.6" do
+ it "yields each split substrings if a block is given" do
+ a = []
+ returned_object = "chunky bacon".split(" ") { |str| a << str.capitalize }
+
+ returned_object.should == "chunky bacon"
+ a.should == ["Chunky", "Bacon"]
+ end
+ end
end