You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
v2ray-core/testing/unit/assertions.go

42 lines
889 B

package unit
import (
"testing"
)
// Assertion is an assertion library inspired by Truth.
// See http://google.github.io/truth/
type Assertion struct {
t *testing.T
}
func Assert(t *testing.T) *Assertion {
assert := new(Assertion)
assert.t = t
return assert
}
func (a *Assertion) Int(value int) *IntSubject {
return NewIntSubject(NewSubject(a), value)
}
func (a *Assertion) Uint16(value uint16) *Uint16Subject {
return NewUint16Subject(NewSubject(a), value)
}
func (a *Assertion) Byte(value byte) *ByteSubject {
return NewByteSubject(NewSubject(a), value)
}
func (a *Assertion) Bytes(value []byte) *BytesSubject {
return NewBytesSubject(NewSubject(a), value)
}
func (a *Assertion) String(value string) *StringSubject {
9 years ago
return NewStringSubject(NewSubject(a), value)
}
func (a *Assertion) Error(value error) *ErrorSubject {
9 years ago
return NewErrorSubject(NewSubject(a), value)
}