From: Stefan Junker Date: Mon, 6 Jun 2016 17:50:42 +0000 (+0200) Subject: pkg/types: cover string for unmarshal tests X-Git-Url: https://git.halfball.org/?a=commitdiff_plain;h=d48cb537150feb530c64a84b23d8a723d82b93f7;p=plugins.git pkg/types: cover string for unmarshal tests --- diff --git a/types/args_test.go b/types/args_test.go index 61fd223..3a53d9a 100644 --- a/types/args_test.go +++ b/types/args_test.go @@ -47,6 +47,21 @@ var _ = Describe("UnmarshallableBool UnmarshalText", func() { }) }) +var _ = Describe("UnmarshallableString UnmarshalText", func() { + DescribeTable("string to string detection should succeed in all cases", + func(inputs []string, expected string) { + for _, s := range inputs { + var us UnmarshallableString + err := us.UnmarshalText([]byte(s)) + Expect(err).ToNot(HaveOccurred()) + Expect(string(us)).To(Equal(expected)) + } + }, + Entry("parse empty string", []string{""}, ""), + Entry("parse non-empty string", []string{"notempty"}, "notempty"), + ) +}) + var _ = Describe("GetKeyField", func() { type testcontainer struct { Valid string `json:"valid,omitempty"`