Skip to content

Commit

Permalink
Merge branch 'master' into fix-gomod-version-dir
Browse files Browse the repository at this point in the history
  • Loading branch information
at-wat committed Mar 8, 2019
2 parents 08e5433 + ee148b6 commit 4d46f5e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions v2/awsiotprotocol/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package awsiotprotocol

import (
"strings"
"testing"
)

Expand All @@ -33,3 +34,21 @@ func TestByURL(t *testing.T) {
}
}
}

func TestByURLFailure(t *testing.T) {
testcase := []struct {
input string
expectedErrorMessage string
}{
{input: "@@://@@@/@@.@@@", expectedErrorMessage: "parse @@://@@@/@@.@@@: "},
{input: "https://non-supported.protocol.com", expectedErrorMessage: "Protocol \"https\" is not supported"},
}
for _, v := range testcase {
_, err := ByURL(v.input)
if err == nil {
t.Errorf("awsiotprotocol.ByURL should fail with invalid input.\ninput: %#v", v.input)
} else if !strings.Contains(err.Error(), v.expectedErrorMessage) {
t.Errorf("awsiotprotocol.ByURL should fail with error message which contains the following:\ninput: %#v\nexpected error message: %#v\nactual error message: %#v", v.input, v.expectedErrorMessage, err.Error())
}
}
}

0 comments on commit 4d46f5e

Please sign in to comment.