mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Avoid calling NoReturn methods
This commit is contained in:
parent
1c865d1f4b
commit
92dbfc2a8e
1 changed files with 10 additions and 2 deletions
|
@ -82,8 +82,12 @@ module Spectator::Mocks
|
|||
%call = ::Spectator::Mocks::MethodCall.new({{name.symbolize}}, %args)
|
||||
%harness.mocks.record_call(self, %call)
|
||||
if (%stub = %harness.mocks.find_stub(self, %call))
|
||||
if typeof({{original}}) == NoReturn
|
||||
return %stub.call!(%args) { nil }
|
||||
else
|
||||
return %stub.call!(%args) { {{original}} }
|
||||
end
|
||||
end
|
||||
|
||||
{% if body && !body.is_a?(Nop) || return_type.is_a?(ArrayLiteral) %}
|
||||
%method({{args.splat}})
|
||||
|
@ -101,8 +105,12 @@ module Spectator::Mocks
|
|||
%call = ::Spectator::Mocks::MethodCall.new({{name.symbolize}}, %args)
|
||||
%harness.mocks.record_call(self, %call)
|
||||
if (%stub = %harness.mocks.find_stub(self, %call))
|
||||
if typeof({{original}}) == NoReturn
|
||||
return %stub.call!(%args) { nil }
|
||||
else
|
||||
return %stub.call!(%args) { {{original}} { |*%ya| yield *%ya } }
|
||||
end
|
||||
end
|
||||
|
||||
{% if body && !body.is_a?(Nop) || return_type.is_a?(ArrayLiteral) %}
|
||||
%method({{args.splat}}) { |*%ya| yield *%ya }
|
||||
|
|
Loading…
Reference in a new issue