From 27875631d365553b129b54f30ea0c41bb3112192 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sat, 17 Oct 2020 11:51:16 -0600 Subject: [PATCH] Mostly implement inspect method --- src/spectator/example.cr | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/spectator/example.cr b/src/spectator/example.cr index 04fbdb0..eb6dda1 100644 --- a/src/spectator/example.cr +++ b/src/spectator/example.cr @@ -11,6 +11,7 @@ module Spectator getter? finished : Bool = false # Retrieves the result of the last time the example ran. + # TODO: Make result not nil and default to pending. getter! result : Result # Creates the example. @@ -35,7 +36,18 @@ module Spectator # Exposes information about the example useful for debugging. def inspect(io) - raise NotImplementedError.new("#inspect") + # Full example name. + io << '"' + to_s(io) + io << '"' + + # Add source if it's available. + if (s = source) + io << " @ " + io << s + end + + # TODO: Add result. end end end