mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-04 00:25:04 +00:00
Unit test library to simplify test writing
This commit is contained in:
1 parent
526c3d3a9b
commit
08a96e5fe1
7 files changed
+266
-33
No files matched your search
@@ -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