diff options
author | Ondrej Fabry <ofabry@cisco.com> | 2019-01-10 10:57:50 +0100 |
---|---|---|
committer | Ondrej Fabry <ofabry@cisco.com> | 2019-01-10 11:05:35 +0100 |
commit | 08266e35878f198e2fa59fcfc9f0fc3a4b1dfbf5 (patch) | |
tree | 1269acfc3bf6fdd47414eb64da3ecad4865e37d6 /vendor/github.com/onsi/gomega/gstruct/elements_test.go | |
parent | 3ef6f210edcf7dd753733d46ec3f2dd5dc795b61 (diff) |
Add support for string types
- strings are now generated as two fields for length and string itself
- aliases are now sorted by name to prevent generating different code
- dependencies are now managed by dep
- binapi files are regenerated using VPP 19.01-rc0~622-g7b01e9e8
- old stats binary api has been deprecated and removed from VPP
Change-Id: Ieb8515c73021339a45f407386f8e3d87dcf4469e
Signed-off-by: Ondrej Fabry <ofabry@cisco.com>
Diffstat (limited to 'vendor/github.com/onsi/gomega/gstruct/elements_test.go')
-rw-r--r-- | vendor/github.com/onsi/gomega/gstruct/elements_test.go | 144 |
1 files changed, 0 insertions, 144 deletions
diff --git a/vendor/github.com/onsi/gomega/gstruct/elements_test.go b/vendor/github.com/onsi/gomega/gstruct/elements_test.go deleted file mode 100644 index 8ba78cb..0000000 --- a/vendor/github.com/onsi/gomega/gstruct/elements_test.go +++ /dev/null @@ -1,144 +0,0 @@ -package gstruct_test - -import ( - . "github.com/onsi/ginkgo" - . "github.com/onsi/gomega" - . "github.com/onsi/gomega/gstruct" -) - -var _ = Describe("Slice", func() { - allElements := []string{"a", "b"} - missingElements := []string{"a"} - extraElements := []string{"a", "b", "c"} - duplicateElements := []string{"a", "a", "b"} - empty := []string{} - var nils []string - - It("should strictly match all elements", func() { - m := MatchAllElements(id, Elements{ - "b": Equal("b"), - "a": Equal("a"), - }) - Ω(allElements).Should(m, "should match all elements") - Ω(missingElements).ShouldNot(m, "should fail with missing elements") - Ω(extraElements).ShouldNot(m, "should fail with extra elements") - Ω(duplicateElements).ShouldNot(m, "should fail with duplicate elements") - Ω(nils).ShouldNot(m, "should fail with an uninitialized slice") - - m = MatchAllElements(id, Elements{ - "a": Equal("a"), - "b": Equal("fail"), - }) - Ω(allElements).ShouldNot(m, "should run nested matchers") - - m = MatchAllElements(id, Elements{}) - Ω(empty).Should(m, "should handle empty slices") - Ω(allElements).ShouldNot(m, "should handle only empty slices") - Ω(nils).Should(m, "should handle nil slices") - }) - - It("should ignore extra elements", func() { - m := MatchElements(id, IgnoreExtras, Elements{ - "b": Equal("b"), - "a": Equal("a"), - }) - Ω(allElements).Should(m, "should match all elements") - Ω(missingElements).ShouldNot(m, "should fail with missing elements") - Ω(extraElements).Should(m, "should ignore extra elements") - Ω(duplicateElements).ShouldNot(m, "should fail with duplicate elements") - Ω(nils).ShouldNot(m, "should fail with an uninitialized slice") - }) - - It("should ignore missing elements", func() { - m := MatchElements(id, IgnoreMissing, Elements{ - "a": Equal("a"), - "b": Equal("b"), - }) - Ω(allElements).Should(m, "should match all elements") - Ω(missingElements).Should(m, "should ignore missing elements") - Ω(extraElements).ShouldNot(m, "should fail with extra elements") - Ω(duplicateElements).ShouldNot(m, "should fail with duplicate elements") - Ω(nils).Should(m, "should ignore an uninitialized slice") - }) - - It("should ignore missing and extra elements", func() { - m := MatchElements(id, IgnoreMissing|IgnoreExtras, Elements{ - "a": Equal("a"), - "b": Equal("b"), - }) - Ω(allElements).Should(m, "should match all elements") - Ω(missingElements).Should(m, "should ignore missing elements") - Ω(extraElements).Should(m, "should ignore extra elements") - Ω(duplicateElements).ShouldNot(m, "should fail with duplicate elements") - Ω(nils).Should(m, "should ignore an uninitialized slice") - - m = MatchElements(id, IgnoreExtras|IgnoreMissing, Elements{ - "a": Equal("a"), - "b": Equal("fail"), - }) - Ω(allElements).ShouldNot(m, "should run nested matchers") - }) - - Context("with elements that share a key", func() { - nonUniqueID := func(element interface{}) string { - return element.(string)[0:1] - } - - allElements := []string{"a123", "a213", "b321"} - includingBadElements := []string{"a123", "b123", "b5555"} - extraElements := []string{"a123", "b1234", "c345"} - missingElements := []string{"b123", "b1234", "b1345"} - - It("should strictly allow multiple matches", func() { - m := MatchElements(nonUniqueID, AllowDuplicates, Elements{ - "a": ContainSubstring("1"), - "b": ContainSubstring("1"), - }) - Ω(allElements).Should(m, "should match all elements") - Ω(includingBadElements).ShouldNot(m, "should reject if a member fails the matcher") - Ω(extraElements).ShouldNot(m, "should reject with extra keys") - Ω(missingElements).ShouldNot(m, "should reject with missing keys") - Ω(nils).ShouldNot(m, "should fail with an uninitialized slice") - }) - - It("should ignore missing", func() { - m := MatchElements(nonUniqueID, AllowDuplicates|IgnoreMissing, Elements{ - "a": ContainSubstring("1"), - "b": ContainSubstring("1"), - }) - Ω(allElements).Should(m, "should match all elements") - Ω(includingBadElements).ShouldNot(m, "should reject if a member fails the matcher") - Ω(extraElements).ShouldNot(m, "should reject with extra keys") - Ω(missingElements).Should(m, "should allow missing keys") - Ω(nils).Should(m, "should allow an uninitialized slice") - }) - - It("should ignore extras", func() { - m := MatchElements(nonUniqueID, AllowDuplicates|IgnoreExtras, Elements{ - "a": ContainSubstring("1"), - "b": ContainSubstring("1"), - }) - Ω(allElements).Should(m, "should match all elements") - Ω(includingBadElements).ShouldNot(m, "should reject if a member fails the matcher") - Ω(extraElements).Should(m, "should allow extra keys") - Ω(missingElements).ShouldNot(m, "should reject missing keys") - Ω(nils).ShouldNot(m, "should reject an uninitialized slice") - }) - - It("should ignore missing and extras", func() { - m := MatchElements(nonUniqueID, AllowDuplicates|IgnoreExtras|IgnoreMissing, Elements{ - "a": ContainSubstring("1"), - "b": ContainSubstring("1"), - }) - Ω(allElements).Should(m, "should match all elements") - Ω(includingBadElements).ShouldNot(m, "should reject if a member fails the matcher") - Ω(extraElements).Should(m, "should allow extra keys") - Ω(missingElements).Should(m, "should allow missing keys") - Ω(nils).Should(m, "should allow an uninitialized slice") - }) - }) -}) - -func id(element interface{}) string { - return element.(string) -} |