mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Merge branch 'exception-matcher-args-fix' into 'master'
Exception matcher args fix Closes #4 See merge request arctic-fox/spectator!1
This commit is contained in:
commit
e4ec47f413
3 changed files with 7 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
name: spectator
|
||||
version: 0.5.2
|
||||
version: 0.5.3
|
||||
description: |
|
||||
A feature-rich spec testing framework for Crystal with similarities to RSpec.
|
||||
|
||||
|
|
|
@ -517,7 +517,7 @@ module Spectator::DSL
|
|||
# expect { raise ArgumentError.new("foobar") }.to raise_error(ArgumentError, "foobar")
|
||||
# ```
|
||||
macro raise_error(type, message)
|
||||
::Spectator::Matchers::ExceptionMatcher.new({{type}}, {{message}}, {{message.stringify}})
|
||||
::Spectator::Matchers::ExceptionMatcher.create({{type}}, {{message}}, {{message.stringify}})
|
||||
end
|
||||
|
||||
# Indicates that some block should raise an error.
|
||||
|
|
|
@ -57,6 +57,11 @@ module Spectator::Matchers
|
|||
ExceptionMatcher(Exception, typeof(expected)).new(expected, label)
|
||||
end
|
||||
|
||||
# Creates a new exception matcher with a type and message check.
|
||||
def self.create(exception_type : T.class, expected, label : String) forall T
|
||||
ExceptionMatcher(T, typeof(expected)).new(expected, label)
|
||||
end
|
||||
|
||||
# Match data specific to this matcher.
|
||||
private struct MatchData(ExceptionType, ExpectedType, ActualType) < MatchData
|
||||
# Creates the match data.
|
||||
|
|
Loading…
Reference in a new issue