Fix missing keyword arguments after splat

This commit is contained in:
Michael Miller 2022-10-23 22:36:20 -06:00
parent a31ffe3fa3
commit 4dacaab6dc
No known key found for this signature in database
GPG key ID: 32B47AE8F388A1FF
2 changed files with 7 additions and 3 deletions

View file

@ -11,7 +11,7 @@ Spectator.describe "Mock DSL", :smoke do
args[1].as(Int32),
args[2].as(Int32),
},
args[3].as(Int32),
args[:kwarg].as(Int32),
{
x: args[:x].as(Int32),
y: args[:y].as(Int32),

View file

@ -145,7 +145,9 @@ module Spectator
{% for arg, i in method.args %}{% if !method.splat_index || i < method.splat_index %}{{arg.internal_name.stringify}}: {{arg.internal_name}}, {% end %}{% end %}
),
{% if method.splat_index && (splat = method.args[method.splat_index].internal_name) %}{{splat.symbolize}}, {{splat}},{% end %}
{{method.double_splat}}
::NamedTuple.new(
{% for arg, i in method.args %}{% if method.splat_index && i > method.splat_index %}{{arg.internal_name.stringify}}: {{arg.internal_name}}, {% end %}{% end %}
).merge({{method.double_splat}})
)
%call = ::Spectator::MethodCall.new({{method.name.symbolize}}, %args)
_spectator_record_call(%call)
@ -245,7 +247,9 @@ module Spectator
{% for arg, i in method.args %}{% if !method.splat_index || i < method.splat_index %}{{arg.internal_name.stringify}}: {{arg.internal_name}}, {% end %}{% end %}
),
{% if method.splat_index && (splat = method.args[method.splat_index].internal_name) %}{{splat.symbolize}}, {{splat}},{% end %}
{{method.double_splat}}
::NamedTuple.new(
{% for arg, i in method.args %}{% if method.splat_index && i > method.splat_index %}{{arg.internal_name.stringify}}: {{arg.internal_name}}, {% end %}{% end %}
).merge({{method.double_splat}})
)
%call = ::Spectator::MethodCall.new({{method.name.symbolize}}, %args)
_spectator_record_call(%call)