cucumber-core 3.2.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +52 -0
  3. data/lib/cucumber/core/compiler.rb +37 -145
  4. data/lib/cucumber/core/events.rb +1 -4
  5. data/lib/cucumber/core/gherkin/parser.rb +14 -22
  6. data/lib/cucumber/core/report/summary.rb +1 -23
  7. data/lib/cucumber/core/test/action.rb +2 -2
  8. data/lib/cucumber/core/test/around_hook.rb +4 -0
  9. data/lib/cucumber/core/test/case.rb +15 -121
  10. data/lib/cucumber/core/{ast → test}/data_table.rb +6 -8
  11. data/lib/cucumber/core/{ast → test}/doc_string.rb +5 -9
  12. data/lib/cucumber/core/{ast → test}/empty_multiline_argument.rb +1 -2
  13. data/lib/cucumber/core/test/filters/locations_filter.rb +2 -2
  14. data/lib/cucumber/core/{ast → test}/location.rb +10 -17
  15. data/lib/cucumber/core/test/runner.rb +5 -3
  16. data/lib/cucumber/core/test/step.rb +20 -36
  17. data/lib/cucumber/core/{ast → test}/tag.rb +1 -1
  18. data/lib/cucumber/core/version.rb +1 -1
  19. metadata +12 -26
  20. data/lib/cucumber/core/ast.rb +0 -14
  21. data/lib/cucumber/core/ast/background.rb +0 -41
  22. data/lib/cucumber/core/ast/comment.rb +0 -28
  23. data/lib/cucumber/core/ast/describes_itself.rb +0 -21
  24. data/lib/cucumber/core/ast/empty_background.rb +0 -17
  25. data/lib/cucumber/core/ast/examples_table.rb +0 -119
  26. data/lib/cucumber/core/ast/feature.rb +0 -88
  27. data/lib/cucumber/core/ast/names.rb +0 -25
  28. data/lib/cucumber/core/ast/outline_step.rb +0 -53
  29. data/lib/cucumber/core/ast/scenario.rb +0 -42
  30. data/lib/cucumber/core/ast/scenario_outline.rb +0 -45
  31. data/lib/cucumber/core/ast/step.rb +0 -83
  32. data/lib/cucumber/core/gherkin/ast_builder.rb +0 -403
  33. data/lib/cucumber/core/gherkin/tag_expression.rb +0 -65
@@ -1,65 +0,0 @@
1
- # frozen_string_literal: true
2
- module Cucumber
3
- module Core
4
- module Gherkin
5
- class TagExpression
6
-
7
- attr_reader :limits
8
-
9
- def initialize(tag_expressions)
10
- @ands = []
11
- @limits = {}
12
- tag_expressions.each do |expr|
13
- add(expr.strip.split(/\s*,\s*/))
14
- end
15
- end
16
-
17
- def empty?
18
- @ands.empty?
19
- end
20
-
21
- def evaluate(tags)
22
- return true if @ands.flatten.empty?
23
- vars = Hash[*tags.map{|tag| [tag.name, true]}.flatten]
24
- raise "No vars" if vars.nil? # Useless statement to prevent ruby warnings about unused var
25
- !!Kernel.eval(ruby_expression)
26
- end
27
-
28
- private
29
-
30
- def add(tags_with_negation_and_limits)
31
- negatives, positives = tags_with_negation_and_limits.partition{|tag| tag =~ /^~/}
32
- @ands << (store_and_extract_limits(negatives, true) + store_and_extract_limits(positives, false))
33
- end
34
-
35
- def store_and_extract_limits(tags_with_negation_and_limits, negated)
36
- tags_with_negation = []
37
- tags_with_negation_and_limits.each do |tag_with_negation_and_limit|
38
- tag_with_negation, limit = tag_with_negation_and_limit.split(':')
39
- tags_with_negation << tag_with_negation
40
- if limit
41
- tag_without_negation = negated ? tag_with_negation[1..-1] : tag_with_negation
42
- if @limits[tag_without_negation] && @limits[tag_without_negation] != limit.to_i
43
- raise "Inconsistent tag limits for #{tag_without_negation}: #{@limits[tag_without_negation]} and #{limit.to_i}"
44
- end
45
- @limits[tag_without_negation] = limit.to_i
46
- end
47
- end
48
- tags_with_negation
49
- end
50
-
51
- def ruby_expression
52
- "(" + @ands.map do |ors|
53
- ors.map do |tag|
54
- if tag =~ /^~(.*)/
55
- "!vars['#{$1}']"
56
- else
57
- "vars['#{tag}']"
58
- end
59
- end.join("||")
60
- end.join(")&&(") + ")"
61
- end
62
- end
63
- end
64
- end
65
- end