1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-10-31 00:08:08 -04:00
v2fly/common/protocol/headers_test.go

35 lines
870 B
Go
Raw Normal View History

2016-06-02 15:34:25 -04:00
package protocol_test
import (
"testing"
2016-08-20 14:55:45 -04:00
. "v2ray.com/core/common/protocol"
"v2ray.com/core/testing/assert"
2016-06-02 15:34:25 -04:00
)
func TestRequestOptionSet(t *testing.T) {
assert := assert.On(t)
2016-06-02 15:48:49 -04:00
var option RequestOption
2016-06-02 15:34:25 -04:00
assert.Bool(option.Has(RequestOptionChunkStream)).IsFalse()
option.Set(RequestOptionChunkStream)
assert.Bool(option.Has(RequestOptionChunkStream)).IsTrue()
option.Set(RequestOptionChunkMasking)
assert.Bool(option.Has(RequestOptionChunkMasking)).IsTrue()
2016-06-02 15:34:25 -04:00
assert.Bool(option.Has(RequestOptionChunkStream)).IsTrue()
}
func TestRequestOptionClear(t *testing.T) {
assert := assert.On(t)
2016-06-02 15:48:49 -04:00
var option RequestOption
2016-06-02 15:34:25 -04:00
option.Set(RequestOptionChunkStream)
option.Set(RequestOptionChunkMasking)
2016-06-02 15:34:25 -04:00
option.Clear(RequestOptionChunkStream)
assert.Bool(option.Has(RequestOptionChunkStream)).IsFalse()
assert.Bool(option.Has(RequestOptionChunkMasking)).IsTrue()
2016-06-02 15:34:25 -04:00
}