mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Remove redundant block conditionals
This commit is contained in:
parent
df5a4fa77c
commit
99fb47c6e9
1 changed files with 4 additions and 12 deletions
|
@ -43,9 +43,7 @@ module Spectator::DSL
|
||||||
|
|
||||||
{% begin %}
|
{% begin %}
|
||||||
# Define a matching null double type.
|
# Define a matching null double type.
|
||||||
::Spectator::NullDouble.define({{null_double_type_name}}, {{name}}, {{**value_methods}}){% if block %} do
|
::Spectator::NullDouble.define({{null_double_type_name}}, {{name}}, {{**value_methods}}) {{block}}
|
||||||
{{block.body}}
|
|
||||||
end{% end %}
|
|
||||||
{% end %}
|
{% end %}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -172,9 +170,7 @@ module Spectator::DSL
|
||||||
# See `#def_double`.
|
# See `#def_double`.
|
||||||
macro double(name, **value_methods, &block)
|
macro double(name, **value_methods, &block)
|
||||||
{% begin %}
|
{% begin %}
|
||||||
{% if @def %}new_double{% else %}def_double{% end %}({{name}}, {{**value_methods}}){% if block %} do
|
{% if @def %}new_double{% else %}def_double{% end %}({{name}}, {{**value_methods}}) {{block}}
|
||||||
{{block.body}}
|
|
||||||
end{% end %}
|
|
||||||
{% end %}
|
{% end %}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -233,9 +229,7 @@ module Spectator::DSL
|
||||||
:module
|
:module
|
||||||
end %}
|
end %}
|
||||||
|
|
||||||
::Spectator::Mock.define_subtype({{base}}, {{type.id}}, {{mock_type_name}}, {{name}}, {{**value_methods}}){% if block %} do
|
::Spectator::Mock.define_subtype({{base}}, {{type.id}}, {{mock_type_name}}, {{name}}, {{**value_methods}}) {{block}}
|
||||||
{{block.body}}
|
|
||||||
end{% end %}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Instantiates a mock.
|
# Instantiates a mock.
|
||||||
|
@ -316,9 +310,7 @@ module Spectator::DSL
|
||||||
macro mock(type, **value_methods, &block)
|
macro mock(type, **value_methods, &block)
|
||||||
{% raise "First argument of `mock` must be a type name, not #{type}" unless type.is_a?(Path) || type.is_a?(Generic) || type.is_a?(Union) || type.is_a?(Metaclass) || type.is_a?(TypeNode) %}
|
{% raise "First argument of `mock` must be a type name, not #{type}" unless type.is_a?(Path) || type.is_a?(Generic) || type.is_a?(Union) || type.is_a?(Metaclass) || type.is_a?(TypeNode) %}
|
||||||
{% begin %}
|
{% begin %}
|
||||||
{% if @def %}new_mock{% else %}def_mock{% end %}({{type}}, {{**value_methods}}){% if block %} do
|
{% if @def %}new_mock{% else %}def_mock{% end %}({{type}}, {{**value_methods}}) {{block}}
|
||||||
{{block.body}}
|
|
||||||
end{% end %}
|
|
||||||
{% end %}
|
{% end %}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue