function Expectation.new(H)local o={value=H,successCondition=true,condition=false}setmetatable(o,Expectation)o.a=bindSelf(o,o.a)o.an=o.a o.ok=bindSelf(o,o.ok)o.equal=bindSelf(o,o.equal)o.throw=bindSelf(o,o.throw)o.near=bindSelf(o,o.near)return o end function Expectation.__index(H,o)if SELF_KEYS[o]then return H end if NEGATION_KEYS[o]then local o=Expectation.new(H.value)o.successCondition=not H.successCondition return o end return Expectation[o]end
--[[
	Create a new expectation
]]
function Expectation.new(value)
	local self = {
		value = value,
		successCondition = true,
		condition = false,
	}

	setmetatable(self, Expectation)

	self.a = bindSelf(self, self.a)
	self.an = self.a
	self.ok = bindSelf(self, self.ok)
	self.equal = bindSelf(self, self.equal)
	self.throw = bindSelf(self, self.throw)
	self.near = bindSelf(self, self.near)

	return self
end

function Expectation.__index(self, key)
	-- Keys that don't do anything except improve readability
	if SELF_KEYS[key] then
		return self
	end

	-- Invert your assertion
	if NEGATION_KEYS[key] then
		local newExpectation = Expectation.new(self.value)
		newExpectation.successCondition = not self.successCondition

		return newExpectation
	end

	-- Fall back to methods provided by Expectation
	return Expectation[key]
end
