mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Change "description" to "what" for consistency
This commit is contained in:
parent
68412daec0
commit
3facf3af9d
2 changed files with 10 additions and 10 deletions
|
@ -110,10 +110,10 @@ module Spectator::DSL
|
|||
raise NotImplementedError.new("Spectator::DSL#include_examples")
|
||||
end
|
||||
|
||||
macro it(description, &block)
|
||||
macro it(what, &block)
|
||||
_spectator_example_wrapper(Wrapper%example, %run) {{block}}
|
||||
|
||||
_spectator_example(Example%example, Wrapper%example, ::Spectator::RunnableExample, {{description}}) do
|
||||
_spectator_example(Example%example, Wrapper%example, ::Spectator::RunnableExample, {{what}}) do
|
||||
protected def run_instance
|
||||
@instance.%run
|
||||
end
|
||||
|
@ -122,10 +122,10 @@ module Spectator::DSL
|
|||
::Spectator::DSL::Builder.add_example(Example%example)
|
||||
end
|
||||
|
||||
macro pending(description, &block)
|
||||
macro pending(what, &block)
|
||||
_spectator_example_wrapper(Wrapper%example, %run) {{block}}
|
||||
|
||||
_spectator_example(Example%example, Wrapper%example, ::Spectator::PendingExample, {{description}})
|
||||
_spectator_example(Example%example, Wrapper%example, ::Spectator::PendingExample, {{what}})
|
||||
|
||||
::Spectator::DSL::Builder.add_example(Example%example)
|
||||
end
|
||||
|
@ -176,7 +176,7 @@ module Spectator::DSL
|
|||
end
|
||||
end
|
||||
|
||||
private macro _spectator_example(example_class_name, wrapper_class_name, base_class, description, &block)
|
||||
private macro _spectator_example(example_class_name, wrapper_class_name, base_class, what, &block)
|
||||
class {{example_class_name.id}} < {{base_class.id}}
|
||||
def initialize(group : ::Spectator::ExampleGroup, sample_values : ::Spectator::Internals::SampleValues)
|
||||
super
|
||||
|
@ -187,8 +187,8 @@ module Spectator::DSL
|
|||
{{block.body}}
|
||||
{% end %}
|
||||
|
||||
def description
|
||||
{{description.is_a?(StringLiteral) ? description : description.stringify}}
|
||||
def what
|
||||
{{what.is_a?(StringLiteral) ? what : what.stringify}}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Spectator
|
||||
# Base class for all types of examples.
|
||||
# Concrete types must implement the `#run_inner` and `#description` methods.
|
||||
# Concrete types must implement the `#run_inner` and `#what` methods.
|
||||
abstract class Example
|
||||
# Indicates whether the example has already been run.
|
||||
getter? finished = false
|
||||
|
@ -22,7 +22,7 @@ module Spectator
|
|||
private abstract def run_inner : Result
|
||||
|
||||
# Message that describes what the example tests.
|
||||
abstract def description : String
|
||||
abstract def what : String
|
||||
|
||||
# Creates the base of the example.
|
||||
# The group should be the example group the example belongs to.
|
||||
|
@ -36,7 +36,7 @@ module Spectator
|
|||
def to_s(io)
|
||||
@group.to_s(io)
|
||||
io << ' '
|
||||
io << description
|
||||
io << what
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue