How about if we define a constant (global only to Nimble):
let Nil: NilLiteralType = NilLiteral()
where NilLiteralType and NilLiteral are defined as:
protocol NilLiteralType {}
struct NilLiteral: NilLiteralType {}
and override the equality operators:
func ==<T>(lhs: Expectation<T>, nilLiteral: NilLiteralType)
{
lhs.to(beNil())
}
func !=<T>(lhs: Expectation<T>, nilLiteral: NilLiteralType)
{
lhs.toNot(beNil())
}
so that expressions like the following are possible:
expect(foo) == Nil
expect(bar) != Nil
I can create a PR if you don't think this is a stupid idea.
How about if we define a constant (global only to Nimble):
where
NilLiteralTypeandNilLiteralare defined as:and override the equality operators:
so that expressions like the following are possible:
I can create a PR if you don't think this is a stupid idea.