Skip to content

Commit

Permalink
Add skip and pass/fail predicate methods
Browse files Browse the repository at this point in the history
  • Loading branch information
icy-arctic-fox committed Jun 24, 2024
1 parent 4fb6df6 commit 9a3b0e0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/spectator/core/result.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ module Spectator::Core
Pass
Fail
Error
Skip
end

# Information detailing the outcome of running an example.
struct Result
# The status of the example.
getter status : Status

# The exception that caused the example to fail.
# This will be nil if the example passed or was skipped.
getter! exception : Exception

def initialize(@status : Status, @exception = nil)
Expand All @@ -21,5 +26,13 @@ module Spectator::Core
new(:error, ex)
end
end

def pass?
@status.pass?
end

def fail?
!@status.pass? && !@status.skip?
end
end
end

0 comments on commit 9a3b0e0

Please sign in to comment.