1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-21 09:36:34 -05:00
v2fly/testing/unit/assertions.go

54 lines
1.2 KiB
Go
Raw Normal View History

package unit
import (
"testing"
)
2015-09-09 09:18:29 -04:00
// 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
}
2015-09-16 18:15:06 -04:00
func (a *Assertion) Int64(value int64) *Int64Subject {
return NewInt64Subject(NewSubject(a), value)
}
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)
}
2015-09-09 09:18:29 -04:00
func (a *Assertion) String(value string) *StringSubject {
2015-09-09 09:26:11 -04:00
return NewStringSubject(NewSubject(a), value)
2015-09-09 09:18:29 -04:00
}
func (a *Assertion) Error(value error) *ErrorSubject {
2015-09-09 09:26:11 -04:00
return NewErrorSubject(NewSubject(a), value)
2015-09-09 09:18:29 -04:00
}
2015-09-16 11:29:00 -04:00
func (a *Assertion) Bool(value bool) *BoolSubject {
return NewBoolSubject(NewSubject(a), value)
}
2015-09-20 05:45:40 -04:00
func (a *Assertion) Pointer(value interface{}) *PointerSubject {
return NewPointerSubject(NewSubject(a), value)
}