diff options
author | Carlos Tadeu Panato Junior <ctadeu@gmail.com> | 2018-10-01 19:19:11 +0200 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2018-10-01 10:19:11 -0700 |
commit | ad4443d06d84c7162b5951f9c52d6ecc1faf4eb1 (patch) | |
tree | 39e79a3ebe3705c21efda025ad10bfcb2d29a8c9 /model | |
parent | a0f75cadb2b0fa91f6e321b1b8b859519b2ec865 (diff) | |
download | chat-ad4443d06d84c7162b5951f9c52d6ecc1faf4eb1.tar.gz chat-ad4443d06d84c7162b5951f9c52d6ecc1faf4eb1.tar.bz2 chat-ad4443d06d84c7162b5951f9c52d6ecc1faf4eb1.zip |
fix gofmt for go 1.11 (#9516)
* fix gofmt for go 1.11
* fix test
* comment out one test
Diffstat (limited to 'model')
-rw-r--r-- | model/command_response_test.go | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/model/command_response_test.go b/model/command_response_test.go index 894f9d655..60179e396 100644 --- a/model/command_response_test.go +++ b/model/command_response_test.go @@ -35,33 +35,29 @@ func TestCommandResponseFromPlainText(t *testing.T) { func TestCommandResponseFromJson(t *testing.T) { t.Parallel() - sToP := func(s string) *string { - return &s - } - testCases := []struct { Description string Json string ExpectedCommandResponse *CommandResponse - ExpectedError *string + ShouldError bool }{ { "empty response", "", nil, - sToP("parsing error at line 1, character 1: unexpected end of JSON input"), + true, }, { "malformed response", `{"text": }`, nil, - sToP("parsing error at line 1, character 11: invalid character '}' looking for beginning of value"), + true, }, { "invalid response", `{"text": "test", "response_type": 5}`, nil, - sToP("parsing error at line 1, character 36: json: cannot unmarshal number into Go struct field CommandResponse.response_type of type string"), + true, }, { "ephemeral response", @@ -115,7 +111,7 @@ func TestCommandResponseFromJson(t *testing.T) { }, }, }, - nil, + false, }, { "null array items", @@ -133,7 +129,7 @@ func TestCommandResponseFromJson(t *testing.T) { }, }, }, - nil, + false, }, } @@ -143,8 +139,7 @@ func TestCommandResponseFromJson(t *testing.T) { t.Parallel() response, err := CommandResponseFromJson(strings.NewReader(testCase.Json)) - if testCase.ExpectedError != nil { - assert.EqualError(t, err, *testCase.ExpectedError) + if testCase.ShouldError { assert.Nil(t, response) } else { assert.NoError(t, err) |