class Sus::Expect

def and(predicate)

def and(predicate)
	return to(predicate)
end

def initialize(assertions, subject, inverted: false, distinct: false)

def initialize(assertions, subject, inverted: false, distinct: false)
	@assertions = assertions
	@subject = subject
	
	# We capture this here, as changes to state may cause the inspect output to change, affecting the output produced by #print.
	@inspect = @subject.inspect
	
	@inverted = inverted
	@distinct = true
end

def not

def not
	self.dup.tap do |expect|
		expect.instance_variable_set(:@inverted, !@inverted)
	end
end

def print(output)

def print(output)
	output.write("expect ", :variable, @inspect, :reset, " ")
	
	if @inverted
		output.write("not to", :reset)
	else
		output.write("to", :reset)
	end
end

def to(predicate)

def to(predicate)
	# This gets the identity scoped to the current call stack, which ensures that any failures are logged at this point in the code.
	identity = @assertions.identity&.scoped
	
	@assertions.nested(self, inverted: @inverted, identity: identity, distinct: @distinct) do |assertions|
		predicate.call(assertions, @subject)
	end
	
	return self
end