From 3a40fa67e10eb9ac61e3d263db458b963c203385 Mon Sep 17 00:00:00 2001 From: v2ray Date: Thu, 4 Feb 2016 21:31:18 +0100 Subject: [PATCH] test case for timed io --- common/net/timed_io_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 common/net/timed_io_test.go diff --git a/common/net/timed_io_test.go b/common/net/timed_io_test.go new file mode 100644 index 000000000..ecf8fed81 --- /dev/null +++ b/common/net/timed_io_test.go @@ -0,0 +1,20 @@ +package net_test + +import ( + "testing" + + . "github.com/v2ray/v2ray-core/common/net" + v2testing "github.com/v2ray/v2ray-core/testing" + "github.com/v2ray/v2ray-core/testing/assert" +) + +func TestTimeOutSettings(t *testing.T) { + v2testing.Current(t) + + reader := NewTimeOutReader(8, nil) + assert.Int(reader.GetTimeOut()).Equals(8) + reader.SetTimeOut(8) // no op + assert.Int(reader.GetTimeOut()).Equals(8) + reader.SetTimeOut(9) + assert.Int(reader.GetTimeOut()).Equals(9) +}