ids: Add test for ID.FromString errors

This commit is contained in:
Alex Willmer 2020-04-01 18:51:01 +01:00
parent e8c6188b27
commit 8a2d8a6f94
1 changed files with 18 additions and 0 deletions

View File

@ -79,3 +79,21 @@ func TestFromString(t *testing.T) {
t.Fatal("Expected FromString to be inverse of String but it wasn't")
}
}
func TestIDFromStringError(t *testing.T) {
tests := []struct {
in string
}{
{""},
{"foo"},
{"foobar"},
}
for _, tt := range tests {
t.Run(tt.in, func(t *testing.T) {
_, err := FromString(tt.in)
if err == nil {
t.Error("Unexpected success")
}
})
}
}