module Sus::Output::Messages

def assert(condition, orientation, message, backtrace)

@parameter backtrace [Array] The backtrace to display.
@parameter message [String] The message to display.
@parameter orientation [Boolean] The orientation of the assertions.
@parameter condition [Boolean] The result of the test.

Otherwise, it is a failed outcome.
If the orientation is false, and the test failed, then it is a successful outcome.
If the orientation is true, and the test passed, then it is a successful outcome.
def assert(condition, orientation, message, backtrace)
	if condition
		self.puts(:indent, *pass_prefix(orientation), message, backtrace)
	else
		self.puts(:indent, *fail_prefix(orientation), message, backtrace)
	end
end

def error(error, identity, prefix = error_prefix)

def error(error, identity, prefix = error_prefix)
	lines = error.message.split(/\r?\n/)

	self.puts(:indent, *prefix, error.class, ": ", lines.shift)
	
	lines.each do |line|
		self.puts(:indent, line)
	end
		
	self.write(Output::Backtrace.for(error, identity))
	
	if cause = error.cause
		self.error(cause, identity, ["Caused by ", :errored])
	end
end

def error_prefix

def error_prefix
	[:errored, "⚠ "]
end

def fail_prefix(orientation)

def fail_prefix(orientation)
	if orientation
		FAILED_PREFIX
	else
		PASSED_PREFIX
	end
end

def inform(message, identity)

def inform(message, identity)
	self.puts(:indent, :inform, inform_prefix, message)
end

def inform_prefix

def inform_prefix
	"ℹ "
end

def pass_prefix(orientation)

def pass_prefix(orientation)
	if orientation
		PASSED_PREFIX
	else
		FAILED_PREFIX
	end
end

def skip(reason, identity)

def skip(reason, identity)
	self.puts(:indent, :skipped, skip_prefix, reason)
end

def skip_prefix

def skip_prefix
	"⏸ "
end