From f7e3ed13f933111cf6920fd74ba25ebd72a2f870 Mon Sep 17 00:00:00 2001 From: Makpoc Date: Thu, 15 Oct 2015 02:21:02 +0300 Subject: [PATCH] TestInclude 2 should fail. Update test data and fix error checking --- middleware/context_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/middleware/context_test.go b/middleware/context_test.go index 5d221a34..456c7e36 100644 --- a/middleware/context_test.go +++ b/middleware/context_test.go @@ -46,7 +46,7 @@ func TestInclude(t *testing.T) { { fileContent: `str1 {{ .InvalidField }} str2`, expectedContent: "", - shouldErr: false, + shouldErr: true, expectedErrorContent: `InvalidField is not a field of struct type middleware.Context`, }, } @@ -62,6 +62,9 @@ func TestInclude(t *testing.T) { content, err := context.Include(inputFilename) if err != nil { + if !test.shouldErr { + t.Errorf(testPrefix+"Expected no error, found [%s]", test.expectedErrorContent, err.Error()) + } if !strings.Contains(err.Error(), test.expectedErrorContent) { t.Errorf(testPrefix+"Expected error content [%s], found [%s]", test.expectedErrorContent, err.Error()) }