mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Clean up expectation specs
Removed tests that are no longer valid or non-trivial to update.
This commit is contained in:
parent
251e3b8774
commit
a54e406fec
5 changed files with 34 additions and 458 deletions
|
@ -1,30 +1,38 @@
|
|||
# Utility methods for creating expectations, partials, and matchers.
|
||||
|
||||
def new_partial(actual : T, label : String) forall T
|
||||
Spectator::Expectations::ValueExpectationPartial.new(actual, label, __FILE__, __LINE__)
|
||||
test_value = Spectator::TestValue.new(actual, label)
|
||||
source = Spectator::Source.new(__FILE__, __LINE__)
|
||||
Spectator::Expectations::ExpectationPartial.new(test_value, source)
|
||||
end
|
||||
|
||||
def new_partial(actual : T = 123) forall T
|
||||
Spectator::Expectations::ValueExpectationPartial.new(actual, __FILE__, __LINE__)
|
||||
test_value = Spectator::TestValue.new(actual)
|
||||
source = Spectator::Source.new(__FILE__, __LINE__)
|
||||
Spectator::Expectations::ExpectationPartial.new(test_value, source)
|
||||
end
|
||||
|
||||
def new_block_partial(label = "BLOCK", &block)
|
||||
Spectator::Expectations::BlockExpectationPartial.new(block, label, __FILE__, __LINE__)
|
||||
test_block = Spectator::TestBlock.new(block, label)
|
||||
source = Spectator::Source.new(__FILE__, __LINE__)
|
||||
Spectator::Expectations::ExpectationPartial.new(test_block, source)
|
||||
end
|
||||
|
||||
def new_matcher(expected : T, label : String) forall T
|
||||
Spectator::Matchers::EqualityMatcher.new(expected, label)
|
||||
test_value = Spectator::TestValue.new(expected, label)
|
||||
Spectator::Matchers::EqualityMatcher.new(test_value)
|
||||
end
|
||||
|
||||
def new_matcher(expected : T = 123) forall T
|
||||
Spectator::Matchers::EqualityMatcher.new(expected)
|
||||
test_value = Spectator::TestValue.new(expected)
|
||||
Spectator::Matchers::EqualityMatcher.new(test_value)
|
||||
end
|
||||
|
||||
def new_expectation(expected : ExpectedType = 123, actual : ActualType = 123) forall ExpectedType, ActualType
|
||||
partial = new_partial(actual, "foo")
|
||||
matcher = new_matcher(expected, "bar")
|
||||
match_data = matcher.match(partial)
|
||||
Spectator::Expectations::Expectation.new(match_data, false)
|
||||
match_data = matcher.match(partial.actual)
|
||||
Spectator::Expectations::Expectation.new(match_data, partial.source)
|
||||
end
|
||||
|
||||
def new_satisfied_expectation(value : T = 123) forall T
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue