From a2f8fd0e1184328c9e95c4ffb3e1763378ffae5b Mon Sep 17 00:00:00 2001 From: Jeff Pace Date: Sun, 23 Oct 2011 12:40:28 -0400 Subject: [PATCH] JRUBY-6141 - added RubySpec test. Signed-off-by: Hiro Asari --- .../JRUBY-6141_matchdata_captures_spec.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 spec/regression/JRUBY-6141_matchdata_captures_spec.rb diff --git a/spec/regression/JRUBY-6141_matchdata_captures_spec.rb b/spec/regression/JRUBY-6141_matchdata_captures_spec.rb new file mode 100644 index 00000000000..eb162cb18a7 --- /dev/null +++ b/spec/regression/JRUBY-6141_matchdata_captures_spec.rb @@ -0,0 +1,17 @@ +describe "JRUBY-6141: Matchdata#captures" do + + before :all do + "first, last".scan(Regexp.new('(first|last)')) do + @firstmatch ||= Regexp.last_match + end + @lastmatch = Regexp.last_match + end + + it "returns first value from Regexp.last_match after all String#scan iterations" do + @firstmatch.captures[0].should == "first" + end + + it "returns last value from Regexp.last_match after all String#scan iterations" do + @lastmatch.captures[0].should == "last" + end +end