spec/regexp-examples_spec.rb in regexp-examples-1.0.1 vs spec/regexp-examples_spec.rb in regexp-examples-1.0.2

- old
+ new

@@ -96,11 +96,12 @@ context "for complex multi groups" do examples_exist_and_match( /(normal)/, /(?:nocapture)/, /(?<name>namedgroup)/, - /(?<name>namedgroup) \k<name>/ + /(?<name>namedgroup) \k<name>/, + /(?<name>namedgroup) \k'name'/ ) end context "for escaped characters" do all_letters = Array('a'..'z') | Array('A'..'Z') @@ -122,11 +123,12 @@ /((ref1and2)) \1 \2/, /(one)(two)(three)(four)(five)(six)(seven)(eight)(nine)(ten) \10\9\8\7\6\5\4\3\2\1/, /(a?(b?(c?(d?(e?)))))/, /(a)? \1/, /(a|(b)) \2/, - /([ab]){2} \1/ # \1 should always be the LAST result of the capture group + /([ab]){2} \1/, # \1 should always be the LAST result of the capture group + /(ref1) (ref2) \k'1' \k<-1>/, # RELATIVE backref! ) end context "for escaped octal characters" do examples_exist_and_match( @@ -324,9 +326,10 @@ context "options toggling" do context "rest of string" do it { expect(/a(?i)b(?-i)c/.examples).to eq %w{abc aBc}} it { expect(/a(?x) b(?-x) c/.examples).to eq %w{ab\ c}} it { expect(/(?m)./.examples(max_group_results: 999)).to include "\n" } + it { expect(/(?i)(a)-\1/.examples).to eq %w{a-a A-A}} # Toggle "groups" should not increase backref group count end context "subexpression" do it { expect(/a(?i:b)c/.examples).to eq %w{abc aBc}} it { expect(/a(?i:b(?-i:c))/.examples).to eq %w{abc aBc}} it { expect(/a(?-i:b)c/i.examples).to eq %w{abc abC Abc AbC}}