예제 #1
0
func (this *Assert) Bytes(value []byte) *BytesSubject {
	return &BytesSubject{
		Subject: Subject{
			disp: serial.BytesToHexString(value),
			a:    this,
		},
		value: value,
	}
}
예제 #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)
	}
}
예제 #3
0
func (subject *BytesSubject) NotEquals(expectation []byte) {
	if bytes.Equal(subject.value, expectation) {
		subject.Fail("is not equal to", serial.BytesToHexString(expectation))
	}
}