0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00

TestInclude 2 should fail. Update test data and fix error checking

This commit is contained in:
Makpoc 2015-10-15 02:21:02 +03:00
parent 71c4962ff6
commit f7e3ed13f9

View file

@ -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())
}