Example #1
0
func (this *Assert) Bytes(value []byte) *BytesSubject {
	return &BytesSubject{
		Subject: Subject{
			disp: serial.BytesToHexString(value),
			a:    this,
		},
		value: value,
	}
}
Example #2
0
func InterfaceToString(value interface{}) string {
	if value == nil {
		return " "
	}
	switch value := value.(type) {
	case string:
		return value
	case *string:
		return *value
	case fmt.Stringer:
		return value.String()
	case error:
		return value.Error()
	case []byte:
		return serial.BytesToHexString(value)
	default:
		return fmt.Sprint(value)
	}
}
Example #3
0
func (subject *BytesSubject) NotEquals(expectation []byte) {
	if bytes.Equal(subject.value, expectation) {
		subject.Fail("is not equal to", serial.BytesToHexString(expectation))
	}
}