mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Better formatting for empty arguments
This commit is contained in:
parent
ca827a3c52
commit
5ad29f486f
2 changed files with 10 additions and 0 deletions
|
@ -30,6 +30,14 @@ Spectator.describe Spectator::Arguments do
|
|||
it "formats the arguments" do
|
||||
is_expected.to eq("(42, \"foo\", bar: \"baz\", qux: 123)")
|
||||
end
|
||||
|
||||
context "when empty" do
|
||||
let(arguments) { Spectator::Arguments.empty }
|
||||
|
||||
it "returns (no args)" do
|
||||
is_expected.to eq("(no args)")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#==" do
|
||||
|
|
|
@ -29,6 +29,8 @@ module Spectator
|
|||
|
||||
# Constructs a string representation of the arguments.
|
||||
def to_s(io : IO) : Nil
|
||||
return io << "(no args)" if args.empty? && kwargs.empty?
|
||||
|
||||
io << '('
|
||||
|
||||
# Add the positional arguments.
|
||||
|
|
Loading…
Reference in a new issue