mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 09:36:34 -05:00
Test case for capability
This commit is contained in:
parent
6a2df21727
commit
e859ac1d5d
@ -16,7 +16,7 @@ type listCapabilities struct {
|
||||
data []Capability
|
||||
}
|
||||
|
||||
func NewCapabilites() Capabilities {
|
||||
func NewCapabilities() Capabilities {
|
||||
return &listCapabilities{
|
||||
data: make([]Capability, 0, 16),
|
||||
}
|
||||
|
21
capability_test.go
Normal file
21
capability_test.go
Normal file
@ -0,0 +1,21 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/v2ray/v2ray-core/testing/unit"
|
||||
)
|
||||
|
||||
func TestCapabilities(t *testing.T) {
|
||||
assert := unit.Assert(t)
|
||||
|
||||
caps := NewCapabilities()
|
||||
assert.Bool(caps.HasCapability(TCPConnection)).IsFalse()
|
||||
|
||||
caps.AddCapability(TCPConnection)
|
||||
assert.Bool(caps.HasCapability(TCPConnection)).IsTrue()
|
||||
|
||||
caps.AddCapability(UDPConnection)
|
||||
assert.Bool(caps.HasCapability(TCPConnection)).IsTrue()
|
||||
assert.Bool(caps.HasCapability(UDPConnection)).IsTrue()
|
||||
}
|
Loading…
Reference in New Issue
Block a user