mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Hide splat label in certain situations
Undefined double methods were reporting splat arguments, which is technically correct. But for output in these cases, it makes more sense to show the exact calling args.
This commit is contained in:
parent
8959d28b38
commit
c77da67341
2 changed files with 11 additions and 3 deletions
|
@ -97,6 +97,14 @@ Spectator.describe Spectator::Arguments do
|
|||
is_expected.to eq("(no args)")
|
||||
end
|
||||
end
|
||||
|
||||
context "with a splat and no arguments" do
|
||||
let(arguments) { Spectator::Arguments.build(NamedTuple.new, :splat, {:x, :y, :z}, {bar: "baz", qux: 123}) }
|
||||
|
||||
it "omits the splat name" do
|
||||
is_expected.to eq("(:x, :y, :z, bar: \"baz\", qux: 123)")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#==" do
|
||||
|
|
|
@ -107,14 +107,14 @@ module Spectator
|
|||
# Add the splat arguments.
|
||||
if (splat = @splat) && !splat.empty?
|
||||
io << ", " unless args.empty?
|
||||
if name = @splat_name
|
||||
io << '*' << name << ": {"
|
||||
if splat_name = !args.empty? && @splat_name
|
||||
io << '*' << splat_name << ": {"
|
||||
end
|
||||
splat.each_with_index do |arg, i|
|
||||
io << ", " if i > 0
|
||||
arg.inspect(io)
|
||||
end
|
||||
io << '}' if @splat_name
|
||||
io << '}' if splat_name
|
||||
end
|
||||
|
||||
# Add the keyword arguments.
|
||||
|
|
Loading…
Reference in a new issue