File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 2
2
def self . examples_exist_and_match ( *regexps )
3
3
regexps . each do |regexp |
4
4
it do
5
- regexp_examples = regexp . examples
6
- expect ( regexp_examples ) . not_to be_empty , "No examples were generated for regexp: #{ regexp . source } "
5
+ begin
6
+ regexp_examples = regexp . examples
7
+ rescue
8
+ # TODO: Find a nicer way to display this?
9
+ puts "Error generating examples for /#{ regexp . source } /"
10
+ raise $!
11
+ end
12
+ expect ( regexp_examples ) . not_to be_empty , "No examples were generated for regexp: /#{ regexp . source } /"
7
13
regexp_examples . each { |example | expect ( example ) . to match ( /\A (?:#{ regexp . source } )\z / ) }
8
- # Note: /\A...\z/ is used, to prevent misleading examples from passing the test.
14
+ # Note: /\A...\z/ is used to prevent misleading examples from passing the test.
9
15
# For example, we don't want things like:
10
16
# /a*/.examples to include "xyz"
11
17
# /a|b/.examples to include "bad"
@@ -32,7 +38,7 @@ def self.examples_raise_unsupported_syntax_error(*regexps)
32
38
def self . examples_are_empty ( *regexps )
33
39
regexps . each do |regexp |
34
40
it do
35
- expect ( regexp . examples ) . to be_empty
41
+ expect ( regexp . examples ) . to be_empty , "Unexpected examples for regexp: / #{ regexp . source } /"
36
42
end
37
43
end
38
44
end
You can’t perform that action at this time.
0 commit comments