mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Remove unnecessary free variables
This commit is contained in:
parent
3c94d1f8fd
commit
72e4ac8fe9
8 changed files with 20 additions and 20 deletions
|
@ -113,7 +113,7 @@ module Spectator::DSL
|
||||||
{% end %}
|
{% end %}
|
||||||
end
|
end
|
||||||
|
|
||||||
def allow(thing : T) forall T
|
def allow(thing)
|
||||||
Mocks::Allow.new(thing)
|
Mocks::Allow.new(thing)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ module Spectator::Formatting
|
||||||
end
|
end
|
||||||
|
|
||||||
# Creates a colorized version of the comment.
|
# Creates a colorized version of the comment.
|
||||||
def self.color(text : T) forall T
|
def self.color(text)
|
||||||
Color.comment(new(text))
|
Color.comment(new(text))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -63,12 +63,12 @@ module Spectator::Matchers
|
||||||
end
|
end
|
||||||
|
|
||||||
# Specifies what the resulting value of the expression must be.
|
# Specifies what the resulting value of the expression must be.
|
||||||
def to(value : T) forall T
|
def to(value)
|
||||||
ChangeExactMatcher.new(@expression, @expected, value)
|
ChangeExactMatcher.new(@expression, @expected, value)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Specifies what the resulting value of the expression should change by.
|
# Specifies what the resulting value of the expression should change by.
|
||||||
def by(amount : T) forall T
|
def by(amount)
|
||||||
ChangeExactMatcher.new(@expression, @expected, @expected + value)
|
ChangeExactMatcher.new(@expression, @expected, @expected + value)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -49,27 +49,27 @@ module Spectator::Matchers
|
||||||
end
|
end
|
||||||
|
|
||||||
# Specifies what the initial value of the expression must be.
|
# Specifies what the initial value of the expression must be.
|
||||||
def from(value : T) forall T
|
def from(value)
|
||||||
ChangeFromMatcher.new(@expression, value)
|
ChangeFromMatcher.new(@expression, value)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Specifies what the resulting value of the expression must be.
|
# Specifies what the resulting value of the expression must be.
|
||||||
def to(value : T) forall T
|
def to(value)
|
||||||
ChangeToMatcher.new(@expression, value)
|
ChangeToMatcher.new(@expression, value)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Specifies that t he resulting value must be some amount different.
|
# Specifies that t he resulting value must be some amount different.
|
||||||
def by(amount : T) forall T
|
def by(amount)
|
||||||
ChangeRelativeMatcher.new(@expression, "by #{amount}") { |before, after| amount == after - before }
|
ChangeRelativeMatcher.new(@expression, "by #{amount}") { |before, after| amount == after - before }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Specifies that the resulting value must be at least some amount different.
|
# Specifies that the resulting value must be at least some amount different.
|
||||||
def by_at_least(minimum : T) forall T
|
def by_at_least(minimum)
|
||||||
ChangeRelativeMatcher.new(@expression, "by at least #{minimum}") { |before, after| minimum <= after - before }
|
ChangeRelativeMatcher.new(@expression, "by at least #{minimum}") { |before, after| minimum <= after - before }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Specifies that the resulting value must be at most some amount different.
|
# Specifies that the resulting value must be at most some amount different.
|
||||||
def by_at_most(maximum : T) forall T
|
def by_at_most(maximum)
|
||||||
ChangeRelativeMatcher.new(@expression, "by at most #{maximum}") { |before, after| maximum >= after - before }
|
ChangeRelativeMatcher.new(@expression, "by at most #{maximum}") { |before, after| maximum >= after - before }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -57,12 +57,12 @@ module Spectator::Matchers
|
||||||
end
|
end
|
||||||
|
|
||||||
# Specifies what the initial value of the expression must be.
|
# Specifies what the initial value of the expression must be.
|
||||||
def from(value : T) forall T
|
def from(value)
|
||||||
ChangeExactMatcher.new(@expression, value, @expected)
|
ChangeExactMatcher.new(@expression, value, @expected)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Specifies how much the initial value should change by.
|
# Specifies how much the initial value should change by.
|
||||||
def by(amount : T) forall T
|
def by(amount)
|
||||||
ChangeExactMatcher.new(@expression, @expected - amount, @expected)
|
ChangeExactMatcher.new(@expression, @expected - amount, @expected)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ module Spectator::Matchers
|
||||||
# ```
|
# ```
|
||||||
# expect(0).to be < 1
|
# expect(0).to be < 1
|
||||||
# ```
|
# ```
|
||||||
def <(value : ExpectedType) forall ExpectedType
|
def <(value)
|
||||||
expected = TestValue.new(value)
|
expected = TestValue.new(value)
|
||||||
LessThanMatcher.new(expected)
|
LessThanMatcher.new(expected)
|
||||||
end
|
end
|
||||||
|
@ -37,7 +37,7 @@ module Spectator::Matchers
|
||||||
# ```
|
# ```
|
||||||
# expect(0).to be <= 1
|
# expect(0).to be <= 1
|
||||||
# ```
|
# ```
|
||||||
def <=(value : ExpectedType) forall ExpectedType
|
def <=(value)
|
||||||
expected = TestValue.new(value)
|
expected = TestValue.new(value)
|
||||||
LessThanEqualMatcher.new(expected)
|
LessThanEqualMatcher.new(expected)
|
||||||
end
|
end
|
||||||
|
@ -47,7 +47,7 @@ module Spectator::Matchers
|
||||||
# ```
|
# ```
|
||||||
# expect(2).to be > 1
|
# expect(2).to be > 1
|
||||||
# ```
|
# ```
|
||||||
def >(value : ExpectedType) forall ExpectedType
|
def >(value)
|
||||||
expected = TestValue.new(value)
|
expected = TestValue.new(value)
|
||||||
GreaterThanMatcher.new(expected)
|
GreaterThanMatcher.new(expected)
|
||||||
end
|
end
|
||||||
|
@ -57,7 +57,7 @@ module Spectator::Matchers
|
||||||
# ```
|
# ```
|
||||||
# expect(2).to be >= 1
|
# expect(2).to be >= 1
|
||||||
# ```
|
# ```
|
||||||
def >=(value : ExpectedType) forall ExpectedType
|
def >=(value)
|
||||||
expected = TestValue.new(value)
|
expected = TestValue.new(value)
|
||||||
GreaterThanEqualMatcher.new(expected)
|
GreaterThanEqualMatcher.new(expected)
|
||||||
end
|
end
|
||||||
|
@ -67,7 +67,7 @@ module Spectator::Matchers
|
||||||
# ```
|
# ```
|
||||||
# expect(0).to be == 0
|
# expect(0).to be == 0
|
||||||
# ```
|
# ```
|
||||||
def ==(value : ExpectedType) forall ExpectedType
|
def ==(value)
|
||||||
expected = TestValue.new(value)
|
expected = TestValue.new(value)
|
||||||
EqualityMatcher.new(expected)
|
EqualityMatcher.new(expected)
|
||||||
end
|
end
|
||||||
|
@ -77,7 +77,7 @@ module Spectator::Matchers
|
||||||
# ```
|
# ```
|
||||||
# expect(0).to be != 1
|
# expect(0).to be != 1
|
||||||
# ```
|
# ```
|
||||||
def !=(value : ExpectedType) forall ExpectedType
|
def !=(value)
|
||||||
expected = TestValue.new(value)
|
expected = TestValue.new(value)
|
||||||
InequalityMatcher.new(expected)
|
InequalityMatcher.new(expected)
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@ module Spectator::Mocks
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def and_return(value : T) forall T
|
def and_return(value)
|
||||||
ValueMethodStub.new(@name, @source, value, @args)
|
ValueMethodStub.new(@name, @source, value, @args)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@ module Spectator
|
||||||
# Adds a new value by duplicating the current set and adding to it.
|
# Adds a new value by duplicating the current set and adding to it.
|
||||||
# The new sample values with the additional value is returned.
|
# The new sample values with the additional value is returned.
|
||||||
# The original set of sample values is not modified.
|
# The original set of sample values is not modified.
|
||||||
def add(id : Symbol, name : String, value : T) : TestValues forall T
|
def add(id : Symbol, name : String, value) : TestValues
|
||||||
wrapper = TypedValueWrapper(T).new(value)
|
wrapper = TypedValueWrapper.new(value)
|
||||||
TestValues.new(@values.merge({
|
TestValues.new(@values.merge({
|
||||||
id => Entry.new(name, wrapper),
|
id => Entry.new(name, wrapper),
|
||||||
}))
|
}))
|
||||||
|
|
Loading…
Reference in a new issue