mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add enum for example status
This commit is contained in:
parent
64a233a9e1
commit
c27f72c83e
1 changed files with 59 additions and 0 deletions
59
src/spectator/example_status.cr
Normal file
59
src/spectator/example_status.cr
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
module Spectator
|
||||||
|
# Various outcomes that an example can be in.
|
||||||
|
enum ExampleStatus
|
||||||
|
# The example was intentionally not run.
|
||||||
|
# This is different than `Pending`.
|
||||||
|
# This value means the example was not pending
|
||||||
|
# and was not run due to filtering or other means.
|
||||||
|
Skipped,
|
||||||
|
|
||||||
|
# The example finished successfully.
|
||||||
|
Successful,
|
||||||
|
|
||||||
|
# The example ran, but failed.
|
||||||
|
Failed,
|
||||||
|
|
||||||
|
# An error occurred while executing the example.
|
||||||
|
Errored,
|
||||||
|
|
||||||
|
# The example is marked as pending and was not run.
|
||||||
|
Pending,
|
||||||
|
|
||||||
|
# The example finished successfully,
|
||||||
|
# but something may be wrong with it.
|
||||||
|
Warning
|
||||||
|
|
||||||
|
# Indicates whether an example was skipped.
|
||||||
|
def skipped?
|
||||||
|
self == Skipped
|
||||||
|
end
|
||||||
|
|
||||||
|
# Indicates that an example was run and it was successful.
|
||||||
|
# NOTE: Examples with warnings count as successful.
|
||||||
|
def successful?
|
||||||
|
!failed? && !pending?
|
||||||
|
end
|
||||||
|
|
||||||
|
# Indicates that an example was run, but it failed.
|
||||||
|
# Errors count as failures.
|
||||||
|
def failed?
|
||||||
|
self == Failed || errored?
|
||||||
|
end
|
||||||
|
|
||||||
|
# Indicates whether an error was encountered while running the example.
|
||||||
|
def errored?
|
||||||
|
self == Errored
|
||||||
|
end
|
||||||
|
|
||||||
|
# Indicates that an example was marked as pending.
|
||||||
|
def pending?
|
||||||
|
self == Pending
|
||||||
|
end
|
||||||
|
|
||||||
|
# Indicates that the example finished successfully,
|
||||||
|
# but something may be wrong with it.
|
||||||
|
def warning?
|
||||||
|
self == Warning
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue