cucumber-core 16.2.0 → 17.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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -1
  3. data/LICENSE +14 -13
  4. data/lib/cucumber/core/compiler.rb +11 -10
  5. data/lib/cucumber/core/event.rb +12 -10
  6. data/lib/cucumber/core/event_bus.rb +1 -1
  7. data/lib/cucumber/core/events/base.rb +26 -0
  8. data/lib/cucumber/core/events/envelope.rb +13 -2
  9. data/lib/cucumber/core/events/gherkin_source_parsed.rb +12 -3
  10. data/lib/cucumber/core/events/test_case_created.rb +12 -6
  11. data/lib/cucumber/core/events/test_case_finished.rb +11 -1
  12. data/lib/cucumber/core/events/test_case_started.rb +12 -3
  13. data/lib/cucumber/core/events/test_step_created.rb +12 -6
  14. data/lib/cucumber/core/events/test_step_finished.rb +14 -4
  15. data/lib/cucumber/core/events/test_step_started.rb +12 -3
  16. data/lib/cucumber/core/gherkin/document.rb +16 -6
  17. data/lib/cucumber/core/gherkin/parser.rb +5 -9
  18. data/lib/cucumber/core/report/summary.rb +2 -2
  19. data/lib/cucumber/core/test/action/defined.rb +3 -3
  20. data/lib/cucumber/core/test/action.rb +6 -6
  21. data/lib/cucumber/core/test/around_hook.rb +4 -4
  22. data/lib/cucumber/core/test/case.rb +27 -26
  23. data/lib/cucumber/core/test/data_table.rb +37 -39
  24. data/lib/cucumber/core/test/doc_string.rb +23 -23
  25. data/lib/cucumber/core/test/empty_multiline_argument.rb +8 -8
  26. data/lib/cucumber/core/test/filters/locations_filter.rb +1 -1
  27. data/lib/cucumber/core/test/filters/name_filter.rb +1 -1
  28. data/lib/cucumber/core/test/filters/tag_filter.rb +1 -1
  29. data/lib/cucumber/core/test/filters.rb +3 -3
  30. data/lib/cucumber/core/test/hook_step.rb +1 -1
  31. data/lib/cucumber/core/test/location.rb +0 -2
  32. data/lib/cucumber/core/test/result/ambiguous.rb +41 -0
  33. data/lib/cucumber/core/test/result/boolean_methods.rb +28 -0
  34. data/lib/cucumber/core/test/result/duration.rb +33 -0
  35. data/lib/cucumber/core/test/result/failed.rb +72 -0
  36. data/lib/cucumber/core/test/result/flaky.rb +21 -0
  37. data/lib/cucumber/core/test/result/passed.rb +57 -0
  38. data/lib/cucumber/core/test/result/pending.rb +41 -0
  39. data/lib/cucumber/core/test/result/raisable.rb +46 -0
  40. data/lib/cucumber/core/test/result/skipped.rb +41 -0
  41. data/lib/cucumber/core/test/result/summary.rb +89 -0
  42. data/lib/cucumber/core/test/result/undefined.rb +41 -0
  43. data/lib/cucumber/core/test/result/unknown.rb +40 -0
  44. data/lib/cucumber/core/test/result/unknown_duration.rb +26 -0
  45. data/lib/cucumber/core/test/result.rb +15 -458
  46. data/lib/cucumber/core/test/runner.rb +25 -22
  47. data/lib/cucumber/core/test/step.rb +22 -23
  48. data/lib/cucumber/core/test/tag.rb +2 -0
  49. data/lib/cucumber/core/test/timer.rb +1 -1
  50. data/lib/cucumber/core.rb +6 -5
  51. metadata +26 -16
  52. data/lib/cucumber/core/platform.rb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5192b979fbfa5fa71497c22b8b00f5b5b8ce8ab6cb19336cd30fbb1ba4b0d5c0
4
- data.tar.gz: b7f2369ab7d140b6f994a4449da3aeaafc40b778ff13bbdfd39cc667dd364348
3
+ metadata.gz: 88faed296b96d11e574838451644e6ab5e784bb2e4bdf9238f24b4488dc4a902
4
+ data.tar.gz: 020fe0f4bbc9072752a0748465157991e9c65765ce47c33061c89bedd7e37db0
5
5
  SHA512:
6
- metadata.gz: 07370ea41e4c119482539c14e9ddb72892978d099fdf28954e8530b3ff5e012f95843f933ec3d21b7021886f78ae4c63f4dbf900ea7384b90b79515e68af2bb6
7
- data.tar.gz: 7c16479e598b3217b7bbaef0712c06b75212b66bc9b2b9d2f887a10914cb590f8a288affdc59dc487ee00e7542982e9069147293809f4b2191d620f598df9b21
6
+ metadata.gz: 9f1900994b1560af95ba5871cd9ee8f9647d1e93e4148e6ed1d56406c4fffaa85afdccebfc9d05a11d795bebf473e2450589656d193e7d42d6412d4c1a861fa4
7
+ data.tar.gz: 7490537caa92180e2887080e8bd7fa169bc9994dd2d01262ffb57b3d3b3d5df1a34c7ae6503d5433847409b44586e221bdd2dd00ec7f28a094c00878751e480e
data/CHANGELOG.md CHANGED
@@ -10,6 +10,23 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [17.0.0] - 2026-06-01
14
+ ### Added
15
+ - Added `#to_envelope` for `Cucumber::Core::Gherkin::Document` ([#329](https://github.com/cucumber/cucumber-ruby-core/pull/329))
16
+
17
+ ### Changed
18
+ - Refactored the internal base `Event` class to reduce complexity and make it more flexible for future use (No user facing changes)
19
+ - Refactored the `Result` classes to be more simplified and one class per file
20
+ - Changed the base event inheritance to a new base class structure
21
+ - Refactored some internals of the library to be slightly more performant (Including removing redundant nil checks)
22
+ - Permit `cucumber-tag-expressions` up to v10
23
+ - Change to use worst Test Step result as the Test Case result
24
+ ([#317](https://github.com/cucumber/cucumber-ruby-core/pull/317))
25
+
26
+ ### Removed
27
+ - Strict configuration has been removed from all `Result` classes
28
+ - Removed the ability to list event attributes (Only the `#to_h` method now remains for this purpose)
29
+
13
30
  ## [16.2.0] - 2026-02-06
14
31
  ### Changed
15
32
  - Added the test result type 'ambiguous'
@@ -132,7 +149,8 @@ See upgrading notes for [13.0.0.md](upgrading_notes/13.0.0.md#upgrading-to-cucum
132
149
  ### Changed
133
150
  - Updated `cucumber-gherkin` and `cucumber-messages`
134
151
 
135
- [Unreleased]: https://github.com/cucumber/cucumber-ruby-core/compare/v16.2.0...HEAD
152
+ [Unreleased]: https://github.com/cucumber/cucumber-ruby-core/compare/v17.0.0...HEAD
153
+ [17.0.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v16.2.0...v17.0.0
136
154
  [16.2.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v16.1.1...v16.2.0
137
155
  [16.1.1]: https://github.com/cucumber/cucumber-ruby-core/compare/v16.1.0...v16.1.1
138
156
  [16.1.0]: https://github.com/cucumber/cucumber-ruby-core/compare/v16.0.0...v16.1.0
data/LICENSE CHANGED
@@ -1,20 +1,21 @@
1
- Copyright (c) Cucumber Ltd. and Contributors
1
+ MIT License
2
2
 
3
- MIT License (Expat)
3
+ Copyright (c) Cucumber Ltd. and Contributors
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the "Software"), to deal in
7
- the Software without restriction, including without limitation the rights to
8
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software is furnished to do so,
10
- subject to the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
11
 
12
12
  The above copyright notice and this permission notice shall be included in all
13
13
  copies or substantial portions of the Software.
14
14
 
15
15
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,12 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'cucumber/core/test/case'
4
- require 'cucumber/core/test/data_table'
5
- require 'cucumber/core/test/doc_string'
6
- require 'cucumber/core/test/empty_multiline_argument'
7
- require 'cucumber/core/test/hook_step'
8
- require 'cucumber/core/test/step'
9
- require 'cucumber/core/test/tag'
3
+ require_relative 'test/case'
4
+ require_relative 'test/data_table'
5
+ require_relative 'test/doc_string'
6
+ require_relative 'test/empty_multiline_argument'
7
+ require_relative 'test/hook_step'
8
+ require_relative 'test/step'
9
+ require_relative 'test/tag'
10
+
10
11
  require 'cucumber/messages'
11
12
 
12
13
  module Cucumber
@@ -16,7 +17,7 @@ module Cucumber
16
17
  attr_reader :receiver, :gherkin_query, :id_generator
17
18
  private :receiver, :gherkin_query, :id_generator
18
19
 
19
- def initialize(receiver, gherkin_query, event_bus = nil)
20
+ def initialize(receiver, gherkin_query, event_bus)
20
21
  @receiver = receiver
21
22
  @id_generator = Cucumber::Messages::Helpers::IdGenerator::UUID.new
22
23
  @gherkin_query = gherkin_query
@@ -42,7 +43,7 @@ module Cucumber
42
43
  parent_locations = parent_locations_from_pickle(pickle)
43
44
  tags = tags_from_pickle(pickle, uri)
44
45
  Test::Case.new(id_generator.new_id, pickle.name, test_steps, location, parent_locations, tags, pickle.language).tap do |test_case|
45
- @event_bus&.test_case_created(test_case, pickle)
46
+ @event_bus.test_case_created(test_case, pickle)
46
47
  end
47
48
  end
48
49
 
@@ -50,7 +51,7 @@ module Cucumber
50
51
  location = location_from_pickle_step(pickle_step, uri)
51
52
  multiline_arg = create_multiline_arg(pickle_step, uri)
52
53
  Test::Step.new(id_generator.new_id, pickle_step.text, location, multiline_arg).tap do |test_step|
53
- @event_bus&.test_step_created(test_step, pickle_step)
54
+ @event_bus.test_step_created(test_step, pickle_step)
54
55
  end
55
56
  end
56
57
 
@@ -21,19 +21,21 @@ module Cucumber
21
21
  instance_variable_set(:"@#{name}", value)
22
22
  end
23
23
  end
24
+ end
25
+ end
24
26
 
25
- define_method(:attributes) do
26
- events.map { |var| instance_variable_get(:"@#{var}") }
27
- end
27
+ def to_h
28
+ instance_variables.to_h do |variable_name|
29
+ [variable_name[1..].to_sym, instance_variable_get(variable_name)]
30
+ end
31
+ end
28
32
 
29
- define_method(:to_h) do
30
- events.zip(attributes).to_h
31
- end
33
+ def attributes
34
+ instance_variables.map { |var| instance_variable_get(var) }
35
+ end
32
36
 
33
- def event_id
34
- self.class.event_id
35
- end
36
- end
37
+ def event_id
38
+ self.class.event_id
37
39
  end
38
40
 
39
41
  class << self
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'cucumber/core/events'
3
+ require_relative 'events'
4
4
 
5
5
  module Cucumber
6
6
  module Core
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Cucumber
4
+ module Core
5
+ module Events
6
+ # An archetype of what each Cucumber Event defined in cucumber-ruby must adhere to
7
+ class Base
8
+ # The "key" name of the class to be used as the key in the event registry (Underscored name symbolized)
9
+ # @return [Symbol]
10
+ def self.event_id
11
+ raise 'Must be implemented in subclass'
12
+ end
13
+
14
+ # The properties of each event. Stored in iVar named format - where the key is the name of the iVar
15
+ # @return [Hash<Symbol>]
16
+ def to_h
17
+ instance_variables.to_h { |variable_name| [variable_name[1..].to_sym, instance_variable_get(variable_name)] }
18
+ end
19
+
20
+ def event_id
21
+ self.class.event_id
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -1,12 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../event'
3
+ require_relative 'base'
4
4
 
5
5
  module Cucumber
6
6
  module Core
7
7
  module Events
8
- class Envelope < Event.new(:envelope)
8
+ class Envelope < Base
9
9
  attr_reader :envelope
10
+
11
+ # The underscored name of the class to be used as the key in an event registry
12
+ # @return [Symbol]
13
+ def self.event_id
14
+ :envelope
15
+ end
16
+
17
+ def initialize(envelope)
18
+ @envelope = envelope
19
+ super()
20
+ end
10
21
  end
11
22
  end
12
23
  end
@@ -1,14 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../event'
3
+ require_relative 'base'
4
4
 
5
5
  module Cucumber
6
6
  module Core
7
7
  module Events
8
8
  # Signals that a gherkin source has been parsed
9
- class GherkinSourceParsed < Event.new(:gherkin_document)
10
- # @return [GherkinDocument] the GherkinDocument Ast Node
9
+ class GherkinSourceParsed < Base
10
+ # @return [GherkinDocument] the GherkinDocument Ast Node that was parsed
11
11
  attr_reader :gherkin_document
12
+
13
+ def self.event_id
14
+ :gherkin_source_parsed
15
+ end
16
+
17
+ def initialize(gherkin_document)
18
+ @gherkin_document = gherkin_document
19
+ super()
20
+ end
12
21
  end
13
22
  end
14
23
  end
@@ -1,17 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../event'
3
+ require_relative 'base'
4
4
 
5
5
  module Cucumber
6
6
  module Core
7
7
  module Events
8
8
  # Signals that a Test::Case was created from a Pickle
9
- class TestCaseCreated < Event.new(:test_case, :pickle)
10
- # The created test step
11
- attr_reader :test_case
9
+ class TestCaseCreated < Base
10
+ attr_reader :test_case, :pickle
12
11
 
13
- # The source pickle step
14
- attr_reader :pickle
12
+ def self.event_id
13
+ :test_case_created
14
+ end
15
+
16
+ def initialize(test_case, pickle)
17
+ @test_case = test_case
18
+ @pickle = pickle
19
+ super()
20
+ end
15
21
  end
16
22
  end
17
23
  end
@@ -6,12 +6,22 @@ module Cucumber
6
6
  module Core
7
7
  module Events
8
8
  # Signals that a {Test::Case} has finished executing
9
- class TestCaseFinished < Event.new(:test_case, :result)
9
+ class TestCaseFinished < Base
10
10
  # @return [Test::Case] that was executed
11
11
  attr_reader :test_case
12
12
 
13
13
  # @return [Test::Result] the result of running the {Test::Step}
14
14
  attr_reader :result
15
+
16
+ def self.event_id
17
+ :test_case_finished
18
+ end
19
+
20
+ def initialize(test_case, result)
21
+ @test_case = test_case
22
+ @result = result
23
+ super()
24
+ end
15
25
  end
16
26
  end
17
27
  end
@@ -1,14 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../event'
3
+ require_relative 'base'
4
4
 
5
5
  module Cucumber
6
6
  module Core
7
7
  module Events
8
8
  # Signals that a {Test::Case} is about to be executed
9
- class TestCaseStarted < Event.new(:test_case)
10
- # @return [Test::Case] the test case to be executed
9
+ class TestCaseStarted < Base
10
+ # @return [Cucumber::Core::Test::Case] the test case to be executed
11
11
  attr_reader :test_case
12
+
13
+ def self.event_id
14
+ :test_case_started
15
+ end
16
+
17
+ def initialize(test_case)
18
+ @test_case = test_case
19
+ super()
20
+ end
12
21
  end
13
22
  end
14
23
  end
@@ -1,17 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../event'
3
+ require_relative 'base'
4
4
 
5
5
  module Cucumber
6
6
  module Core
7
7
  module Events
8
8
  # Signals that a Test::Step was created from a PickleStep
9
- class TestStepCreated < Event.new(:test_step, :pickle_step)
10
- # The created test step
11
- attr_reader :test_step
9
+ class TestStepCreated < Base
10
+ attr_reader :test_step, :pickle_step
12
11
 
13
- # The source pickle step
14
- attr_reader :pickle_step
12
+ def self.event_id
13
+ :test_step_created
14
+ end
15
+
16
+ def initialize(test_step, pickle_step)
17
+ @test_step = test_step
18
+ @pickle_step = pickle_step
19
+ super()
20
+ end
15
21
  end
16
22
  end
17
23
  end
@@ -1,17 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../event'
3
+ require_relative 'base'
4
4
 
5
5
  module Cucumber
6
6
  module Core
7
7
  module Events
8
8
  # Signals that a {Test::Step} has finished executing
9
- class TestStepFinished < Event.new(:test_step, :result)
10
- # @return [Test::Step] the test step that was executed
9
+ class TestStepFinished < Base
10
+ # @return [Cucumber::Core::Test::Step] the test step that was executed
11
11
  attr_reader :test_step
12
12
 
13
- # @return [Test::Result] the result of running the {Test::Step}
13
+ # @return [Cucumber::Core::Test::Result] the result of running the {Cucumber::Core::Test::Step}
14
14
  attr_reader :result
15
+
16
+ def self.event_id
17
+ :test_step_finished
18
+ end
19
+
20
+ def initialize(test_step, result)
21
+ @test_step = test_step
22
+ @result = result
23
+ super()
24
+ end
15
25
  end
16
26
  end
17
27
  end
@@ -1,14 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative '../event'
3
+ require_relative 'base'
4
4
 
5
5
  module Cucumber
6
6
  module Core
7
7
  module Events
8
8
  # Signals that a {Test::Step} is about to be executed
9
- class TestStepStarted < Event.new(:test_step)
10
- # @return [Test::Step] the test step to be executed
9
+ class TestStepStarted < Base
10
+ # @return [Cucumber::Core::Test::Step] the test step to be executed
11
11
  attr_reader :test_step
12
+
13
+ def self.event_id
14
+ :test_step_started
15
+ end
16
+
17
+ def initialize(test_step)
18
+ @test_step = test_step
19
+ super()
20
+ end
12
21
  end
13
22
  end
14
23
  end
@@ -6,18 +6,28 @@ module Cucumber
6
6
  class Document
7
7
  attr_reader :uri, :body, :language
8
8
 
9
- def initialize(uri, body, language = nil)
10
- @uri = uri
11
- @body = body
12
- @language = language || 'en'
9
+ def initialize(uri, body, language = 'en')
10
+ @uri = uri
11
+ @body = body
12
+ @language = language
13
+ end
14
+
15
+ def ==(other)
16
+ to_s == other.to_s
13
17
  end
14
18
 
15
19
  def to_s
16
20
  body
17
21
  end
18
22
 
19
- def ==(other)
20
- to_s == other.to_s
23
+ def to_envelope
24
+ Cucumber::Messages::Envelope.new(
25
+ source: Cucumber::Messages::Source.new(
26
+ uri: uri,
27
+ data: body,
28
+ media_type: 'text/x.cucumber.gherkin+plain'
29
+ )
30
+ )
21
31
  end
22
32
  end
23
33
  end
@@ -64,15 +64,11 @@ module Cucumber
64
64
  end
65
65
 
66
66
  def type(message)
67
- if !message.gherkin_document.nil?
68
- :gherkin_document
69
- elsif !message.pickle.nil?
70
- :pickle
71
- elsif message.parse_error
72
- :parse_error
73
- else
74
- :unknown
75
- end
67
+ return :gherkin_document if message.gherkin_document
68
+ return :pickle if message.pickle
69
+ return :parse_error if message.parse_error
70
+
71
+ :unknown
76
72
  end
77
73
  end
78
74
  end
@@ -13,8 +13,8 @@ module Cucumber
13
13
  subscribe_to(event_bus)
14
14
  end
15
15
 
16
- def ok?(strict: Test::Result::StrictConfiguration.new)
17
- test_cases.ok?(strict: strict)
16
+ def ok?
17
+ test_cases.ok?
18
18
  end
19
19
 
20
20
  private
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'cucumber/core/test/location'
4
- require 'cucumber/core/test/result'
5
- require 'cucumber/core/test/timer'
3
+ require_relative '../location'
4
+ require_relative '../result'
5
+ require_relative '../timer'
6
6
 
7
7
  module Cucumber
8
8
  module Core
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'cucumber/core/test/location'
4
- require 'cucumber/core/test/result'
5
- require 'cucumber/core/test/timer'
3
+ require_relative 'location'
4
+ require_relative 'result'
5
+ require_relative 'timer'
6
6
 
7
- require 'cucumber/core/test/action/defined'
8
- require 'cucumber/core/test/action/undefined'
9
- require 'cucumber/core/test/action/unskippable'
7
+ require_relative 'action/defined'
8
+ require_relative 'action/undefined'
9
+ require_relative 'action/unskippable'
@@ -13,10 +13,6 @@ module Cucumber
13
13
  visitor.around_hook(self, *, &)
14
14
  end
15
15
 
16
- def hook?
17
- true
18
- end
19
-
20
16
  def execute(*_args, &continue)
21
17
  @timer.start
22
18
  @block.call(continue)
@@ -27,6 +23,10 @@ module Cucumber
27
23
  failed(e)
28
24
  end
29
25
 
26
+ def hook?
27
+ true
28
+ end
29
+
30
30
  private
31
31
 
32
32
  def failed(exception)
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'cucumber/core/test/result'
4
3
  require 'cucumber/tag_expressions'
5
4
 
5
+ require_relative 'result'
6
+
6
7
  module Cucumber
7
8
  module Core
8
9
  module Test
@@ -22,8 +23,8 @@ module Cucumber
22
23
  @around_hooks = around_hooks
23
24
  end
24
25
 
25
- def step_count
26
- test_steps.count
26
+ def ==(other)
27
+ eql?(other)
27
28
  end
28
29
 
29
30
  def describe_to(visitor, *args)
@@ -37,20 +38,25 @@ module Cucumber
37
38
  self
38
39
  end
39
40
 
40
- def with_steps(test_steps)
41
- self.class.new(id, name, test_steps, location, parent_locations, tags, language, around_hooks)
41
+ def eql?(other)
42
+ other.hash == hash
42
43
  end
43
44
 
44
- def with_around_hooks(around_hooks)
45
- self.class.new(id, name, test_steps, location, parent_locations, tags, language, around_hooks)
45
+ def hash
46
+ location.hash
46
47
  end
47
48
 
48
- def match_tags?(*expressions)
49
- expressions.flatten.all? { |expression| match_single_tag_expression?(expression) }
49
+ def inspect
50
+ "#<#{self.class}: #{location}>"
50
51
  end
51
52
 
52
- def match_name?(name_regexp)
53
- name =~ name_regexp
53
+ def matching_locations
54
+ [
55
+ parent_locations,
56
+ location,
57
+ tags.map(&:location),
58
+ test_steps.map(&:matching_locations)
59
+ ].flatten
54
60
  end
55
61
 
56
62
  def match_locations?(queried_locations)
@@ -61,29 +67,24 @@ module Cucumber
61
67
  end
62
68
  end
63
69
 
64
- def matching_locations
65
- [
66
- parent_locations,
67
- location,
68
- tags.map(&:location),
69
- test_steps.map(&:matching_locations)
70
- ].flatten
70
+ def match_name?(name_regexp)
71
+ name =~ name_regexp
71
72
  end
72
73
 
73
- def inspect
74
- "#<#{self.class}: #{location}>"
74
+ def match_tags?(*expressions)
75
+ expressions.flatten.all? { |expression| match_single_tag_expression?(expression) }
75
76
  end
76
77
 
77
- def hash
78
- location.hash
78
+ def step_count
79
+ test_steps.count
79
80
  end
80
81
 
81
- def eql?(other)
82
- other.hash == hash
82
+ def with_around_hooks(around_hooks)
83
+ self.class.new(id, name, test_steps, location, parent_locations, tags, language, around_hooks)
83
84
  end
84
85
 
85
- def ==(other)
86
- eql?(other)
86
+ def with_steps(test_steps)
87
+ self.class.new(id, name, test_steps, location, parent_locations, tags, language, around_hooks)
87
88
  end
88
89
 
89
90
  private