mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add more info to stub.to_s
This commit is contained in:
parent
c00d2fe4e6
commit
1093571fbd
3 changed files with 19 additions and 0 deletions
|
@ -20,6 +20,12 @@ module Spectator
|
|||
def initialize(method : Symbol, @exception : Exception, constraint : AbstractArguments? = nil, location : Location? = nil)
|
||||
super(method, constraint, location)
|
||||
end
|
||||
|
||||
# String representation of the stub, formatted as a method call.
|
||||
def to_s(io : IO) : Nil
|
||||
super
|
||||
io << " # raises " << @exception
|
||||
end
|
||||
end
|
||||
|
||||
module StubModifiers
|
||||
|
|
|
@ -9,5 +9,11 @@ module Spectator
|
|||
abstract class TypedStub(T) < Stub
|
||||
# Invokes the stubbed implementation.
|
||||
abstract def call(call : MethodCall) : T
|
||||
|
||||
# String representation of the stub, formatted as a method call.
|
||||
def to_s(io : IO) : Nil
|
||||
super
|
||||
io << " : " << T
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,6 +20,13 @@ module Spectator
|
|||
def initialize(method : Symbol, @value : T, constraint : AbstractArguments? = nil, location : Location? = nil)
|
||||
super(method, constraint, location)
|
||||
end
|
||||
|
||||
# String representation of the stub, formatted as a method call and return value.
|
||||
def to_s(io : IO) : Nil
|
||||
super
|
||||
io << " # => "
|
||||
@value.inspect(io)
|
||||
end
|
||||
end
|
||||
|
||||
module StubModifiers
|
||||
|
|
Loading…
Reference in a new issue