mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Workaround for strange compiler error
This commit is contained in:
parent
26187a0f31
commit
b855599ce6
1 changed files with 30 additions and 0 deletions
30
src/spectator/matchers/dummy_match_data.cr
Normal file
30
src/spectator/matchers/dummy_match_data.cr
Normal file
|
@ -0,0 +1,30 @@
|
|||
require "./match_data"
|
||||
|
||||
module Spectator::Matchers
|
||||
# Match data that does nothing useful.
|
||||
# This is a workaround for a compilation issue - hopefully temporary.
|
||||
# This might be the same issue that `DummyExample` solves.
|
||||
# Without this, the Crystal compiler complains:
|
||||
# ```text
|
||||
# undefined method 'Spectator::Matchers::MatchData#message()'
|
||||
# ```
|
||||
# The method is clearly defined by `MatchData`, just abstract.
|
||||
# Additionally, there are implementations of `MatchData` -
|
||||
# see `NilMatcher::MatchData`.
|
||||
private struct DummyMatchData < MatchData
|
||||
# Dummy values.
|
||||
def values
|
||||
{expected: nil, actual: nil}
|
||||
end
|
||||
|
||||
# Dummy message.
|
||||
def message
|
||||
"DUMMY"
|
||||
end
|
||||
|
||||
# Dummy message.
|
||||
def negated_message
|
||||
"DUMMY"
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue