mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add dummy match data
Apparently the abstract bug pops up again when there are no tests.
This commit is contained in:
parent
31d58fea25
commit
165178237c
1 changed files with 32 additions and 0 deletions
32
src/spectator/matchers/dummy_match_data.cr
Normal file
32
src/spectator/matchers/dummy_match_data.cr
Normal file
|
@ -0,0 +1,32 @@
|
|||
module Spectator::Matchers
|
||||
# Match data that does nothing.
|
||||
# This is to workaround a Crystal compiler bug.
|
||||
# See: [Issue 4225](https://github.com/crystal-lang/crystal/issues/4225)
|
||||
# If there are no concrete implementations of an abstract class,
|
||||
# the compiler gives an error.
|
||||
# The error indicates an abstract method is undefined.
|
||||
# This class shouldn't be used, it's just to trick the compiler.
|
||||
private struct DummyMatchData < MatchData
|
||||
# Creates the match data.
|
||||
def initialize
|
||||
super(false)
|
||||
end
|
||||
|
||||
# Dummy values.
|
||||
def named_tuple
|
||||
{
|
||||
you: "shouldn't be calling this."
|
||||
}
|
||||
end
|
||||
|
||||
# Dummy message.
|
||||
def message
|
||||
"You shouldn't be calling this."
|
||||
end
|
||||
|
||||
# Dummy message
|
||||
def negated_message
|
||||
"You shouldn't be calling this."
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue