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.
- checksums.yaml +5 -5
- data/CHANGELOG.md +52 -0
- data/lib/cucumber/core/compiler.rb +37 -145
- data/lib/cucumber/core/events.rb +1 -4
- data/lib/cucumber/core/gherkin/parser.rb +14 -22
- data/lib/cucumber/core/report/summary.rb +1 -23
- data/lib/cucumber/core/test/action.rb +2 -2
- data/lib/cucumber/core/test/around_hook.rb +4 -0
- data/lib/cucumber/core/test/case.rb +15 -121
- data/lib/cucumber/core/{ast → test}/data_table.rb +6 -8
- data/lib/cucumber/core/{ast → test}/doc_string.rb +5 -9
- data/lib/cucumber/core/{ast → test}/empty_multiline_argument.rb +1 -2
- data/lib/cucumber/core/test/filters/locations_filter.rb +2 -2
- data/lib/cucumber/core/{ast → test}/location.rb +10 -17
- data/lib/cucumber/core/test/runner.rb +5 -3
- data/lib/cucumber/core/test/step.rb +20 -36
- data/lib/cucumber/core/{ast → test}/tag.rb +1 -1
- data/lib/cucumber/core/version.rb +1 -1
- metadata +12 -26
- data/lib/cucumber/core/ast.rb +0 -14
- data/lib/cucumber/core/ast/background.rb +0 -41
- data/lib/cucumber/core/ast/comment.rb +0 -28
- data/lib/cucumber/core/ast/describes_itself.rb +0 -21
- data/lib/cucumber/core/ast/empty_background.rb +0 -17
- data/lib/cucumber/core/ast/examples_table.rb +0 -119
- data/lib/cucumber/core/ast/feature.rb +0 -88
- data/lib/cucumber/core/ast/names.rb +0 -25
- data/lib/cucumber/core/ast/outline_step.rb +0 -53
- data/lib/cucumber/core/ast/scenario.rb +0 -42
- data/lib/cucumber/core/ast/scenario_outline.rb +0 -45
- data/lib/cucumber/core/ast/step.rb +0 -83
- data/lib/cucumber/core/gherkin/ast_builder.rb +0 -403
- 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
|