summaryrefslogtreecommitdiff
path: root/spec/ruby/core/matchdata/element_reference_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/matchdata/element_reference_spec.rb')
-rw-r--r--spec/ruby/core/matchdata/element_reference_spec.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/ruby/core/matchdata/element_reference_spec.rb b/spec/ruby/core/matchdata/element_reference_spec.rb
index 7c0f089bb4..0e0d3991cb 100644
--- a/spec/ruby/core/matchdata/element_reference_spec.rb
+++ b/spec/ruby/core/matchdata/element_reference_spec.rb
@@ -22,6 +22,11 @@ describe "MatchData#[]" do
# length argument larger than number of match values is capped to match value length
/(.)(.)(\d+)(\d)/.match("THX1138.")[3, 10].should == %w|113 8|
+
+ /(.)(.)(\d+)(\d)/.match("THX1138.")[3, 0].should == []
+
+ /(.)(.)(\d+)(\d)/.match("THX1138.")[3, -1].should == nil
+ /(.)(.)(\d+)(\d)/.match("THX1138.")[3, -30].should == nil
end
it "supports ranges [start..end]" do