spec/regexp-examples_spec.rb in regexp-examples-1.3.1 vs spec/regexp-examples_spec.rb in regexp-examples-1.3.2
- old
+ new
@@ -168,12 +168,13 @@
examples_exist_and_match(
/\Astart/,
/\Glast-match/,
/^start/,
/end$/,
- /end\z/,
- /end\Z/
+ /end\z/
+ # Cannot test /end\Z/ with the generic method here,
+ # as it's a special case. Tested specially below.
)
end
context 'for named properties' do
examples_exist_and_match(
@@ -299,9 +300,14 @@
it { expect(/a|a|b|b/.examples).to match_array %w(a b) }
it { expect(/[ccdd]/.examples).to match_array %w(c d) }
# a{1}? should be equivalent to (?:a{1})?, i.e. NOT a "non-greedy quantifier"
it { expect(/a{1}?/.examples).to match_array ['', 'a'] }
+ end
+
+ context 'end of string' do
+ it { expect(/test\z/.examples).to match_array %w(test) }
+ it { expect(/test\Z/.examples).to match_array ['test', "test\n"] }
end
context 'backreferences and escaped octal combined' do
it do
expect(/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)? \10\9\8\7\6\5\4\3\2\1/.examples)