spec/regexp-examples_spec.rb in regexp-examples-1.3.2 vs spec/regexp-examples_spec.rb in regexp-examples-1.4.0
- old
+ new
@@ -314,28 +314,10 @@
expect(/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)? \10\9\8\7\6\5\4\3\2\1/.examples)
.to match_array ["abcdefghi \x08ihgfedcba", 'abcdefghij jihgfedcba']
end
end
- context 'max_repeater_variance config option' do
- it do
- expect(/a+/.examples(max_repeater_variance: 5))
- .to match_array %w(a aa aaa aaaa aaaaa aaaaaa)
- end
- it do
- expect(/a{4,8}/.examples(max_repeater_variance: 0))
- .to eq %w(aaaa)
- end
- end
-
- context 'max_group_results config option' do
- it do
- expect(/\d/.examples(max_group_results: 10))
- .to match_array %w(0 1 2 3 4 5 6 7 8 9)
- end
- end
-
context 'case insensitive' do
it { expect(/ab/i.examples).to match_array %w(ab aB Ab AB) }
it do
expect(/a+/i.examples)
.to match_array %w(a A aa aA Aa AA aaa aaA aAa aAA Aaa AaA AAa AAA)
@@ -375,41 +357,6 @@
it { expect(/a(?-i:b)c/i.examples).to match_array %w(abc abC Abc AbC) }
end
end
end # context 'exact examples match'
end # context 'returns matching strings'
-
- context 'max_results_limit config option' do
- it 'with low limit' do
- expect(/[A-Z]/.examples(max_results_limit: 5))
- .to match_array %w(A B C D E)
- end
- it 'with (default) high limit' do
- expect(/[ab]{14}/.examples.length)
- .to be <= 10000 # NOT 2**14 == 16384, because it's been limited
- end
- it 'with (custom) high limit' do
- expect(/[ab]{14}/.examples(max_results_limit: 20000).length)
- .to eq 16384 # NOT 10000, because it's below the limit
- end
- it 'for boolean or groups' do
- expect(/[ab]{3}|[cd]{3}/.examples(max_results_limit: 10).length)
- .to eq 10
- end
- it 'for case insensitive examples' do
- expect(/[ab]{3}/i.examples(max_results_limit: 10).length)
- .to be <= 10
- end
- it 'for range repeaters' do
- expect(/[ab]{2,3}/.examples(max_results_limit: 10).length)
- .to be <= 10 # NOT 4 + 8 = 12
- end
- it 'for backreferences' do
- expect(/([ab]{3})\1?/.examples(max_results_limit: 10).length)
- .to be <= 10 # NOT 8 * 2 = 16
- end
- it 'for a complex pattern' do
- expect(/(a|[bc]{2})\1{1,3}/.examples(max_results_limit: 14).length)
- .to be <= 14 # NOT (1 + 4) * 3 = 15
- end
- end
end