cucumber-gherkin 26.2.0 → 27.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af2b5602cd53419921854a98f765dceb9bb7f7eeff21e916f645d714db6fecda
4
- data.tar.gz: 302c22cb981324b42974325f61a0eb3c5ee20dc8eaf2cbd7e90c2f893dc31209
3
+ metadata.gz: fbc83b6f938a3a8340c9294af1748e30df74132af1764c44c6497ed791afc66a
4
+ data.tar.gz: 164663118b966fdb4bbefa12794d73915c83b3cbaa9a260df078694b74336c72
5
5
  SHA512:
6
- metadata.gz: 8d07a4dd58a8e9fc773a8361036badbfa7abd550b7bbbd63ccfaf43a8454491236657134371790580de3ef3c2f7acba8d4dfc65c9143e92d44acedd7841e783b
7
- data.tar.gz: b107c64e600c1841b4ea275ee70eaac3426fe6e4c435e8da74883f944d0089a212b0646c40a0f2f26fe367e04a6f8027db8d44e3ca0fa4e719f2e645fe50fa40
6
+ metadata.gz: 608412c8b5ed734d338959803716ea4813c2c036cc3a175076ade152a089d559b56d5d75a82f6bda5dfb8a1e16ba3f01ebcca1e355628e1f9669cabb62170e61
7
+ data.tar.gz: 47ee4d057e778ea4901184bfd279b61eaf0546e72930e214d9c9f4a1e577d72eff704a6bd7766f413259ad73301d5fb1dc8053dbec009bf8d3b9e6338bae4161
@@ -630,7 +630,7 @@
630
630
  "name": "Danish",
631
631
  "native": "dansk",
632
632
  "rule": [
633
- "Rule"
633
+ "Regel"
634
634
  ],
635
635
  "scenario": [
636
636
  "Eksempel",
@@ -1132,7 +1132,7 @@
1132
1132
  "name": "Esperanto",
1133
1133
  "native": "Esperanto",
1134
1134
  "rule": [
1135
- "Rule"
1135
+ "Regulo"
1136
1136
  ],
1137
1137
  "scenario": [
1138
1138
  "Ekzemplo",
@@ -1886,7 +1886,8 @@
1886
1886
  "it": {
1887
1887
  "and": [
1888
1888
  "* ",
1889
- "E "
1889
+ "E ",
1890
+ "Ed "
1890
1891
  ],
1891
1892
  "background": [
1892
1893
  "Contesto"
@@ -2532,7 +2533,7 @@
2532
2533
  "name": "Dutch",
2533
2534
  "native": "Nederlands",
2534
2535
  "rule": [
2535
- "Rule"
2536
+ "Regel"
2536
2537
  ],
2537
2538
  "scenario": [
2538
2539
  "Voorbeeld",
@@ -3643,6 +3644,47 @@
3643
3644
  "当"
3644
3645
  ]
3645
3646
  },
3647
+ "ml": {
3648
+ "and": [
3649
+ "* ",
3650
+ "ഒപ്പം"
3651
+ ],
3652
+ "background": [
3653
+ "പശ്ചാത്തലം"
3654
+ ],
3655
+ "but": [
3656
+ "* ",
3657
+ "പക്ഷേ"
3658
+ ],
3659
+ "examples": [
3660
+ "ഉദാഹരണങ്ങൾ"
3661
+ ],
3662
+ "feature": [
3663
+ "സവിശേഷത"
3664
+ ],
3665
+ "given": [
3666
+ "* ",
3667
+ "നൽകിയത്"
3668
+ ],
3669
+ "name": "Malayalam",
3670
+ "native": "മലയാളം",
3671
+ "rule": [
3672
+ "നിയമം"
3673
+ ],
3674
+ "scenario": [
3675
+ "രംഗം"
3676
+ ],
3677
+ "scenarioOutline": [
3678
+ "സാഹചര്യത്തിന്റെ രൂപരേഖ"
3679
+ ],
3680
+ "then": [
3681
+ "* ",
3682
+ "പിന്നെ"
3683
+ ],
3684
+ "when": [
3685
+ "എപ്പോൾ"
3686
+ ]
3687
+ },
3646
3688
  "zh-TW": {
3647
3689
  "and": [
3648
3690
  "* ",
data/lib/gherkin/query.rb CHANGED
@@ -2,12 +2,19 @@ module Gherkin
2
2
  class Query
3
3
  def initialize
4
4
  @ast_node_locations = {}
5
+ @scenario_parent_locations = {}
6
+ @background_locations = {}
5
7
  end
6
8
 
7
9
  def update(message)
8
10
  update_feature(message.gherkin_document.feature) if message.gherkin_document
9
11
  end
10
12
 
13
+ def scenario_parent_locations(scenario_node_id)
14
+ return @scenario_parent_locations[scenario_node_id] if @scenario_parent_locations.has_key?(scenario_node_id)
15
+ raise AstNodeNotLocatedException, "No scenario parent locations found for #{scenario_node_id} }. Known: #{@scenario_parent_locations.keys}"
16
+ end
17
+
11
18
  def location(ast_node_id)
12
19
  return @ast_node_locations[ast_node_id] if @ast_node_locations.has_key?(ast_node_id)
13
20
  raise AstNodeNotLocatedException, "No location found for #{ast_node_id} }. Known: #{@ast_node_locations.keys}"
@@ -20,27 +27,27 @@ module Gherkin
20
27
  store_nodes_location(feature.tags)
21
28
 
22
29
  feature.children.each do |child|
23
- update_rule(child.rule) if child.rule
24
- update_background(child.background) if child.background
25
- update_scenario(child.scenario) if child.scenario
30
+ update_rule(feature, child.rule) if child.rule
31
+ update_background(feature, child.background) if child.background
32
+ update_scenario(feature, child.rule, child.scenario) if child.scenario
26
33
  end
27
34
  end
28
35
 
29
- def update_rule(rule)
36
+ def update_rule(feature, rule)
30
37
  return if rule.nil?
31
38
  store_nodes_location(rule.tags)
32
-
33
39
  rule.children.each do |child|
34
- update_background(child.background) if child.background
35
- update_scenario(child.scenario) if child.scenario
40
+ update_background(rule, child.background) if child.background
41
+ update_scenario(feature, rule, child.scenario) if child.scenario
36
42
  end
37
43
  end
38
44
 
39
- def update_background(background)
45
+ def update_background(parent, background)
40
46
  update_steps(background.steps)
47
+ @background_locations[parent] = background.location
41
48
  end
42
49
 
43
- def update_scenario(scenario)
50
+ def update_scenario(feature, rule, scenario)
44
51
  store_node_location(scenario)
45
52
  store_nodes_location(scenario.tags)
46
53
  update_steps(scenario.steps)
@@ -48,6 +55,13 @@ module Gherkin
48
55
  store_nodes_location(examples.tags || [])
49
56
  store_nodes_location(examples.table_body || [])
50
57
  end
58
+
59
+ @scenario_parent_locations[scenario.id] = [
60
+ feature.location,
61
+ @background_locations[feature],
62
+ rule&.location,
63
+ @background_locations[rule],
64
+ ].compact
51
65
  end
52
66
 
53
67
  def update_steps(steps)
@@ -47,6 +47,7 @@ describe Gherkin::Query do
47
47
  Examples:
48
48
  | Status |
49
49
  | passed |
50
+ | failed |
50
51
 
51
52
  @rule-tag
52
53
  Rule: this is a rule
@@ -71,6 +72,56 @@ describe Gherkin::Query do
71
72
  end
72
73
  end
73
74
 
75
+ describe '#scenario_parent_locations' do
76
+ before do
77
+ messages.each { |message| subject.update(message) }
78
+ end
79
+
80
+ let(:background) { find_message_by_attribute(gherkin_document.feature.children, :background) }
81
+ let(:scenarios) { filter_messages_by_attribute(gherkin_document.feature.children, :scenario) }
82
+
83
+ context 'without rule' do
84
+ let(:scenario) { scenarios.first }
85
+
86
+ it 'provides the feature and background locations of a given scenario node id' do
87
+ expect(subject.scenario_parent_locations(scenario.id)).to eq([
88
+ gherkin_document.feature.location,
89
+ background.location,
90
+ ])
91
+ end
92
+ end
93
+
94
+ context 'with rule' do
95
+ let(:rule) { find_message_by_attribute(gherkin_document.feature.children, :rule) }
96
+ let(:rule_background) { find_message_by_attribute(rule.children, :background) }
97
+ let(:scenario) { find_message_by_attribute(rule.children, :scenario) }
98
+
99
+ it 'provides the feature, background, rule, and rule background locations of a given scenario node id' do
100
+ expect(subject.scenario_parent_locations(scenario.id)).to eq([
101
+ gherkin_document.feature.location,
102
+ background.location,
103
+ rule.location,
104
+ rule_background.location,
105
+ ])
106
+ end
107
+ end
108
+
109
+ context 'in a scenario outline' do
110
+ let(:scenario) { scenarios.last }
111
+
112
+ it 'provides the feature and background locations of a given scenario outline node id' do
113
+ expect(subject.scenario_parent_locations(scenario.id)).to eq([
114
+ gherkin_document.feature.location,
115
+ background.location,
116
+ ])
117
+ end
118
+ end
119
+
120
+ it 'raises an exception if called with an invalid id' do
121
+ expect { subject.scenario_parent_locations("BAD") }.to raise_error(Gherkin::AstNodeNotLocatedException)
122
+ end
123
+ end
124
+
74
125
  describe '#location' do
75
126
  before do
76
127
  messages.each { |message| subject.update(message) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-gherkin
3
3
  version: !ruby/object:Gem::Version
4
- version: 26.2.0
4
+ version: 27.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gáspár Nagy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-04-07 00:00:00.000000000 Z
13
+ date: 2023-09-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: cucumber-messages
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 19.1.4
22
22
  - - "<"
23
23
  - !ruby/object:Gem::Version
24
- version: '22.1'
24
+ version: '23'
25
25
  type: :runtime
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
@@ -31,7 +31,7 @@ dependencies:
31
31
  version: 19.1.4
32
32
  - - "<"
33
33
  - !ruby/object:Gem::Version
34
- version: '22.1'
34
+ version: '23'
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: rake
37
37
  requirement: !ruby/object:Gem::Requirement
@@ -123,17 +123,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
123
123
  requirements:
124
124
  - - ">="
125
125
  - !ruby/object:Gem::Version
126
- version: '2.3'
126
+ version: '2.5'
127
127
  required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  requirements: []
133
- rubygems_version: 3.2.22
133
+ rubygems_version: 3.4.10
134
134
  signing_key:
135
135
  specification_version: 4
136
- summary: cucumber-gherkin-26.2.0
136
+ summary: cucumber-gherkin-27.0.0
137
137
  test_files:
138
138
  - spec/capture_warnings.rb
139
139
  - spec/gherkin/dialect_spec.rb