summaryrefslogtreecommitdiff
path: root/spec/rubyspec/core/string/split_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/rubyspec/core/string/split_spec.rb')
-rw-r--r--spec/rubyspec/core/string/split_spec.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/spec/rubyspec/core/string/split_spec.rb b/spec/rubyspec/core/string/split_spec.rb
index 7d7d383f9c..1a4128f828 100644
--- a/spec/rubyspec/core/string/split_spec.rb
+++ b/spec/rubyspec/core/string/split_spec.rb
@@ -300,6 +300,10 @@ describe "String#split with Regexp" do
"AabB".split(/([a-z])+/).should == ["A", "b", "B"]
end
+ it "applies the limit to the number of split substrings, without counting captures" do
+ "aBaBa".split(/(B)()()/, 2).should == ["a", "B", "", "", "aBa"]
+ end
+
it "does not include non-matching captures in the result array" do
"hello".split(/(el)|(xx)/).should == ["h", "el", "lo"]
end