mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-11-18 17:41:34 -05:00
Unit test library to simplify test writing
This commit is contained in:
31
testing/unit/assertions.go
Normal file
31
testing/unit/assertions.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package unit
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user