Pretify stub and call output

Fix some tests.
This commit is contained in:
Michael Miller 2022-07-12 17:47:05 -06:00
parent 36cc035417
commit d7ea969f55
No known key found for this signature in database
GPG key ID: 32B47AE8F388A1FF
3 changed files with 29 additions and 15 deletions

View file

@ -71,13 +71,16 @@ module Spectator::Matchers
private def values(actual : Expression(T)) forall T
{
expected: @stub.to_s,
actual: actual.value._spectator_calls.inspect,
actual: actual.value._spectator_calls.join("\n"),
}
end
# Additional information about the match failure when negated.
private def negated_values(actual : Expression(T)) forall T
values(actual)
{
expected: "Not #{@stub}",
actual: actual.value._spectator_calls.join("\n"),
}
end
end
end

View file

@ -29,5 +29,10 @@ module Spectator
constraint === call.arguments
end
# String representation of the stub, formatted as a method call.
def to_s(io : IO) : Nil
io << "#" << method << (constraint || "(any args)")
end
end
end