From 0857fdb0f81bbec8f338300e15da2206c3bf408f Mon Sep 17 00:00:00 2001 From: v2ray Date: Sun, 24 Jul 2016 13:40:27 +0200 Subject: [PATCH] test code for blackhole config --- proxy/blackhole/config_json_test.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 proxy/blackhole/config_json_test.go diff --git a/proxy/blackhole/config_json_test.go b/proxy/blackhole/config_json_test.go new file mode 100644 index 000000000..a61537eaa --- /dev/null +++ b/proxy/blackhole/config_json_test.go @@ -0,0 +1,25 @@ +package blackhole_test + +import ( + "encoding/json" + "testing" + + . "github.com/v2ray/v2ray-core/proxy/blackhole" + "github.com/v2ray/v2ray-core/testing/assert" +) + +func TestHTTPResponseJSON(t *testing.T) { + assert := assert.On(t) + + rawJson := `{ + "response": { + "type": "http" + } + }` + config := new(Config) + err := json.Unmarshal([]byte(rawJson), config) + assert.Error(err).IsNil() + + _, ok := config.Response.(*HTTPResponse) + assert.Bool(ok).IsTrue() +}