summaryrefslogtreecommitdiff
path: root/vendor/github.com/onsi/gomega
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/onsi/gomega')
-rw-r--r--vendor/github.com/onsi/gomega/format/format_suite_test.go13
-rw-r--r--vendor/github.com/onsi/gomega/format/format_test.go627
-rw-r--r--vendor/github.com/onsi/gomega/gbytes/buffer_test.go205
-rw-r--r--vendor/github.com/onsi/gomega/gbytes/gbuffer_suite_test.go13
-rw-r--r--vendor/github.com/onsi/gomega/gbytes/io_wrappers_test.go188
-rw-r--r--vendor/github.com/onsi/gomega/gbytes/say_matcher_test.go169
-rw-r--r--vendor/github.com/onsi/gomega/gexec/_fixture/firefly/main.go36
-rw-r--r--vendor/github.com/onsi/gomega/gexec/build_test.go112
-rw-r--r--vendor/github.com/onsi/gomega/gexec/exit_matcher_test.go114
-rw-r--r--vendor/github.com/onsi/gomega/gexec/gexec_suite_test.go26
-rw-r--r--vendor/github.com/onsi/gomega/gexec/prefixed_writer_test.go43
-rw-r--r--vendor/github.com/onsi/gomega/gexec/session_test.go336
-rw-r--r--vendor/github.com/onsi/gomega/ghttp/handlers.go322
-rw-r--r--vendor/github.com/onsi/gomega/ghttp/protobuf/protobuf.go3
-rw-r--r--vendor/github.com/onsi/gomega/ghttp/protobuf/simple_message.pb.go55
-rw-r--r--vendor/github.com/onsi/gomega/ghttp/protobuf/simple_message.proto9
-rw-r--r--vendor/github.com/onsi/gomega/ghttp/test_server.go422
-rw-r--r--vendor/github.com/onsi/gomega/ghttp/test_server_suite_test.go13
-rw-r--r--vendor/github.com/onsi/gomega/ghttp/test_server_test.go1129
-rw-r--r--vendor/github.com/onsi/gomega/gstruct/elements.go159
-rw-r--r--vendor/github.com/onsi/gomega/gstruct/elements_test.go144
-rw-r--r--vendor/github.com/onsi/gomega/gstruct/errors/nested_types.go72
-rw-r--r--vendor/github.com/onsi/gomega/gstruct/fields.go168
-rw-r--r--vendor/github.com/onsi/gomega/gstruct/fields_test.go76
-rw-r--r--vendor/github.com/onsi/gomega/gstruct/gstruct_tests_suite_test.go13
-rw-r--r--vendor/github.com/onsi/gomega/gstruct/ignore.go37
-rw-r--r--vendor/github.com/onsi/gomega/gstruct/ignore_test.go23
-rw-r--r--vendor/github.com/onsi/gomega/gstruct/pointer.go56
-rw-r--r--vendor/github.com/onsi/gomega/gstruct/pointer_test.go33
-rw-r--r--vendor/github.com/onsi/gomega/gstruct/types.go15
-rw-r--r--vendor/github.com/onsi/gomega/internal/assertion/assertion_suite_test.go13
-rw-r--r--vendor/github.com/onsi/gomega/internal/assertion/assertion_test.go258
-rw-r--r--vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion_suite_test.go13
-rw-r--r--vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion_test.go351
-rw-r--r--vendor/github.com/onsi/gomega/internal/fakematcher/fake_matcher.go23
-rw-r--r--vendor/github.com/onsi/gomega/internal/testingtsupport/testing_t_support_test.go92
-rw-r--r--vendor/github.com/onsi/gomega/matchers/and_test.go103
-rw-r--r--vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher_test.go46
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_a_directory_test.go40
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_a_regular_file_test.go40
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_an_existing_file_test.go40
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_closed_matcher_test.go70
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_empty_matcher_test.go52
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher_test.go50
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_false_matcher_test.go20
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_identical_to_test.go61
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_nil_matcher_test.go28
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_numerically_matcher_test.go172
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_sent_matcher_test.go107
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_temporally_matcher_test.go99
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_true_matcher_test.go20
-rw-r--r--vendor/github.com/onsi/gomega/matchers/be_zero_matcher_test.go40
-rw-r--r--vendor/github.com/onsi/gomega/matchers/consist_of_test.go75
-rw-r--r--vendor/github.com/onsi/gomega/matchers/contain_element_matcher_test.go76
-rw-r--r--vendor/github.com/onsi/gomega/matchers/contain_substring_matcher_test.go36
-rw-r--r--vendor/github.com/onsi/gomega/matchers/equal_matcher_test.go80
-rw-r--r--vendor/github.com/onsi/gomega/matchers/have_cap_matcher_test.go50
-rw-r--r--vendor/github.com/onsi/gomega/matchers/have_key_matcher_test.go73
-rw-r--r--vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher_test.go82
-rw-r--r--vendor/github.com/onsi/gomega/matchers/have_len_matcher_test.go53
-rw-r--r--vendor/github.com/onsi/gomega/matchers/have_occurred_matcher_test.go59
-rw-r--r--vendor/github.com/onsi/gomega/matchers/have_prefix_matcher_test.go36
-rw-r--r--vendor/github.com/onsi/gomega/matchers/have_suffix_matcher_test.go36
-rw-r--r--vendor/github.com/onsi/gomega/matchers/match_error_matcher_test.go107
-rw-r--r--vendor/github.com/onsi/gomega/matchers/match_json_matcher_test.go103
-rw-r--r--vendor/github.com/onsi/gomega/matchers/match_regexp_matcher_test.go44
-rw-r--r--vendor/github.com/onsi/gomega/matchers/match_xml_matcher_test.go97
-rw-r--r--vendor/github.com/onsi/gomega/matchers/match_yaml_matcher_test.go101
-rw-r--r--vendor/github.com/onsi/gomega/matchers/matcher_tests_suite_test.go50
-rw-r--r--vendor/github.com/onsi/gomega/matchers/not_test.go64
-rw-r--r--vendor/github.com/onsi/gomega/matchers/or_test.go92
-rw-r--r--vendor/github.com/onsi/gomega/matchers/panic_matcher_test.go52
-rw-r--r--vendor/github.com/onsi/gomega/matchers/receive_matcher_test.go304
-rw-r--r--vendor/github.com/onsi/gomega/matchers/succeed_matcher_test.go72
-rw-r--r--vendor/github.com/onsi/gomega/matchers/support/goraph/MIT.LICENSE20
-rw-r--r--vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_01.xml6
-rw-r--r--vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_02.xml9
-rw-r--r--vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_03.xml1
-rw-r--r--vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_04.xml6
-rw-r--r--vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_05.xml211
-rw-r--r--vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_06.xml13
-rw-r--r--vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_07.xml13
-rw-r--r--vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_08.xml13
-rw-r--r--vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_09.xml4
-rw-r--r--vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_10.xml4
-rw-r--r--vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_11.xml7
-rw-r--r--vendor/github.com/onsi/gomega/matchers/with_transform_test.go102
87 files changed, 0 insertions, 8520 deletions
diff --git a/vendor/github.com/onsi/gomega/format/format_suite_test.go b/vendor/github.com/onsi/gomega/format/format_suite_test.go
deleted file mode 100644
index 8e65a9529..000000000
--- a/vendor/github.com/onsi/gomega/format/format_suite_test.go
+++ /dev/null
@@ -1,13 +0,0 @@
-package format_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-
- "testing"
-)
-
-func TestFormat(t *testing.T) {
- RegisterFailHandler(Fail)
- RunSpecs(t, "Format Suite")
-}
diff --git a/vendor/github.com/onsi/gomega/format/format_test.go b/vendor/github.com/onsi/gomega/format/format_test.go
deleted file mode 100644
index 9ea781379..000000000
--- a/vendor/github.com/onsi/gomega/format/format_test.go
+++ /dev/null
@@ -1,627 +0,0 @@
-package format_test
-
-import (
- "fmt"
- "strings"
- "time"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/format"
- "github.com/onsi/gomega/types"
-)
-
-//recursive struct
-
-type StringAlias string
-type ByteAlias []byte
-type IntAlias int
-
-type AStruct struct {
- Exported string
-}
-
-type SimpleStruct struct {
- Name string
- Enumeration int
- Veritas bool
- Data []byte
- secret uint32
-}
-
-type ComplexStruct struct {
- Strings []string
- SimpleThings []*SimpleStruct
- DataMaps map[int]ByteAlias
-}
-
-type SecretiveStruct struct {
- boolValue bool
- intValue int
- uintValue uint
- uintptrValue uintptr
- floatValue float32
- complexValue complex64
- chanValue chan bool
- funcValue func()
- pointerValue *int
- sliceValue []string
- byteSliceValue []byte
- stringValue string
- arrValue [3]int
- byteArrValue [3]byte
- mapValue map[string]int
- structValue AStruct
- interfaceValue interface{}
-}
-
-type GoStringer struct {
-}
-
-func (g GoStringer) GoString() string {
- return "go-string"
-}
-
-func (g GoStringer) String() string {
- return "string"
-}
-
-type Stringer struct {
-}
-
-func (g Stringer) String() string {
- return "string"
-}
-
-type ctx struct {
-}
-
-func (c *ctx) Deadline() (deadline time.Time, ok bool) {
- return time.Time{}, false
-}
-
-func (c *ctx) Done() <-chan struct{} {
- return nil
-}
-
-func (c *ctx) Err() error {
- return nil
-}
-
-func (c *ctx) Value(key interface{}) interface{} {
- return nil
-}
-
-var _ = Describe("Format", func() {
- match := func(typeRepresentation string, valueRepresentation string, args ...interface{}) types.GomegaMatcher {
- if len(args) > 0 {
- valueRepresentation = fmt.Sprintf(valueRepresentation, args...)
- }
- return Equal(fmt.Sprintf("%s<%s>: %s", Indent, typeRepresentation, valueRepresentation))
- }
-
- matchRegexp := func(typeRepresentation string, valueRepresentation string, args ...interface{}) types.GomegaMatcher {
- if len(args) > 0 {
- valueRepresentation = fmt.Sprintf(valueRepresentation, args...)
- }
- return MatchRegexp(fmt.Sprintf("%s<%s>: %s", Indent, typeRepresentation, valueRepresentation))
- }
-
- hashMatchingRegexp := func(entries ...string) string {
- entriesSwitch := "(" + strings.Join(entries, "|") + ")"
- arr := make([]string, len(entries))
- for i := range arr {
- arr[i] = entriesSwitch
- }
- return "{" + strings.Join(arr, ", ") + "}"
- }
-
- Describe("Message", func() {
- Context("with only an actual value", func() {
- It("should print out an indented formatted representation of the value and the message", func() {
- Expect(Message(3, "to be three.")).Should(Equal("Expected\n <int>: 3\nto be three."))
- })
- })
-
- Context("with an actual and an expected value", func() {
- It("should print out an indented formatted representatino of both values, and the message", func() {
- Expect(Message(3, "to equal", 4)).Should(Equal("Expected\n <int>: 3\nto equal\n <int>: 4"))
- })
- })
- })
-
- Describe("MessageWithDiff", func() {
- It("shows the exact point where two long strings differ", func() {
- stringWithB := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
- stringWithZ := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
-
- Expect(MessageWithDiff(stringWithB, "to equal", stringWithZ)).Should(Equal(expectedLongStringFailureMessage))
- })
-
- It("truncates the start of long strings that differ only at their end", func() {
- stringWithB := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab"
- stringWithZ := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz"
-
- Expect(MessageWithDiff(stringWithB, "to equal", stringWithZ)).Should(Equal(expectedTruncatedStartStringFailureMessage))
- })
-
- It("truncates the start of long strings that differ only in length", func() {
- smallString := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
- largeString := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
-
- Expect(MessageWithDiff(largeString, "to equal", smallString)).Should(Equal(expectedTruncatedStartSizeFailureMessage))
- Expect(MessageWithDiff(smallString, "to equal", largeString)).Should(Equal(expectedTruncatedStartSizeSwappedFailureMessage))
- })
-
- It("truncates the end of long strings that differ only at their start", func() {
- stringWithB := "baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
- stringWithZ := "zaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
-
- Expect(MessageWithDiff(stringWithB, "to equal", stringWithZ)).Should(Equal(expectedTruncatedEndStringFailureMessage))
- })
-
- It("handles multi-byte sequences correctly", func() {
- stringA := "• abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz1"
- stringB := "• abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
-
- Expect(MessageWithDiff(stringA, "to equal", stringB)).Should(Equal(expectedTruncatedMultiByteFailureMessage))
- })
-
- Context("With truncated diff disabled", func() {
- BeforeEach(func() {
- TruncatedDiff = false
- })
-
- AfterEach(func() {
- TruncatedDiff = true
- })
-
- It("should show the full diff", func() {
- stringWithB := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
- stringWithZ := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
-
- Expect(MessageWithDiff(stringWithB, "to equal", stringWithZ)).Should(Equal(expectedFullFailureDiff))
- })
- })
- })
-
- Describe("IndentString", func() {
- It("should indent the string", func() {
- Expect(IndentString("foo\n bar\nbaz", 2)).Should(Equal(" foo\n bar\n baz"))
- })
- })
-
- Describe("Object", func() {
- Describe("formatting boolean values", func() {
- It("should give the type and format values correctly", func() {
- Expect(Object(true, 1)).Should(match("bool", "true"))
- Expect(Object(false, 1)).Should(match("bool", "false"))
- })
- })
-
- Describe("formatting numbers", func() {
- It("should give the type and format values correctly", func() {
- Expect(Object(int(3), 1)).Should(match("int", "3"))
- Expect(Object(int8(3), 1)).Should(match("int8", "3"))
- Expect(Object(int16(3), 1)).Should(match("int16", "3"))
- Expect(Object(int32(3), 1)).Should(match("int32", "3"))
- Expect(Object(int64(3), 1)).Should(match("int64", "3"))
-
- Expect(Object(uint(3), 1)).Should(match("uint", "3"))
- Expect(Object(uint8(3), 1)).Should(match("uint8", "3"))
- Expect(Object(uint16(3), 1)).Should(match("uint16", "3"))
- Expect(Object(uint32(3), 1)).Should(match("uint32", "3"))
- Expect(Object(uint64(3), 1)).Should(match("uint64", "3"))
- })
-
- It("should handle uintptr differently", func() {
- Expect(Object(uintptr(3), 1)).Should(match("uintptr", "0x3"))
- })
- })
-
- Describe("formatting channels", func() {
- It("should give the type and format values correctly", func() {
- c := make(chan<- bool, 3)
- c <- true
- c <- false
- Expect(Object(c, 1)).Should(match("chan<- bool | len:2, cap:3", "%v", c))
- })
- })
-
- Describe("formatting strings", func() {
- It("should give the type and format values correctly", func() {
- s := "a\nb\nc"
- Expect(Object(s, 1)).Should(match("string", `a
- b
- c`))
- })
- })
-
- Describe("formatting []byte slices", func() {
- Context("when the slice is made of printable bytes", func() {
- It("should present it as string", func() {
- b := []byte("a b c")
- Expect(Object(b, 1)).Should(matchRegexp(`\[\]uint8 \| len:5, cap:\d+`, `a b c`))
- })
- })
- Context("when the slice contains non-printable bytes", func() {
- It("should present it as slice", func() {
- b := []byte("a b c\n\x01\x02\x03\xff\x1bH")
- Expect(Object(b, 1)).Should(matchRegexp(`\[\]uint8 \| len:12, cap:\d+`, `\[97, 32, 98, 32, 99, 10, 1, 2, 3, 255, 27, 72\]`))
- })
- })
- })
-
- Describe("formatting functions", func() {
- It("should give the type and format values correctly", func() {
- f := func(a string, b []int) ([]byte, error) {
- return []byte("abc"), nil
- }
- Expect(Object(f, 1)).Should(match("func(string, []int) ([]uint8, error)", "%v", f))
- })
- })
-
- Describe("formatting pointers", func() {
- It("should give the type and dereference the value to format it correctly", func() {
- a := 3
- Expect(Object(&a, 1)).Should(match(fmt.Sprintf("*int | %p", &a), "3"))
- })
-
- Context("when there are pointers to pointers...", func() {
- It("should recursively deference the pointer until it gets to a value", func() {
- a := 3
- var b *int
- var c **int
- var d ***int
- b = &a
- c = &b
- d = &c
-
- Expect(Object(d, 1)).Should(match(fmt.Sprintf("***int | %p", d), "3"))
- })
- })
-
- Context("when the pointer points to nil", func() {
- It("should say nil and not explode", func() {
- var a *AStruct
- Expect(Object(a, 1)).Should(match("*format_test.AStruct | 0x0", "nil"))
- })
- })
- })
-
- Describe("formatting arrays", func() {
- It("should give the type and format values correctly", func() {
- w := [3]string{"Jed Bartlet", "Toby Ziegler", "CJ Cregg"}
- Expect(Object(w, 1)).Should(match("[3]string", `["Jed Bartlet", "Toby Ziegler", "CJ Cregg"]`))
- })
-
- Context("with byte arrays", func() {
- It("should give the type and format values correctly", func() {
- w := [3]byte{17, 28, 19}
- Expect(Object(w, 1)).Should(match("[3]uint8", `[17, 28, 19]`))
- })
- })
- })
-
- Describe("formatting slices", func() {
- It("should include the length and capacity in the type information", func() {
- s := make([]bool, 3, 4)
- Expect(Object(s, 1)).Should(match("[]bool | len:3, cap:4", "[false, false, false]"))
- })
-
- Context("when the slice contains long entries", func() {
- It("should format the entries with newlines", func() {
- w := []string{"Josiah Edward Bartlet", "Toby Ziegler", "CJ Cregg"}
- expected := `[
- "Josiah Edward Bartlet",
- "Toby Ziegler",
- "CJ Cregg",
- ]`
- Expect(Object(w, 1)).Should(match("[]string | len:3, cap:3", expected))
- })
- })
- })
-
- Describe("formatting maps", func() {
- It("should include the length in the type information", func() {
- m := make(map[int]bool, 5)
- m[3] = true
- m[4] = false
- Expect(Object(m, 1)).Should(matchRegexp(`map\[int\]bool \| len:2`, hashMatchingRegexp("3: true", "4: false")))
- })
-
- Context("when the slice contains long entries", func() {
- It("should format the entries with newlines", func() {
- m := map[string][]byte{}
- m["Josiah Edward Bartlet"] = []byte("Martin Sheen")
- m["Toby Ziegler"] = []byte("Richard Schiff")
- m["CJ Cregg"] = []byte("Allison Janney")
- expected := `{
- ("Josiah Edward Bartlet": "Martin Sheen"|"Toby Ziegler": "Richard Schiff"|"CJ Cregg": "Allison Janney"),
- ("Josiah Edward Bartlet": "Martin Sheen"|"Toby Ziegler": "Richard Schiff"|"CJ Cregg": "Allison Janney"),
- ("Josiah Edward Bartlet": "Martin Sheen"|"Toby Ziegler": "Richard Schiff"|"CJ Cregg": "Allison Janney"),
- }`
- Expect(Object(m, 1)).Should(matchRegexp(`map\[string\]\[\]uint8 \| len:3`, expected))
- })
- })
- })
-
- Describe("formatting structs", func() {
- It("should include the struct name and the field names", func() {
- s := SimpleStruct{
- Name: "Oswald",
- Enumeration: 17,
- Veritas: true,
- Data: []byte("datum"),
- secret: 1983,
- }
-
- Expect(Object(s, 1)).Should(match("format_test.SimpleStruct", `{Name: "Oswald", Enumeration: 17, Veritas: true, Data: "datum", secret: 1983}`))
- })
-
- Context("when the struct contains long entries", func() {
- It("should format the entries with new lines", func() {
- s := &SimpleStruct{
- Name: "Mithrandir Gandalf Greyhame",
- Enumeration: 2021,
- Veritas: true,
- Data: []byte("wizard"),
- secret: 3,
- }
-
- Expect(Object(s, 1)).Should(match(fmt.Sprintf("*format_test.SimpleStruct | %p", s), `{
- Name: "Mithrandir Gandalf Greyhame",
- Enumeration: 2021,
- Veritas: true,
- Data: "wizard",
- secret: 3,
- }`))
- })
- })
- })
-
- Describe("formatting nil values", func() {
- It("should print out nil", func() {
- Expect(Object(nil, 1)).Should(match("nil", "nil"))
- var typedNil *AStruct
- Expect(Object(typedNil, 1)).Should(match("*format_test.AStruct | 0x0", "nil"))
- var c chan<- bool
- Expect(Object(c, 1)).Should(match("chan<- bool | len:0, cap:0", "nil"))
- var s []string
- Expect(Object(s, 1)).Should(match("[]string | len:0, cap:0", "nil"))
- var m map[string]bool
- Expect(Object(m, 1)).Should(match("map[string]bool | len:0", "nil"))
- })
- })
-
- Describe("formatting aliased types", func() {
- It("should print out the correct alias type", func() {
- Expect(Object(StringAlias("alias"), 1)).Should(match("format_test.StringAlias", `alias`))
- Expect(Object(ByteAlias("alias"), 1)).Should(matchRegexp(`format_test\.ByteAlias \| len:5, cap:\d+`, `alias`))
- Expect(Object(IntAlias(3), 1)).Should(match("format_test.IntAlias", "3"))
- })
- })
-
- Describe("handling nested things", func() {
- It("should produce a correctly nested representation", func() {
- s := ComplexStruct{
- Strings: []string{"lots", "of", "short", "strings"},
- SimpleThings: []*SimpleStruct{
- {"short", 7, true, []byte("succinct"), 17},
- {"something longer", 427, true, []byte("designed to wrap around nicely"), 30},
- },
- DataMaps: map[int]ByteAlias{
- 17: ByteAlias("some substantially longer chunks of data"),
- 1138: ByteAlias("that should make things wrap"),
- },
- }
- expected := `{
- Strings: \["lots", "of", "short", "strings"\],
- SimpleThings: \[
- {Name: "short", Enumeration: 7, Veritas: true, Data: "succinct", secret: 17},
- {
- Name: "something longer",
- Enumeration: 427,
- Veritas: true,
- Data: "designed to wrap around nicely",
- secret: 30,
- },
- \],
- DataMaps: {
- (17: "some substantially longer chunks of data"|1138: "that should make things wrap"),
- (17: "some substantially longer chunks of data"|1138: "that should make things wrap"),
- },
- }`
- Expect(Object(s, 1)).Should(matchRegexp(`format_test\.ComplexStruct`, expected))
- })
- })
-
- Describe("formatting times", func() {
- It("should format time as RFC3339", func() {
- t := time.Date(2016, 10, 31, 9, 57, 23, 12345, time.UTC)
- Expect(Object(t, 1)).Should(match("time.Time", `2016-10-31T09:57:23.000012345Z`))
- })
- })
- })
-
- Describe("Handling unexported fields in structs", func() {
- It("should handle all the various types correctly", func() {
- a := int(5)
- s := SecretiveStruct{
- boolValue: true,
- intValue: 3,
- uintValue: 4,
- uintptrValue: 5,
- floatValue: 6.0,
- complexValue: complex(5.0, 3.0),
- chanValue: make(chan bool, 2),
- funcValue: func() {},
- pointerValue: &a,
- sliceValue: []string{"string", "slice"},
- byteSliceValue: []byte("bytes"),
- stringValue: "a string",
- arrValue: [3]int{11, 12, 13},
- byteArrValue: [3]byte{17, 20, 32},
- mapValue: map[string]int{"a key": 20, "b key": 30},
- structValue: AStruct{"exported"},
- interfaceValue: map[string]int{"a key": 17},
- }
-
- expected := fmt.Sprintf(`{
- boolValue: true,
- intValue: 3,
- uintValue: 4,
- uintptrValue: 0x5,
- floatValue: 6,
- complexValue: \(5\+3i\),
- chanValue: %p,
- funcValue: %p,
- pointerValue: 5,
- sliceValue: \["string", "slice"\],
- byteSliceValue: "bytes",
- stringValue: "a string",
- arrValue: \[11, 12, 13\],
- byteArrValue: \[17, 20, 32\],
- mapValue: %s,
- structValue: {Exported: "exported"},
- interfaceValue: {"a key": 17},
- }`, s.chanValue, s.funcValue, hashMatchingRegexp(`"a key": 20`, `"b key": 30`))
-
- Expect(Object(s, 1)).Should(matchRegexp(`format_test\.SecretiveStruct`, expected))
- })
- })
-
- Describe("Handling interfaces", func() {
- It("should unpack the interface", func() {
- outerHash := map[string]interface{}{}
- innerHash := map[string]int{}
-
- innerHash["inner"] = 3
- outerHash["integer"] = 2
- outerHash["map"] = innerHash
-
- expected := hashMatchingRegexp(`"integer": 2`, `"map": {"inner": 3}`)
- Expect(Object(outerHash, 1)).Should(matchRegexp(`map\[string\]interface {} \| len:2`, expected))
- })
- })
-
- Describe("Handling recursive things", func() {
- It("should not go crazy...", func() {
- m := map[string]interface{}{}
- m["integer"] = 2
- m["map"] = m
- Expect(Object(m, 1)).Should(ContainSubstring("..."))
- })
-
- It("really should not go crazy...", func() {
- type complexKey struct {
- Value map[interface{}]int
- }
-
- complexObject := complexKey{}
- complexObject.Value = make(map[interface{}]int)
-
- complexObject.Value[&complexObject] = 2
- Expect(Object(complexObject, 1)).Should(ContainSubstring("..."))
- })
- })
-
- Describe("When instructed to use the Stringer representation", func() {
- BeforeEach(func() {
- UseStringerRepresentation = true
- })
-
- AfterEach(func() {
- UseStringerRepresentation = false
- })
-
- Context("when passed a GoStringer", func() {
- It("should use what GoString() returns", func() {
- Expect(Object(GoStringer{}, 1)).Should(ContainSubstring("<format_test.GoStringer>: go-string"))
- })
- })
-
- Context("when passed a stringer", func() {
- It("should use what String() returns", func() {
- Expect(Object(Stringer{}, 1)).Should(ContainSubstring("<format_test.Stringer>: string"))
- })
- })
- })
-
- Describe("Printing a context.Context field", func() {
-
- type structWithContext struct {
- Context Ctx
- Value string
- }
-
- context := ctx{}
- objWithContext := structWithContext{Value: "some-value", Context: &context}
-
- It("Suppresses the content by default", func() {
- Expect(Object(objWithContext, 1)).Should(ContainSubstring("<suppressed context>"))
- })
-
- It("Doesn't supress the context if it's the object being printed", func() {
- Expect(Object(context, 1)).ShouldNot(MatchRegexp("^.*<suppressed context>$"))
- })
-
- Context("PrintContextObjects is set", func() {
- BeforeEach(func() {
- PrintContextObjects = true
- })
-
- AfterEach(func() {
- PrintContextObjects = false
- })
-
- It("Prints the context", func() {
- Expect(Object(objWithContext, 1)).ShouldNot(ContainSubstring("<suppressed context>"))
- })
- })
- })
-})
-
-var expectedLongStringFailureMessage = strings.TrimSpace(`
-Expected
- <string>: "...aaaaabaaaaa..."
-to equal |
- <string>: "...aaaaazaaaaa..."
-`)
-var expectedTruncatedEndStringFailureMessage = strings.TrimSpace(`
-Expected
- <string>: "baaaaa..."
-to equal |
- <string>: "zaaaaa..."
-`)
-var expectedTruncatedStartStringFailureMessage = strings.TrimSpace(`
-Expected
- <string>: "...aaaaab"
-to equal |
- <string>: "...aaaaaz"
-`)
-var expectedTruncatedStartSizeFailureMessage = strings.TrimSpace(`
-Expected
- <string>: "...aaaaaa"
-to equal |
- <string>: "...aaaaa"
-`)
-var expectedTruncatedStartSizeSwappedFailureMessage = strings.TrimSpace(`
-Expected
- <string>: "...aaaa"
-to equal |
- <string>: "...aaaaa"
-`)
-var expectedTruncatedMultiByteFailureMessage = strings.TrimSpace(`
-Expected
- <string>: "...tuvwxyz1"
-to equal |
- <string>: "...tuvwxyz"
-`)
-
-var expectedFullFailureDiff = strings.TrimSpace(`
-Expected
- <string>: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-to equal
- <string>: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
-`)
diff --git a/vendor/github.com/onsi/gomega/gbytes/buffer_test.go b/vendor/github.com/onsi/gomega/gbytes/buffer_test.go
deleted file mode 100644
index 9d4e8279d..000000000
--- a/vendor/github.com/onsi/gomega/gbytes/buffer_test.go
+++ /dev/null
@@ -1,205 +0,0 @@
-package gbytes_test
-
-import (
- "io"
- "time"
-
- . "github.com/onsi/gomega/gbytes"
-
- "bytes"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-)
-
-type SlowReader struct {
- R io.Reader
- D time.Duration
-}
-
-func (s SlowReader) Read(p []byte) (int, error) {
- time.Sleep(s.D)
- return s.R.Read(p)
-}
-
-var _ = Describe("Buffer", func() {
- var buffer *Buffer
-
- BeforeEach(func() {
- buffer = NewBuffer()
- })
-
- Describe("dumping the entire contents of the buffer", func() {
- It("should return everything that's been written", func() {
- buffer.Write([]byte("abc"))
- buffer.Write([]byte("def"))
- Expect(buffer.Contents()).Should(Equal([]byte("abcdef")))
-
- Expect(buffer).Should(Say("bcd"))
- Expect(buffer.Contents()).Should(Equal([]byte("abcdef")))
- })
- })
-
- Describe("creating a buffer with bytes", func() {
- It("should create the buffer with the cursor set to the beginning", func() {
- buffer := BufferWithBytes([]byte("abcdef"))
- Expect(buffer.Contents()).Should(Equal([]byte("abcdef")))
- Expect(buffer).Should(Say("abc"))
- Expect(buffer).ShouldNot(Say("abc"))
- Expect(buffer).Should(Say("def"))
- })
- })
-
- Describe("creating a buffer that wraps a reader", func() {
- Context("for a well-behaved reader", func() {
- It("should buffer the contents of the reader", func() {
- reader := bytes.NewBuffer([]byte("abcdef"))
- buffer := BufferReader(reader)
- Eventually(buffer).Should(Say("abc"))
- Expect(buffer).ShouldNot(Say("abc"))
- Eventually(buffer).Should(Say("def"))
- Eventually(buffer.Closed).Should(BeTrue())
- })
- })
-
- Context("for a slow reader", func() {
- It("should allow Eventually to time out", func() {
- slowReader := SlowReader{
- R: bytes.NewBuffer([]byte("abcdef")),
- D: time.Second,
- }
- buffer := BufferReader(slowReader)
- failures := InterceptGomegaFailures(func() {
- Eventually(buffer, 100*time.Millisecond).Should(Say("abc"))
- })
- Expect(failures).ShouldNot(BeEmpty())
-
- fastReader := SlowReader{
- R: bytes.NewBuffer([]byte("abcdef")),
- D: time.Millisecond,
- }
- buffer = BufferReader(fastReader)
- Eventually(buffer, 100*time.Millisecond).Should(Say("abc"))
- Eventually(buffer.Closed).Should(BeTrue())
- })
- })
- })
-
- Describe("reading from a buffer", func() {
- It("should read the current contents of the buffer", func() {
- buffer := BufferWithBytes([]byte("abcde"))
-
- dest := make([]byte, 3)
- n, err := buffer.Read(dest)
- Expect(err).ShouldNot(HaveOccurred())
- Expect(n).Should(Equal(3))
- Expect(string(dest)).Should(Equal("abc"))
-
- dest = make([]byte, 3)
- n, err = buffer.Read(dest)
- Expect(err).ShouldNot(HaveOccurred())
- Expect(n).Should(Equal(2))
- Expect(string(dest[:n])).Should(Equal("de"))
-
- n, err = buffer.Read(dest)
- Expect(err).Should(Equal(io.EOF))
- Expect(n).Should(Equal(0))
- })
-
- Context("after the buffer has been closed", func() {
- It("returns an error", func() {
- buffer := BufferWithBytes([]byte("abcde"))
-
- buffer.Close()
-
- dest := make([]byte, 3)
- n, err := buffer.Read(dest)
- Expect(err).Should(HaveOccurred())
- Expect(n).Should(Equal(0))
- })
- })
- })
-
- Describe("detecting regular expressions", func() {
- It("should fire the appropriate channel when the passed in pattern matches, then close it", func(done Done) {
- go func() {
- time.Sleep(10 * time.Millisecond)
- buffer.Write([]byte("abcde"))
- }()
-
- A := buffer.Detect("%s", "a.c")
- B := buffer.Detect("def")
-
- var gotIt bool
- select {
- case gotIt = <-A:
- case <-B:
- Fail("should not have gotten here")
- }
-
- Expect(gotIt).Should(BeTrue())
- Eventually(A).Should(BeClosed())
-
- buffer.Write([]byte("f"))
- Eventually(B).Should(Receive())
- Eventually(B).Should(BeClosed())
-
- close(done)
- })
-
- It("should fast-forward the buffer upon detection", func(done Done) {
- buffer.Write([]byte("abcde"))
- <-buffer.Detect("abc")
- Expect(buffer).ShouldNot(Say("abc"))
- Expect(buffer).Should(Say("de"))
- close(done)
- })
-
- It("should only fast-forward the buffer when the channel is read, and only if doing so would not rewind it", func(done Done) {
- buffer.Write([]byte("abcde"))
- A := buffer.Detect("abc")
- time.Sleep(20 * time.Millisecond) //give the goroutine a chance to detect and write to the channel
- Expect(buffer).Should(Say("abcd"))
- <-A
- Expect(buffer).ShouldNot(Say("d"))
- Expect(buffer).Should(Say("e"))
- Eventually(A).Should(BeClosed())
- close(done)
- })
-
- It("should be possible to cancel a detection", func(done Done) {
- A := buffer.Detect("abc")
- B := buffer.Detect("def")
- buffer.CancelDetects()
- buffer.Write([]byte("abcdef"))
- Eventually(A).Should(BeClosed())
- Eventually(B).Should(BeClosed())
-
- Expect(buffer).Should(Say("bcde"))
- <-buffer.Detect("f")
- close(done)
- })
- })
-
- Describe("closing the buffer", func() {
- It("should error when further write attempts are made", func() {
- _, err := buffer.Write([]byte("abc"))
- Expect(err).ShouldNot(HaveOccurred())
-
- buffer.Close()
-
- _, err = buffer.Write([]byte("def"))
- Expect(err).Should(HaveOccurred())
-
- Expect(buffer.Contents()).Should(Equal([]byte("abc")))
- })
-
- It("should be closed", func() {
- Expect(buffer.Closed()).Should(BeFalse())
-
- buffer.Close()
-
- Expect(buffer.Closed()).Should(BeTrue())
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/gbytes/gbuffer_suite_test.go b/vendor/github.com/onsi/gomega/gbytes/gbuffer_suite_test.go
deleted file mode 100644
index 3a7dc0612..000000000
--- a/vendor/github.com/onsi/gomega/gbytes/gbuffer_suite_test.go
+++ /dev/null
@@ -1,13 +0,0 @@
-package gbytes_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-
- "testing"
-)
-
-func TestGbytes(t *testing.T) {
- RegisterFailHandler(Fail)
- RunSpecs(t, "Gbytes Suite")
-}
diff --git a/vendor/github.com/onsi/gomega/gbytes/io_wrappers_test.go b/vendor/github.com/onsi/gomega/gbytes/io_wrappers_test.go
deleted file mode 100644
index 3da973498..000000000
--- a/vendor/github.com/onsi/gomega/gbytes/io_wrappers_test.go
+++ /dev/null
@@ -1,188 +0,0 @@
-package gbytes_test
-
-import (
- "fmt"
- "io"
- "time"
-
- . "github.com/onsi/gomega/gbytes"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-)
-
-type FakeCloser struct {
- err error
- duration time.Duration
-}
-
-func (f FakeCloser) Close() error {
- time.Sleep(f.duration)
- return f.err
-}
-
-type FakeReader struct {
- err error
- duration time.Duration
-}
-
-func (f FakeReader) Read(p []byte) (int, error) {
- time.Sleep(f.duration)
- if f.err != nil {
- return 0, f.err
- }
-
- for i := 0; i < len(p); i++ {
- p[i] = 'a'
- }
-
- return len(p), nil
-}
-
-type FakeWriter struct {
- err error
- duration time.Duration
-}
-
-func (f FakeWriter) Write(p []byte) (int, error) {
- time.Sleep(f.duration)
- if f.err != nil {
- return 0, f.err
- }
-
- return len(p), nil
-}
-
-var _ = Describe("Io Wrappers", func() {
- Describe("TimeoutCloser", func() {
- var innerCloser io.Closer
- var timeoutCloser io.Closer
-
- JustBeforeEach(func() {
- timeoutCloser = TimeoutCloser(innerCloser, 20*time.Millisecond)
- })
-
- Context("when the underlying Closer closes with no error", func() {
- BeforeEach(func() {
- innerCloser = FakeCloser{}
- })
-
- It("returns with no error", func() {
- Expect(timeoutCloser.Close()).Should(Succeed())
- })
- })
-
- Context("when the underlying Closer closes with an error", func() {
- BeforeEach(func() {
- innerCloser = FakeCloser{err: fmt.Errorf("boom")}
- })
-
- It("returns the error", func() {
- Expect(timeoutCloser.Close()).Should(MatchError("boom"))
- })
- })
-
- Context("when the underlying Closer hangs", func() {
- BeforeEach(func() {
- innerCloser = FakeCloser{
- err: fmt.Errorf("boom"),
- duration: time.Hour,
- }
- })
-
- It("returns ErrTimeout", func() {
- Expect(timeoutCloser.Close()).Should(MatchError(ErrTimeout))
- })
- })
- })
-
- Describe("TimeoutReader", func() {
- var innerReader io.Reader
- var timeoutReader io.Reader
-
- JustBeforeEach(func() {
- timeoutReader = TimeoutReader(innerReader, 20*time.Millisecond)
- })
-
- Context("when the underlying Reader returns no error", func() {
- BeforeEach(func() {
- innerReader = FakeReader{}
- })
-
- It("returns with no error", func() {
- p := make([]byte, 5)
- n, err := timeoutReader.Read(p)
- Expect(n).Should(Equal(5))
- Expect(err).ShouldNot(HaveOccurred())
- Expect(p).Should(Equal([]byte("aaaaa")))
- })
- })
-
- Context("when the underlying Reader returns an error", func() {
- BeforeEach(func() {
- innerReader = FakeReader{err: fmt.Errorf("boom")}
- })
-
- It("returns the error", func() {
- p := make([]byte, 5)
- _, err := timeoutReader.Read(p)
- Expect(err).Should(MatchError("boom"))
- })
- })
-
- Context("when the underlying Reader hangs", func() {
- BeforeEach(func() {
- innerReader = FakeReader{err: fmt.Errorf("boom"), duration: time.Hour}
- })
-
- It("returns ErrTimeout", func() {
- p := make([]byte, 5)
- _, err := timeoutReader.Read(p)
- Expect(err).Should(MatchError(ErrTimeout))
- })
- })
- })
-
- Describe("TimeoutWriter", func() {
- var innerWriter io.Writer
- var timeoutWriter io.Writer
-
- JustBeforeEach(func() {
- timeoutWriter = TimeoutWriter(innerWriter, 20*time.Millisecond)
- })
-
- Context("when the underlying Writer returns no error", func() {
- BeforeEach(func() {
- innerWriter = FakeWriter{}
- })
-
- It("returns with no error", func() {
- n, err := timeoutWriter.Write([]byte("aaaaa"))
- Expect(n).Should(Equal(5))
- Expect(err).ShouldNot(HaveOccurred())
- })
- })
-
- Context("when the underlying Writer returns an error", func() {
- BeforeEach(func() {
- innerWriter = FakeWriter{err: fmt.Errorf("boom")}
- })
-
- It("returns the error", func() {
- _, err := timeoutWriter.Write([]byte("aaaaa"))
- Expect(err).Should(MatchError("boom"))
- })
- })
-
- Context("when the underlying Writer hangs", func() {
- BeforeEach(func() {
- innerWriter = FakeWriter{err: fmt.Errorf("boom"), duration: time.Hour}
- })
-
- It("returns ErrTimeout", func() {
- _, err := timeoutWriter.Write([]byte("aaaaa"))
- Expect(err).Should(MatchError(ErrTimeout))
- })
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/gbytes/say_matcher_test.go b/vendor/github.com/onsi/gomega/gbytes/say_matcher_test.go
deleted file mode 100644
index 0055d4a1b..000000000
--- a/vendor/github.com/onsi/gomega/gbytes/say_matcher_test.go
+++ /dev/null
@@ -1,169 +0,0 @@
-package gbytes_test
-
-import (
- "time"
-
- . "github.com/onsi/gomega/gbytes"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-)
-
-type speaker struct {
- buffer *Buffer
-}
-
-func (s *speaker) Buffer() *Buffer {
- return s.buffer
-}
-
-var _ = Describe("SayMatcher", func() {
- var buffer *Buffer
-
- BeforeEach(func() {
- buffer = NewBuffer()
- buffer.Write([]byte("abc"))
- })
-
- Context("when actual is not a gexec Buffer, or a BufferProvider", func() {
- It("should error", func() {
- failures := InterceptGomegaFailures(func() {
- Expect("foo").Should(Say("foo"))
- })
- Expect(failures[0]).Should(ContainSubstring("*gbytes.Buffer"))
- })
- })
-
- Context("when a match is found", func() {
- It("should succeed", func() {
- Expect(buffer).Should(Say("abc"))
- })
-
- It("should support printf-like formatting", func() {
- Expect(buffer).Should(Say("a%sc", "b"))
- })
-
- It("should match literal %", func() {
- buffer.Write([]byte("%"))
- Expect(buffer).Should(Say("abc%"))
- })
-
- It("should use a regular expression", func() {
- Expect(buffer).Should(Say("a.c"))
- })
-
- It("should fastforward the buffer", func() {
- buffer.Write([]byte("def"))
- Expect(buffer).Should(Say("abcd"))
- Expect(buffer).Should(Say("ef"))
- Expect(buffer).ShouldNot(Say("[a-z]"))
- })
- })
-
- Context("when no match is found", func() {
- It("should not error", func() {
- Expect(buffer).ShouldNot(Say("def"))
- })
-
- Context("when the buffer is closed", func() {
- BeforeEach(func() {
- buffer.Close()
- })
-
- It("should abort an eventually", func() {
- t := time.Now()
- failures := InterceptGomegaFailures(func() {
- Eventually(buffer).Should(Say("def"))
- })
- Eventually(buffer).ShouldNot(Say("def"))
- Expect(time.Since(t)).Should(BeNumerically("<", 500*time.Millisecond))
- Expect(failures).Should(HaveLen(1))
-
- t = time.Now()
- Eventually(buffer).Should(Say("abc"))
- Expect(time.Since(t)).Should(BeNumerically("<", 500*time.Millisecond))
- })
-
- It("should abort a consistently", func() {
- t := time.Now()
- Consistently(buffer, 2.0).ShouldNot(Say("def"))
- Expect(time.Since(t)).Should(BeNumerically("<", 500*time.Millisecond))
- })
-
- It("should not error with a synchronous matcher", func() {
- Expect(buffer).ShouldNot(Say("def"))
- Expect(buffer).Should(Say("abc"))
- })
- })
- })
-
- Context("when a positive match fails", func() {
- It("should report where it got stuck", func() {
- Expect(buffer).Should(Say("abc"))
- buffer.Write([]byte("def"))
- failures := InterceptGomegaFailures(func() {
- Expect(buffer).Should(Say("abc"))
- })
- Expect(failures[0]).Should(ContainSubstring("Got stuck at:"))
- Expect(failures[0]).Should(ContainSubstring("def"))
- })
- })
-
- Context("when a negative match fails", func() {
- It("should report where it got stuck", func() {
- failures := InterceptGomegaFailures(func() {
- Expect(buffer).ShouldNot(Say("abc"))
- })
- Expect(failures[0]).Should(ContainSubstring("Saw:"))
- Expect(failures[0]).Should(ContainSubstring("Which matches the unexpected:"))
- Expect(failures[0]).Should(ContainSubstring("abc"))
- })
- })
-
- Context("when a match is not found", func() {
- It("should not fastforward the buffer", func() {
- Expect(buffer).ShouldNot(Say("def"))
- Expect(buffer).Should(Say("abc"))
- })
- })
-
- Context("a nice real-life example", func() {
- It("should behave well", func() {
- Expect(buffer).Should(Say("abc"))
- go func() {
- time.Sleep(10 * time.Millisecond)
- buffer.Write([]byte("def"))
- }()
- Expect(buffer).ShouldNot(Say("def"))
- Eventually(buffer).Should(Say("def"))
- })
- })
-
- Context("when actual is a BufferProvider", func() {
- It("should use actual's buffer", func() {
- s := &speaker{
- buffer: NewBuffer(),
- }
-
- Expect(s).ShouldNot(Say("abc"))
-
- s.Buffer().Write([]byte("abc"))
- Expect(s).Should(Say("abc"))
- })
-
- It("should abort an eventually", func() {
- s := &speaker{
- buffer: NewBuffer(),
- }
-
- s.buffer.Close()
-
- t := time.Now()
- failures := InterceptGomegaFailures(func() {
- Eventually(s).Should(Say("def"))
- })
- Expect(failures).Should(HaveLen(1))
- Expect(time.Since(t)).Should(BeNumerically("<", 500*time.Millisecond))
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/gexec/_fixture/firefly/main.go b/vendor/github.com/onsi/gomega/gexec/_fixture/firefly/main.go
deleted file mode 100644
index 16091c22b..000000000
--- a/vendor/github.com/onsi/gomega/gexec/_fixture/firefly/main.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package main
-
-import (
- "fmt"
- "math/rand"
- "os"
- "strconv"
- "time"
-)
-
-var outQuote = "We've done the impossible, and that makes us mighty."
-var errQuote = "Ah, curse your sudden but inevitable betrayal!"
-
-var randomQuotes = []string{
- "Can we maybe vote on the whole murdering people issue?",
- "I swear by my pretty floral bonnet, I will end you.",
- "My work's illegal, but at least it's honest.",
-}
-
-func main() {
- fmt.Fprintln(os.Stdout, outQuote)
- fmt.Fprintln(os.Stderr, errQuote)
-
- randomIndex := rand.New(rand.NewSource(time.Now().UnixNano())).Intn(len(randomQuotes))
-
- time.Sleep(100 * time.Millisecond)
-
- fmt.Fprintln(os.Stdout, randomQuotes[randomIndex])
-
- if len(os.Args) == 2 {
- exitCode, _ := strconv.Atoi(os.Args[1])
- os.Exit(exitCode)
- } else {
- os.Exit(randomIndex)
- }
-}
diff --git a/vendor/github.com/onsi/gomega/gexec/build_test.go b/vendor/github.com/onsi/gomega/gexec/build_test.go
deleted file mode 100644
index 295dac8bc..000000000
--- a/vendor/github.com/onsi/gomega/gexec/build_test.go
+++ /dev/null
@@ -1,112 +0,0 @@
-package gexec_test
-
-import (
- "fmt"
- "io/ioutil"
- "os"
- "path/filepath"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- "github.com/onsi/gomega/gexec"
-)
-
-var packagePath = "./_fixture/firefly"
-
-var _ = Describe(".Build", func() {
- Context("when there have been previous calls to Build", func() {
- BeforeEach(func() {
- _, err := gexec.Build(packagePath)
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- It("compiles the specified package", func() {
- compiledPath, err := gexec.Build(packagePath)
- Expect(err).ShouldNot(HaveOccurred())
- Expect(compiledPath).Should(BeAnExistingFile())
- })
-
- Context("and CleanupBuildArtifacts has been called", func() {
- BeforeEach(func() {
- gexec.CleanupBuildArtifacts()
- })
-
- It("compiles the specified package", func() {
- var err error
- fireflyPath, err = gexec.Build(packagePath)
- Expect(err).ShouldNot(HaveOccurred())
- Expect(fireflyPath).Should(BeAnExistingFile())
- })
- })
- })
-})
-
-var _ = Describe(".BuildWithEnvironment", func() {
- var err error
- env := []string{
- "GOOS=linux",
- "GOARCH=amd64",
- }
-
- It("compiles the specified package with the specified env vars", func() {
- compiledPath, err := gexec.BuildWithEnvironment(packagePath, env)
- Expect(err).ShouldNot(HaveOccurred())
- Expect(compiledPath).Should(BeAnExistingFile())
- })
-
- It("returns the environment to a good state", func() {
- _, err = gexec.BuildWithEnvironment(packagePath, env)
- Expect(err).ShouldNot(HaveOccurred())
- Expect(os.Environ()).ShouldNot(ContainElement("GOOS=linux"))
- })
-})
-
-var _ = Describe(".BuildIn", func() {
- const (
- target = "github.com/onsi/gomega/gexec/_fixture/firefly/"
- )
-
- var (
- original string
- gopath string
- )
-
- BeforeEach(func() {
- var err error
- original = os.Getenv("GOPATH")
- gopath, err = ioutil.TempDir("", "")
- Expect(err).NotTo(HaveOccurred())
- copyFile(filepath.Join("_fixture", "firefly", "main.go"), filepath.Join(gopath, "src", target), "main.go")
- Expect(os.Setenv("GOPATH", filepath.Join(os.TempDir(), "emptyFakeGopath"))).To(Succeed())
- Expect(os.Environ()).To(ContainElement(fmt.Sprintf("GOPATH=%s", filepath.Join(os.TempDir(), "emptyFakeGopath"))))
- })
-
- AfterEach(func() {
- if original == "" {
- Expect(os.Unsetenv("GOPATH")).To(Succeed())
- } else {
- Expect(os.Setenv("GOPATH", original)).To(Succeed())
- }
- if gopath != "" {
- os.RemoveAll(gopath)
- }
- })
-
- It("appends the gopath env var", func() {
- _, err := gexec.BuildIn(gopath, target)
- Expect(err).NotTo(HaveOccurred())
- })
-
- It("resets GOPATH to its original value", func() {
- _, err := gexec.BuildIn(gopath, target)
- Expect(err).NotTo(HaveOccurred())
- Expect(os.Getenv("GOPATH")).To(Equal(filepath.Join(os.TempDir(), "emptyFakeGopath")))
- })
-})
-
-func copyFile(source, directory, basename string) {
- Expect(os.MkdirAll(directory, 0755)).To(Succeed())
- content, err := ioutil.ReadFile(source)
- Expect(err).NotTo(HaveOccurred())
- Expect(ioutil.WriteFile(filepath.Join(directory, basename), content, 0644)).To(Succeed())
-}
diff --git a/vendor/github.com/onsi/gomega/gexec/exit_matcher_test.go b/vendor/github.com/onsi/gomega/gexec/exit_matcher_test.go
deleted file mode 100644
index 9abc3226f..000000000
--- a/vendor/github.com/onsi/gomega/gexec/exit_matcher_test.go
+++ /dev/null
@@ -1,114 +0,0 @@
-package gexec_test
-
-import (
- "os/exec"
- "time"
-
- . "github.com/onsi/gomega/gexec"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-)
-
-type NeverExits struct{}
-
-func (e NeverExits) ExitCode() int {
- return -1
-}
-
-var _ = Describe("ExitMatcher", func() {
- var command *exec.Cmd
- var session *Session
-
- BeforeEach(func() {
- var err error
- command = exec.Command(fireflyPath, "0")
- session, err = Start(command, nil, nil)
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- Describe("when passed something that is an Exiter", func() {
- It("should act normally", func() {
- failures := InterceptGomegaFailures(func() {
- Expect(NeverExits{}).Should(Exit())
- })
-
- Expect(failures[0]).Should(ContainSubstring("Expected process to exit. It did not."))
- })
- })
-
- Describe("when passed something that is not an Exiter", func() {
- It("should error", func() {
- failures := InterceptGomegaFailures(func() {
- Expect("aardvark").Should(Exit())
- })
-
- Expect(failures[0]).Should(ContainSubstring("Exit must be passed a gexec.Exiter"))
- })
- })
-
- Context("with no exit code", func() {
- It("should say the right things when it fails", func() {
- Expect(session).ShouldNot(Exit())
-
- failures := InterceptGomegaFailures(func() {
- Expect(session).Should(Exit())
- })
-
- Expect(failures[0]).Should(ContainSubstring("Expected process to exit. It did not."))
-
- Eventually(session).Should(Exit())
-
- Expect(session).Should(Exit())
-
- failures = InterceptGomegaFailures(func() {
- Expect(session).ShouldNot(Exit())
- })
-
- Expect(failures[0]).Should(ContainSubstring("Expected process not to exit. It did."))
- })
- })
-
- Context("with an exit code", func() {
- It("should say the right things when it fails", func() {
- Expect(session).ShouldNot(Exit(0))
- Expect(session).ShouldNot(Exit(1))
-
- failures := InterceptGomegaFailures(func() {
- Expect(session).Should(Exit(0))
- })
-
- Expect(failures[0]).Should(ContainSubstring("Expected process to exit. It did not."))
-
- Eventually(session).Should(Exit(0))
-
- Expect(session).Should(Exit(0))
-
- failures = InterceptGomegaFailures(func() {
- Expect(session).Should(Exit(1))
- })
-
- Expect(failures[0]).Should(ContainSubstring("to match exit code:"))
-
- Expect(session).ShouldNot(Exit(1))
-
- failures = InterceptGomegaFailures(func() {
- Expect(session).ShouldNot(Exit(0))
- })
-
- Expect(failures[0]).Should(ContainSubstring("not to match exit code:"))
- })
- })
-
- Describe("bailing out early", func() {
- It("should bail out early once the process exits", func() {
- t := time.Now()
-
- failures := InterceptGomegaFailures(func() {
- Eventually(session).Should(Exit(1))
- })
- Expect(time.Since(t)).Should(BeNumerically("<=", 500*time.Millisecond))
- Expect(failures).Should(HaveLen(1))
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/gexec/gexec_suite_test.go b/vendor/github.com/onsi/gomega/gexec/gexec_suite_test.go
deleted file mode 100644
index dc8e1f40c..000000000
--- a/vendor/github.com/onsi/gomega/gexec/gexec_suite_test.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package gexec_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- "github.com/onsi/gomega/gexec"
-
- "testing"
-)
-
-var fireflyPath string
-
-func TestGexec(t *testing.T) {
- BeforeSuite(func() {
- var err error
- fireflyPath, err = gexec.Build("./_fixture/firefly")
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- AfterSuite(func() {
- gexec.CleanupBuildArtifacts()
- })
-
- RegisterFailHandler(Fail)
- RunSpecs(t, "Gexec Suite")
-}
diff --git a/vendor/github.com/onsi/gomega/gexec/prefixed_writer_test.go b/vendor/github.com/onsi/gomega/gexec/prefixed_writer_test.go
deleted file mode 100644
index e847b1501..000000000
--- a/vendor/github.com/onsi/gomega/gexec/prefixed_writer_test.go
+++ /dev/null
@@ -1,43 +0,0 @@
-package gexec_test
-
-import (
- "bytes"
-
- . "github.com/onsi/gomega/gexec"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-)
-
-var _ = Describe("PrefixedWriter", func() {
- var buffer *bytes.Buffer
- var writer *PrefixedWriter
- BeforeEach(func() {
- buffer = &bytes.Buffer{}
- writer = NewPrefixedWriter("[p]", buffer)
- })
-
- It("should emit the prefix on newlines", func() {
- writer.Write([]byte("abc"))
- writer.Write([]byte("def\n"))
- writer.Write([]byte("hij\n"))
- writer.Write([]byte("\n\n"))
- writer.Write([]byte("klm\n\nnop"))
- writer.Write([]byte(""))
- writer.Write([]byte("qrs"))
- writer.Write([]byte("\ntuv\nwx"))
- writer.Write([]byte("yz\n\n"))
-
- Expect(buffer.String()).Should(Equal(`[p]abcdef
-[p]hij
-[p]
-[p]
-[p]klm
-[p]
-[p]nopqrs
-[p]tuv
-[p]wxyz
-[p]
-`))
- })
-})
diff --git a/vendor/github.com/onsi/gomega/gexec/session_test.go b/vendor/github.com/onsi/gomega/gexec/session_test.go
deleted file mode 100644
index 6fdf22d21..000000000
--- a/vendor/github.com/onsi/gomega/gexec/session_test.go
+++ /dev/null
@@ -1,336 +0,0 @@
-package gexec_test
-
-import (
- "io"
- "io/ioutil"
- "os/exec"
- "syscall"
- "time"
-
- . "github.com/onsi/gomega/gbytes"
- . "github.com/onsi/gomega/gexec"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-)
-
-var _ = Describe("Session", func() {
- var command *exec.Cmd
- var session *Session
-
- var outWriter, errWriter io.Writer
-
- BeforeEach(func() {
- outWriter = nil
- errWriter = nil
- })
-
- JustBeforeEach(func() {
- command = exec.Command(fireflyPath)
- var err error
- session, err = Start(command, outWriter, errWriter)
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- Context("running a command", func() {
- It("should start the process", func() {
- Expect(command.Process).ShouldNot(BeNil())
- })
-
- It("should wrap the process's stdout and stderr with gbytes buffers", func(done Done) {
- Eventually(session.Out).Should(Say("We've done the impossible, and that makes us mighty"))
- Eventually(session.Err).Should(Say("Ah, curse your sudden but inevitable betrayal!"))
- defer session.Out.CancelDetects()
-
- select {
- case <-session.Out.Detect("Can we maybe vote on the whole murdering people issue"):
- Eventually(session).Should(Exit(0))
- case <-session.Out.Detect("I swear by my pretty floral bonnet, I will end you."):
- Eventually(session).Should(Exit(1))
- case <-session.Out.Detect("My work's illegal, but at least it's honest."):
- Eventually(session).Should(Exit(2))
- }
-
- close(done)
- })
-
- It("should satisfy the gbytes.BufferProvider interface, passing Stdout", func() {
- Eventually(session).Should(Say("We've done the impossible, and that makes us mighty"))
- Eventually(session).Should(Exit())
- })
- })
-
- Describe("providing the exit code", func() {
- It("should provide the app's exit code", func() {
- Expect(session.ExitCode()).Should(Equal(-1))
-
- Eventually(session).Should(Exit())
- Expect(session.ExitCode()).Should(BeNumerically(">=", 0))
- Expect(session.ExitCode()).Should(BeNumerically("<", 3))
- })
- })
-
- Describe("wait", func() {
- It("should wait till the command exits", func() {
- Expect(session.ExitCode()).Should(Equal(-1))
- Expect(session.Wait().ExitCode()).Should(BeNumerically(">=", 0))
- Expect(session.Wait().ExitCode()).Should(BeNumerically("<", 3))
- })
- })
-
- Describe("exited", func() {
- It("should close when the command exits", func() {
- Eventually(session.Exited).Should(BeClosed())
- Expect(session.ExitCode()).ShouldNot(Equal(-1))
- })
- })
-
- Describe("kill", func() {
- It("should kill the command", func() {
- session, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- session.Kill()
- Eventually(session).Should(Exit(128 + 9))
- })
- })
-
- Describe("interrupt", func() {
- It("should interrupt the command", func() {
- session, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- session.Interrupt()
- Eventually(session).Should(Exit(128 + 2))
- })
- })
-
- Describe("terminate", func() {
- It("should terminate the command", func() {
- session, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- session.Terminate()
- Eventually(session).Should(Exit(128 + 15))
- })
- })
-
- Describe("signal", func() {
- It("should send the signal to the command", func() {
- session, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- session.Signal(syscall.SIGABRT)
- Eventually(session).Should(Exit(128 + 6))
- })
-
- It("should ignore sending a signal if the command did not start", func() {
- session, err := Start(exec.Command("notexisting"), GinkgoWriter, GinkgoWriter)
- Expect(err).To(HaveOccurred())
-
- Expect(func() { session.Signal(syscall.SIGUSR1) }).NotTo(Panic())
- })
- })
-
- Context("tracking sessions", func() {
- BeforeEach(func() {
- KillAndWait()
- })
-
- Describe("kill", func() {
- It("should kill all the started sessions", func() {
- session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- Kill()
-
- Eventually(session1).Should(Exit(128 + 9))
- Eventually(session2).Should(Exit(128 + 9))
- Eventually(session3).Should(Exit(128 + 9))
- })
-
- It("should not track unstarted sessions", func() {
- _, err := Start(exec.Command("does not exist", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).Should(HaveOccurred())
-
- session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- Kill()
-
- Eventually(session2).Should(Exit(128 + 9))
- Eventually(session3).Should(Exit(128 + 9))
- })
-
- })
-
- Describe("killAndWait", func() {
- It("should kill all the started sessions and wait for them to finish", func() {
- session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- KillAndWait()
- Expect(session1).Should(Exit(128+9), "Should have exited")
- Expect(session2).Should(Exit(128+9), "Should have exited")
- Expect(session3).Should(Exit(128+9), "Should have exited")
- })
- })
-
- Describe("terminate", func() {
- It("should terminate all the started sessions", func() {
- session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- Terminate()
-
- Eventually(session1).Should(Exit(128 + 15))
- Eventually(session2).Should(Exit(128 + 15))
- Eventually(session3).Should(Exit(128 + 15))
- })
- })
-
- Describe("terminateAndWait", func() {
- It("should terminate all the started sessions, and wait for them to exit", func() {
- session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- TerminateAndWait()
-
- Expect(session1).Should(Exit(128+15), "Should have exited")
- Expect(session2).Should(Exit(128+15), "Should have exited")
- Expect(session3).Should(Exit(128+15), "Should have exited")
- })
- })
-
- Describe("signal", func() {
- It("should signal all the started sessions", func() {
- session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- Signal(syscall.SIGABRT)
-
- Eventually(session1).Should(Exit(128 + 6))
- Eventually(session2).Should(Exit(128 + 6))
- Eventually(session3).Should(Exit(128 + 6))
- })
- })
-
- Describe("interrupt", func() {
- It("should interrupt all the started sessions, and not wait", func() {
- session1, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- session2, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- session3, err := Start(exec.Command("sleep", "10000000"), GinkgoWriter, GinkgoWriter)
- Expect(err).ShouldNot(HaveOccurred())
-
- Interrupt()
-
- Eventually(session1).Should(Exit(128 + 2))
- Eventually(session2).Should(Exit(128 + 2))
- Eventually(session3).Should(Exit(128 + 2))
- })
- })
- })
-
- Context("when the command exits", func() {
- It("should close the buffers", func() {
- Eventually(session).Should(Exit())
-
- Expect(session.Out.Closed()).Should(BeTrue())
- Expect(session.Err.Closed()).Should(BeTrue())
-
- Expect(session.Out).Should(Say("We've done the impossible, and that makes us mighty"))
- })
-
- var So = It
-
- So("this means that eventually should short circuit", func() {
- t := time.Now()
- failures := InterceptGomegaFailures(func() {
- Eventually(session).Should(Say("blah blah blah blah blah"))
- })
- Expect(time.Since(t)).Should(BeNumerically("<=", 500*time.Millisecond))
- Expect(failures).Should(HaveLen(1))
- })
- })
-
- Context("when wrapping out and err", func() {
- var (
- outWriterBuffer, errWriterBuffer *Buffer
- )
-
- BeforeEach(func() {
- outWriterBuffer = NewBuffer()
- outWriter = outWriterBuffer
- errWriterBuffer = NewBuffer()
- errWriter = errWriterBuffer
- })
-
- It("should route to both the provided writers and the gbytes buffers", func() {
- Eventually(session.Out).Should(Say("We've done the impossible, and that makes us mighty"))
- Eventually(session.Err).Should(Say("Ah, curse your sudden but inevitable betrayal!"))
-
- Expect(outWriterBuffer.Contents()).Should(ContainSubstring("We've done the impossible, and that makes us mighty"))
- Expect(errWriterBuffer.Contents()).Should(ContainSubstring("Ah, curse your sudden but inevitable betrayal!"))
-
- Eventually(session).Should(Exit())
-
- Expect(outWriterBuffer.Contents()).Should(Equal(session.Out.Contents()))
- Expect(errWriterBuffer.Contents()).Should(Equal(session.Err.Contents()))
- })
-
- Context("when discarding the output of the command", func() {
- BeforeEach(func() {
- outWriter = ioutil.Discard
- errWriter = ioutil.Discard
- })
-
- It("executes succesfuly", func() {
- Eventually(session).Should(Exit())
- })
- })
- })
-
- Describe("when the command fails to start", func() {
- It("should return an error", func() {
- _, err := Start(exec.Command("agklsjdfas"), nil, nil)
- Expect(err).Should(HaveOccurred())
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/ghttp/handlers.go b/vendor/github.com/onsi/gomega/ghttp/handlers.go
deleted file mode 100644
index 894eae6d4..000000000
--- a/vendor/github.com/onsi/gomega/ghttp/handlers.go
+++ /dev/null
@@ -1,322 +0,0 @@
-package ghttp
-
-import (
- "encoding/base64"
- "encoding/json"
- "fmt"
- "io/ioutil"
- "net/http"
- "net/url"
- "reflect"
- "strings"
-
- "github.com/golang/protobuf/proto"
- . "github.com/onsi/gomega"
- "github.com/onsi/gomega/types"
-)
-
-//CombineHandler takes variadic list of handlers and produces one handler
-//that calls each handler in order.
-func CombineHandlers(handlers ...http.HandlerFunc) http.HandlerFunc {
- return func(w http.ResponseWriter, req *http.Request) {
- for _, handler := range handlers {
- handler(w, req)
- }
- }
-}
-
-//VerifyRequest returns a handler that verifies that a request uses the specified method to connect to the specified path
-//You may also pass in an optional rawQuery string which is tested against the request's `req.URL.RawQuery`
-//
-//For path, you may pass in a string, in which case strict equality will be applied
-//Alternatively you can pass in a matcher (ContainSubstring("/foo") and MatchRegexp("/foo/[a-f0-9]+") for example)
-func VerifyRequest(method string, path interface{}, rawQuery ...string) http.HandlerFunc {
- return func(w http.ResponseWriter, req *http.Request) {
- Expect(req.Method).Should(Equal(method), "Method mismatch")
- switch p := path.(type) {
- case types.GomegaMatcher:
- Expect(req.URL.Path).Should(p, "Path mismatch")
- default:
- Expect(req.URL.Path).Should(Equal(path), "Path mismatch")
- }
- if len(rawQuery) > 0 {
- values, err := url.ParseQuery(rawQuery[0])
- Expect(err).ShouldNot(HaveOccurred(), "Expected RawQuery is malformed")
-
- Expect(req.URL.Query()).Should(Equal(values), "RawQuery mismatch")
- }
- }
-}
-
-//VerifyContentType returns a handler that verifies that a request has a Content-Type header set to the
-//specified value
-func VerifyContentType(contentType string) http.HandlerFunc {
- return func(w http.ResponseWriter, req *http.Request) {
- Expect(req.Header.Get("Content-Type")).Should(Equal(contentType))
- }
-}
-
-//VerifyMimeType returns a handler that verifies that a request has a specified mime type set
-//in Content-Type header
-func VerifyMimeType(mimeType string) http.HandlerFunc {
- return func(w http.ResponseWriter, req *http.Request) {
- Expect(strings.Split(req.Header.Get("Content-Type"), ";")[0]).Should(Equal(mimeType))
- }
-}
-
-//VerifyBasicAuth returns a handler that verifies the request contains a BasicAuth Authorization header
-//matching the passed in username and password
-func VerifyBasicAuth(username string, password string) http.HandlerFunc {
- return func(w http.ResponseWriter, req *http.Request) {
- auth := req.Header.Get("Authorization")
- Expect(auth).ShouldNot(Equal(""), "Authorization header must be specified")
-
- decoded, err := base64.StdEncoding.DecodeString(auth[6:])
- Expect(err).ShouldNot(HaveOccurred())
-
- Expect(string(decoded)).Should(Equal(fmt.Sprintf("%s:%s", username, password)), "Authorization mismatch")
- }
-}
-
-//VerifyHeader returns a handler that verifies the request contains the passed in headers.
-//The passed in header keys are first canonicalized via http.CanonicalHeaderKey.
-//
-//The request must contain *all* the passed in headers, but it is allowed to have additional headers
-//beyond the passed in set.
-func VerifyHeader(header http.Header) http.HandlerFunc {
- return func(w http.ResponseWriter, req *http.Request) {
- for key, values := range header {
- key = http.CanonicalHeaderKey(key)
- Expect(req.Header[key]).Should(Equal(values), "Header mismatch for key: %s", key)
- }
- }
-}
-
-//VerifyHeaderKV returns a handler that verifies the request contains a header matching the passed in key and values
-//(recall that a `http.Header` is a mapping from string (key) to []string (values))
-//It is a convenience wrapper around `VerifyHeader` that allows you to avoid having to create an `http.Header` object.
-func VerifyHeaderKV(key string, values ...string) http.HandlerFunc {
- return VerifyHeader(http.Header{key: values})
-}
-
-//VerifyBody returns a handler that verifies that the body of the request matches the passed in byte array.
-//It does this using Equal().
-func VerifyBody(expectedBody []byte) http.HandlerFunc {
- return CombineHandlers(
- func(w http.ResponseWriter, req *http.Request) {
- body, err := ioutil.ReadAll(req.Body)
- req.Body.Close()
- Expect(err).ShouldNot(HaveOccurred())
- Expect(body).Should(Equal(expectedBody), "Body Mismatch")
- },
- )
-}
-
-//VerifyJSON returns a handler that verifies that the body of the request is a valid JSON representation
-//matching the passed in JSON string. It does this using Gomega's MatchJSON method
-//
-//VerifyJSON also verifies that the request's content type is application/json
-func VerifyJSON(expectedJSON string) http.HandlerFunc {
- return CombineHandlers(
- VerifyMimeType("application/json"),
- func(w http.ResponseWriter, req *http.Request) {
- body, err := ioutil.ReadAll(req.Body)
- req.Body.Close()
- Expect(err).ShouldNot(HaveOccurred())
- Expect(body).Should(MatchJSON(expectedJSON), "JSON Mismatch")
- },
- )
-}
-
-//VerifyJSONRepresenting is similar to VerifyJSON. Instead of taking a JSON string, however, it
-//takes an arbitrary JSON-encodable object and verifies that the requests's body is a JSON representation
-//that matches the object
-func VerifyJSONRepresenting(object interface{}) http.HandlerFunc {
- data, err := json.Marshal(object)
- Expect(err).ShouldNot(HaveOccurred())
- return CombineHandlers(
- VerifyContentType("application/json"),
- VerifyJSON(string(data)),
- )
-}
-
-//VerifyForm returns a handler that verifies a request contains the specified form values.
-//
-//The request must contain *all* of the specified values, but it is allowed to have additional
-//form values beyond the passed in set.
-func VerifyForm(values url.Values) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- err := r.ParseForm()
- Expect(err).ShouldNot(HaveOccurred())
- for key, vals := range values {
- Expect(r.Form[key]).Should(Equal(vals), "Form mismatch for key: %s", key)
- }
- }
-}
-
-//VerifyFormKV returns a handler that verifies a request contains a form key with the specified values.
-//
-//It is a convenience wrapper around `VerifyForm` that lets you avoid having to create a `url.Values` object.
-func VerifyFormKV(key string, values ...string) http.HandlerFunc {
- return VerifyForm(url.Values{key: values})
-}
-
-//VerifyProtoRepresenting returns a handler that verifies that the body of the request is a valid protobuf
-//representation of the passed message.
-//
-//VerifyProtoRepresenting also verifies that the request's content type is application/x-protobuf
-func VerifyProtoRepresenting(expected proto.Message) http.HandlerFunc {
- return CombineHandlers(
- VerifyContentType("application/x-protobuf"),
- func(w http.ResponseWriter, req *http.Request) {
- body, err := ioutil.ReadAll(req.Body)
- Expect(err).ShouldNot(HaveOccurred())
- req.Body.Close()
-
- expectedType := reflect.TypeOf(expected)
- actualValuePtr := reflect.New(expectedType.Elem())
-
- actual, ok := actualValuePtr.Interface().(proto.Message)
- Expect(ok).Should(BeTrue(), "Message value is not a proto.Message")
-
- err = proto.Unmarshal(body, actual)
- Expect(err).ShouldNot(HaveOccurred(), "Failed to unmarshal protobuf")
-
- Expect(actual).Should(Equal(expected), "ProtoBuf Mismatch")
- },
- )
-}
-
-func copyHeader(src http.Header, dst http.Header) {
- for key, value := range src {
- dst[key] = value
- }
-}
-
-/*
-RespondWith returns a handler that responds to a request with the specified status code and body
-
-Body may be a string or []byte
-
-Also, RespondWith can be given an optional http.Header. The headers defined therein will be added to the response headers.
-*/
-func RespondWith(statusCode int, body interface{}, optionalHeader ...http.Header) http.HandlerFunc {
- return func(w http.ResponseWriter, req *http.Request) {
- if len(optionalHeader) == 1 {
- copyHeader(optionalHeader[0], w.Header())
- }
- w.WriteHeader(statusCode)
- switch x := body.(type) {
- case string:
- w.Write([]byte(x))
- case []byte:
- w.Write(x)
- default:
- Expect(body).Should(BeNil(), "Invalid type for body. Should be string or []byte.")
- }
- }
-}
-
-/*
-RespondWithPtr returns a handler that responds to a request with the specified status code and body
-
-Unlike RespondWith, you pass RepondWithPtr a pointer to the status code and body allowing different tests
-to share the same setup but specify different status codes and bodies.
-
-Also, RespondWithPtr can be given an optional http.Header. The headers defined therein will be added to the response headers.
-Since the http.Header can be mutated after the fact you don't need to pass in a pointer.
-*/
-func RespondWithPtr(statusCode *int, body interface{}, optionalHeader ...http.Header) http.HandlerFunc {
- return func(w http.ResponseWriter, req *http.Request) {
- if len(optionalHeader) == 1 {
- copyHeader(optionalHeader[0], w.Header())
- }
- w.WriteHeader(*statusCode)
- if body != nil {
- switch x := (body).(type) {
- case *string:
- w.Write([]byte(*x))
- case *[]byte:
- w.Write(*x)
- default:
- Expect(body).Should(BeNil(), "Invalid type for body. Should be string or []byte.")
- }
- }
- }
-}
-
-/*
-RespondWithJSONEncoded returns a handler that responds to a request with the specified status code and a body
-containing the JSON-encoding of the passed in object
-
-Also, RespondWithJSONEncoded can be given an optional http.Header. The headers defined therein will be added to the response headers.
-*/
-func RespondWithJSONEncoded(statusCode int, object interface{}, optionalHeader ...http.Header) http.HandlerFunc {
- data, err := json.Marshal(object)
- Expect(err).ShouldNot(HaveOccurred())
-
- var headers http.Header
- if len(optionalHeader) == 1 {
- headers = optionalHeader[0]
- } else {
- headers = make(http.Header)
- }
- if _, found := headers["Content-Type"]; !found {
- headers["Content-Type"] = []string{"application/json"}
- }
- return RespondWith(statusCode, string(data), headers)
-}
-
-/*
-RespondWithJSONEncodedPtr behaves like RespondWithJSONEncoded but takes a pointer
-to a status code and object.
-
-This allows different tests to share the same setup but specify different status codes and JSON-encoded
-objects.
-
-Also, RespondWithJSONEncodedPtr can be given an optional http.Header. The headers defined therein will be added to the response headers.
-Since the http.Header can be mutated after the fact you don't need to pass in a pointer.
-*/
-func RespondWithJSONEncodedPtr(statusCode *int, object interface{}, optionalHeader ...http.Header) http.HandlerFunc {
- return func(w http.ResponseWriter, req *http.Request) {
- data, err := json.Marshal(object)
- Expect(err).ShouldNot(HaveOccurred())
- var headers http.Header
- if len(optionalHeader) == 1 {
- headers = optionalHeader[0]
- } else {
- headers = make(http.Header)
- }
- if _, found := headers["Content-Type"]; !found {
- headers["Content-Type"] = []string{"application/json"}
- }
- copyHeader(headers, w.Header())
- w.WriteHeader(*statusCode)
- w.Write(data)
- }
-}
-
-//RespondWithProto returns a handler that responds to a request with the specified status code and a body
-//containing the protobuf serialization of the provided message.
-//
-//Also, RespondWithProto can be given an optional http.Header. The headers defined therein will be added to the response headers.
-func RespondWithProto(statusCode int, message proto.Message, optionalHeader ...http.Header) http.HandlerFunc {
- return func(w http.ResponseWriter, req *http.Request) {
- data, err := proto.Marshal(message)
- Expect(err).ShouldNot(HaveOccurred())
-
- var headers http.Header
- if len(optionalHeader) == 1 {
- headers = optionalHeader[0]
- } else {
- headers = make(http.Header)
- }
- if _, found := headers["Content-Type"]; !found {
- headers["Content-Type"] = []string{"application/x-protobuf"}
- }
- copyHeader(headers, w.Header())
-
- w.WriteHeader(statusCode)
- w.Write(data)
- }
-}
diff --git a/vendor/github.com/onsi/gomega/ghttp/protobuf/protobuf.go b/vendor/github.com/onsi/gomega/ghttp/protobuf/protobuf.go
deleted file mode 100644
index b2972bc9f..000000000
--- a/vendor/github.com/onsi/gomega/ghttp/protobuf/protobuf.go
+++ /dev/null
@@ -1,3 +0,0 @@
-package protobuf
-
-//go:generate protoc --go_out=. simple_message.proto
diff --git a/vendor/github.com/onsi/gomega/ghttp/protobuf/simple_message.pb.go b/vendor/github.com/onsi/gomega/ghttp/protobuf/simple_message.pb.go
deleted file mode 100644
index c55a48448..000000000
--- a/vendor/github.com/onsi/gomega/ghttp/protobuf/simple_message.pb.go
+++ /dev/null
@@ -1,55 +0,0 @@
-// Code generated by protoc-gen-go.
-// source: simple_message.proto
-// DO NOT EDIT!
-
-/*
-Package protobuf is a generated protocol buffer package.
-
-It is generated from these files:
- simple_message.proto
-
-It has these top-level messages:
- SimpleMessage
-*/
-package protobuf
-
-import proto "github.com/golang/protobuf/proto"
-import fmt "fmt"
-import math "math"
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-type SimpleMessage struct {
- Description *string `protobuf:"bytes,1,req,name=description" json:"description,omitempty"`
- Id *int32 `protobuf:"varint,2,req,name=id" json:"id,omitempty"`
- Metadata *string `protobuf:"bytes,3,opt,name=metadata" json:"metadata,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *SimpleMessage) Reset() { *m = SimpleMessage{} }
-func (m *SimpleMessage) String() string { return proto.CompactTextString(m) }
-func (*SimpleMessage) ProtoMessage() {}
-
-func (m *SimpleMessage) GetDescription() string {
- if m != nil && m.Description != nil {
- return *m.Description
- }
- return ""
-}
-
-func (m *SimpleMessage) GetId() int32 {
- if m != nil && m.Id != nil {
- return *m.Id
- }
- return 0
-}
-
-func (m *SimpleMessage) GetMetadata() string {
- if m != nil && m.Metadata != nil {
- return *m.Metadata
- }
- return ""
-}
diff --git a/vendor/github.com/onsi/gomega/ghttp/protobuf/simple_message.proto b/vendor/github.com/onsi/gomega/ghttp/protobuf/simple_message.proto
deleted file mode 100644
index 35b7145c2..000000000
--- a/vendor/github.com/onsi/gomega/ghttp/protobuf/simple_message.proto
+++ /dev/null
@@ -1,9 +0,0 @@
-syntax = "proto2";
-
-package protobuf;
-
-message SimpleMessage {
- required string description = 1;
- required int32 id = 2;
- optional string metadata = 3;
-}
diff --git a/vendor/github.com/onsi/gomega/ghttp/test_server.go b/vendor/github.com/onsi/gomega/ghttp/test_server.go
deleted file mode 100644
index 77535f309..000000000
--- a/vendor/github.com/onsi/gomega/ghttp/test_server.go
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
-Package ghttp supports testing HTTP clients by providing a test server (simply a thin wrapper around httptest's server) that supports
-registering multiple handlers. Incoming requests are not routed between the different handlers
-- rather it is merely the order of the handlers that matters. The first request is handled by the first
-registered handler, the second request by the second handler, etc.
-
-The intent here is to have each handler *verify* that the incoming request is valid. To accomplish, ghttp
-also provides a collection of bite-size handlers that each perform one aspect of request verification. These can
-be composed together and registered with a ghttp server. The result is an expressive language for describing
-the requests generated by the client under test.
-
-Here's a simple example, note that the server handler is only defined in one BeforeEach and then modified, as required, by the nested BeforeEaches.
-A more comprehensive example is available at https://onsi.github.io/gomega/#_testing_http_clients
-
- var _ = Describe("A Sprockets Client", func() {
- var server *ghttp.Server
- var client *SprocketClient
- BeforeEach(func() {
- server = ghttp.NewServer()
- client = NewSprocketClient(server.URL(), "skywalker", "tk427")
- })
-
- AfterEach(func() {
- server.Close()
- })
-
- Describe("fetching sprockets", func() {
- var statusCode int
- var sprockets []Sprocket
- BeforeEach(func() {
- statusCode = http.StatusOK
- sprockets = []Sprocket{}
- server.AppendHandlers(ghttp.CombineHandlers(
- ghttp.VerifyRequest("GET", "/sprockets"),
- ghttp.VerifyBasicAuth("skywalker", "tk427"),
- ghttp.RespondWithJSONEncodedPtr(&statusCode, &sprockets),
- ))
- })
-
- Context("when requesting all sprockets", func() {
- Context("when the response is succesful", func() {
- BeforeEach(func() {
- sprockets = []Sprocket{
- NewSprocket("Alfalfa"),
- NewSprocket("Banana"),
- }
- })
-
- It("should return the returned sprockets", func() {
- Expect(client.Sprockets()).Should(Equal(sprockets))
- })
- })
-
- Context("when the response is missing", func() {
- BeforeEach(func() {
- statusCode = http.StatusNotFound
- })
-
- It("should return an empty list of sprockets", func() {
- Expect(client.Sprockets()).Should(BeEmpty())
- })
- })
-
- Context("when the response fails to authenticate", func() {
- BeforeEach(func() {
- statusCode = http.StatusUnauthorized
- })
-
- It("should return an AuthenticationError error", func() {
- sprockets, err := client.Sprockets()
- Expect(sprockets).Should(BeEmpty())
- Expect(err).Should(MatchError(AuthenticationError))
- })
- })
-
- Context("when the response is a server failure", func() {
- BeforeEach(func() {
- statusCode = http.StatusInternalServerError
- })
-
- It("should return an InternalError error", func() {
- sprockets, err := client.Sprockets()
- Expect(sprockets).Should(BeEmpty())
- Expect(err).Should(MatchError(InternalError))
- })
- })
- })
-
- Context("when requesting some sprockets", func() {
- BeforeEach(func() {
- sprockets = []Sprocket{
- NewSprocket("Alfalfa"),
- NewSprocket("Banana"),
- }
-
- server.WrapHandler(0, ghttp.VerifyRequest("GET", "/sprockets", "filter=FOOD"))
- })
-
- It("should make the request with a filter", func() {
- Expect(client.Sprockets("food")).Should(Equal(sprockets))
- })
- })
- })
- })
-*/
-package ghttp
-
-import (
- "fmt"
- "io"
- "io/ioutil"
- "net/http"
- "net/http/httptest"
- "net/http/httputil"
- "reflect"
- "regexp"
- "strings"
- "sync"
-
- . "github.com/onsi/gomega"
-)
-
-func new() *Server {
- return &Server{
- AllowUnhandledRequests: false,
- UnhandledRequestStatusCode: http.StatusInternalServerError,
- rwMutex: &sync.RWMutex{},
- }
-}
-
-type routedHandler struct {
- method string
- pathRegexp *regexp.Regexp
- path string
- handler http.HandlerFunc
-}
-
-// NewServer returns a new `*ghttp.Server` that wraps an `httptest` server. The server is started automatically.
-func NewServer() *Server {
- s := new()
- s.HTTPTestServer = httptest.NewServer(s)
- return s
-}
-
-// NewUnstartedServer return a new, unstarted, `*ghttp.Server`. Useful for specifying a custom listener on `server.HTTPTestServer`.
-func NewUnstartedServer() *Server {
- s := new()
- s.HTTPTestServer = httptest.NewUnstartedServer(s)
- return s
-}
-
-// NewTLSServer returns a new `*ghttp.Server` that wraps an `httptest` TLS server. The server is started automatically.
-func NewTLSServer() *Server {
- s := new()
- s.HTTPTestServer = httptest.NewTLSServer(s)
- return s
-}
-
-type Server struct {
- //The underlying httptest server
- HTTPTestServer *httptest.Server
-
- //Defaults to false. If set to true, the Server will allow more requests than there are registered handlers.
- //Direct use of this property is deprecated and is likely to be removed, use GetAllowUnhandledRequests and SetAllowUnhandledRequests instead.
- AllowUnhandledRequests bool
-
- //The status code returned when receiving an unhandled request.
- //Defaults to http.StatusInternalServerError.
- //Only applies if AllowUnhandledRequests is true
- //Direct use of this property is deprecated and is likely to be removed, use GetUnhandledRequestStatusCode and SetUnhandledRequestStatusCode instead.
- UnhandledRequestStatusCode int
-
- //If provided, ghttp will log about each request received to the provided io.Writer
- //Defaults to nil
- //If you're using Ginkgo, set this to GinkgoWriter to get improved output during failures
- Writer io.Writer
-
- receivedRequests []*http.Request
- requestHandlers []http.HandlerFunc
- routedHandlers []routedHandler
-
- rwMutex *sync.RWMutex
- calls int
-}
-
-//Start() starts an unstarted ghttp server. It is a catastrophic error to call Start more than once (thanks, httptest).
-func (s *Server) Start() {
- s.HTTPTestServer.Start()
-}
-
-//URL() returns a url that will hit the server
-func (s *Server) URL() string {
- s.rwMutex.RLock()
- defer s.rwMutex.RUnlock()
- return s.HTTPTestServer.URL
-}
-
-//Addr() returns the address on which the server is listening.
-func (s *Server) Addr() string {
- s.rwMutex.RLock()
- defer s.rwMutex.RUnlock()
- return s.HTTPTestServer.Listener.Addr().String()
-}
-
-//Close() should be called at the end of each test. It spins down and cleans up the test server.
-func (s *Server) Close() {
- s.rwMutex.Lock()
- server := s.HTTPTestServer
- s.HTTPTestServer = nil
- s.rwMutex.Unlock()
-
- if server != nil {
- server.Close()
- }
-}
-
-//ServeHTTP() makes Server an http.Handler
-//When the server receives a request it handles the request in the following order:
-//
-//1. If the request matches a handler registered with RouteToHandler, that handler is called.
-//2. Otherwise, if there are handlers registered via AppendHandlers, those handlers are called in order.
-//3. If all registered handlers have been called then:
-// a) If AllowUnhandledRequests is set to true, the request will be handled with response code of UnhandledRequestStatusCode
-// b) If AllowUnhandledRequests is false, the request will not be handled and the current test will be marked as failed.
-func (s *Server) ServeHTTP(w http.ResponseWriter, req *http.Request) {
- s.rwMutex.Lock()
- defer func() {
- e := recover()
- if e != nil {
- w.WriteHeader(http.StatusInternalServerError)
- }
-
- //If the handler panics GHTTP will silently succeed. This is bad™.
- //To catch this case we need to fail the test if the handler has panicked.
- //However, if the handler is panicking because Ginkgo's causing it to panic (i.e. an assertion failed)
- //then we shouldn't double-report the error as this will confuse people.
-
- //So: step 1, if this is a Ginkgo panic - do nothing, Ginkgo's aware of the failure
- eAsString, ok := e.(string)
- if ok && strings.Contains(eAsString, "defer GinkgoRecover()") {
- return
- }
-
- //If we're here, we have to do step 2: assert that the error is nil. This assertion will
- //allow us to fail the test suite (note: we can't call Fail since Gomega is not allowed to import Ginkgo).
- //Since a failed assertion throws a panic, and we are likely in a goroutine, we need to defer within our defer!
- defer func() {
- recover()
- }()
- Expect(e).Should(BeNil(), "Handler Panicked")
- }()
-
- if s.Writer != nil {
- s.Writer.Write([]byte(fmt.Sprintf("GHTTP Received Request: %s - %s\n", req.Method, req.URL)))
- }
-
- s.receivedRequests = append(s.receivedRequests, req)
- if routedHandler, ok := s.handlerForRoute(req.Method, req.URL.Path); ok {
- s.rwMutex.Unlock()
- routedHandler(w, req)
- } else if s.calls < len(s.requestHandlers) {
- h := s.requestHandlers[s.calls]
- s.calls++
- s.rwMutex.Unlock()
- h(w, req)
- } else {
- s.rwMutex.Unlock()
- if s.GetAllowUnhandledRequests() {
- ioutil.ReadAll(req.Body)
- req.Body.Close()
- w.WriteHeader(s.GetUnhandledRequestStatusCode())
- } else {
- formatted, err := httputil.DumpRequest(req, true)
- Expect(err).NotTo(HaveOccurred(), "Encountered error while dumping HTTP request")
- Expect(string(formatted)).Should(BeNil(), "Received Unhandled Request")
- }
- }
-}
-
-//ReceivedRequests is an array containing all requests received by the server (both handled and unhandled requests)
-func (s *Server) ReceivedRequests() []*http.Request {
- s.rwMutex.RLock()
- defer s.rwMutex.RUnlock()
-
- return s.receivedRequests
-}
-
-//RouteToHandler can be used to register handlers that will always handle requests that match
-//the passed in method and path.
-//
-//The path may be either a string object or a *regexp.Regexp.
-func (s *Server) RouteToHandler(method string, path interface{}, handler http.HandlerFunc) {
- s.rwMutex.Lock()
- defer s.rwMutex.Unlock()
-
- rh := routedHandler{
- method: method,
- handler: handler,
- }
-
- switch p := path.(type) {
- case *regexp.Regexp:
- rh.pathRegexp = p
- case string:
- rh.path = p
- default:
- panic("path must be a string or a regular expression")
- }
-
- for i, existingRH := range s.routedHandlers {
- if existingRH.method == method &&
- reflect.DeepEqual(existingRH.pathRegexp, rh.pathRegexp) &&
- existingRH.path == rh.path {
- s.routedHandlers[i] = rh
- return
- }
- }
- s.routedHandlers = append(s.routedHandlers, rh)
-}
-
-func (s *Server) handlerForRoute(method string, path string) (http.HandlerFunc, bool) {
- for _, rh := range s.routedHandlers {
- if rh.method == method {
- if rh.pathRegexp != nil {
- if rh.pathRegexp.Match([]byte(path)) {
- return rh.handler, true
- }
- } else if rh.path == path {
- return rh.handler, true
- }
- }
- }
-
- return nil, false
-}
-
-//AppendHandlers will appends http.HandlerFuncs to the server's list of registered handlers. The first incoming request is handled by the first handler, the second by the second, etc...
-func (s *Server) AppendHandlers(handlers ...http.HandlerFunc) {
- s.rwMutex.Lock()
- defer s.rwMutex.Unlock()
-
- s.requestHandlers = append(s.requestHandlers, handlers...)
-}
-
-//SetHandler overrides the registered handler at the passed in index with the passed in handler
-//This is useful, for example, when a server has been set up in a shared context, but must be tweaked
-//for a particular test.
-func (s *Server) SetHandler(index int, handler http.HandlerFunc) {
- s.rwMutex.Lock()
- defer s.rwMutex.Unlock()
-
- s.requestHandlers[index] = handler
-}
-
-//GetHandler returns the handler registered at the passed in index.
-func (s *Server) GetHandler(index int) http.HandlerFunc {
- s.rwMutex.RLock()
- defer s.rwMutex.RUnlock()
-
- return s.requestHandlers[index]
-}
-
-func (s *Server) Reset() {
- s.rwMutex.Lock()
- defer s.rwMutex.Unlock()
-
- s.HTTPTestServer.CloseClientConnections()
- s.calls = 0
- s.receivedRequests = nil
- s.requestHandlers = nil
- s.routedHandlers = nil
-}
-
-//WrapHandler combines the passed in handler with the handler registered at the passed in index.
-//This is useful, for example, when a server has been set up in a shared context but must be tweaked
-//for a particular test.
-//
-//If the currently registered handler is A, and the new passed in handler is B then
-//WrapHandler will generate a new handler that first calls A, then calls B, and assign it to index
-func (s *Server) WrapHandler(index int, handler http.HandlerFunc) {
- existingHandler := s.GetHandler(index)
- s.SetHandler(index, CombineHandlers(existingHandler, handler))
-}
-
-func (s *Server) CloseClientConnections() {
- s.rwMutex.Lock()
- defer s.rwMutex.Unlock()
-
- s.HTTPTestServer.CloseClientConnections()
-}
-
-//SetAllowUnhandledRequests enables the server to accept unhandled requests.
-func (s *Server) SetAllowUnhandledRequests(allowUnhandledRequests bool) {
- s.rwMutex.Lock()
- defer s.rwMutex.Unlock()
-
- s.AllowUnhandledRequests = allowUnhandledRequests
-}
-
-//GetAllowUnhandledRequests returns true if the server accepts unhandled requests.
-func (s *Server) GetAllowUnhandledRequests() bool {
- s.rwMutex.RLock()
- defer s.rwMutex.RUnlock()
-
- return s.AllowUnhandledRequests
-}
-
-//SetUnhandledRequestStatusCode status code to be returned when the server receives unhandled requests
-func (s *Server) SetUnhandledRequestStatusCode(statusCode int) {
- s.rwMutex.Lock()
- defer s.rwMutex.Unlock()
-
- s.UnhandledRequestStatusCode = statusCode
-}
-
-//GetUnhandledRequestStatusCode returns the current status code being returned for unhandled requests
-func (s *Server) GetUnhandledRequestStatusCode() int {
- s.rwMutex.RLock()
- defer s.rwMutex.RUnlock()
-
- return s.UnhandledRequestStatusCode
-}
diff --git a/vendor/github.com/onsi/gomega/ghttp/test_server_suite_test.go b/vendor/github.com/onsi/gomega/ghttp/test_server_suite_test.go
deleted file mode 100644
index 7c1236082..000000000
--- a/vendor/github.com/onsi/gomega/ghttp/test_server_suite_test.go
+++ /dev/null
@@ -1,13 +0,0 @@
-package ghttp_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-
- "testing"
-)
-
-func TestGHTTP(t *testing.T) {
- RegisterFailHandler(Fail)
- RunSpecs(t, "GHTTP Suite")
-}
diff --git a/vendor/github.com/onsi/gomega/ghttp/test_server_test.go b/vendor/github.com/onsi/gomega/ghttp/test_server_test.go
deleted file mode 100644
index be1c58e82..000000000
--- a/vendor/github.com/onsi/gomega/ghttp/test_server_test.go
+++ /dev/null
@@ -1,1129 +0,0 @@
-package ghttp_test
-
-import (
- "bytes"
- "io"
- "io/ioutil"
- "net/http"
- "net/url"
- "regexp"
-
- "github.com/golang/protobuf/proto"
- "github.com/onsi/gomega/gbytes"
- "github.com/onsi/gomega/ghttp/protobuf"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/ghttp"
-)
-
-var _ = Describe("TestServer", func() {
- var (
- resp *http.Response
- err error
- s *Server
- )
-
- BeforeEach(func() {
- s = NewServer()
- })
-
- AfterEach(func() {
- s.Close()
- })
-
- Describe("Resetting the server", func() {
- BeforeEach(func() {
- s.RouteToHandler("GET", "/", func(w http.ResponseWriter, req *http.Request) {})
- s.AppendHandlers(func(w http.ResponseWriter, req *http.Request) {})
- http.Get(s.URL() + "/")
-
- Expect(s.ReceivedRequests()).Should(HaveLen(1))
- })
-
- It("clears all handlers and call counts", func() {
- s.Reset()
- Expect(s.ReceivedRequests()).Should(HaveLen(0))
- Expect(func() { s.GetHandler(0) }).Should(Panic())
- })
- })
-
- Describe("closing client connections", func() {
- It("closes", func() {
- s.RouteToHandler("GET", "/",
- func(w http.ResponseWriter, req *http.Request) {
- io.WriteString(w, req.RemoteAddr)
- },
- )
- client := http.Client{Transport: &http.Transport{DisableKeepAlives: true}}
- resp, err := client.Get(s.URL())
- Expect(err).ShouldNot(HaveOccurred())
- Expect(resp.StatusCode).Should(Equal(200))
-
- body, err := ioutil.ReadAll(resp.Body)
- resp.Body.Close()
- Expect(err).ShouldNot(HaveOccurred())
-
- s.CloseClientConnections()
-
- resp, err = client.Get(s.URL())
- Expect(err).ShouldNot(HaveOccurred())
- Expect(resp.StatusCode).Should(Equal(200))
-
- body2, err := ioutil.ReadAll(resp.Body)
- resp.Body.Close()
- Expect(err).ShouldNot(HaveOccurred())
-
- Expect(body2).ShouldNot(Equal(body))
- })
- })
-
- Describe("closing server mulitple times", func() {
- It("should not fail", func() {
- s.Close()
- Expect(s.Close).ShouldNot(Panic())
- })
- })
-
- Describe("allowing unhandled requests", func() {
- It("is not permitted by default", func() {
- Expect(s.GetAllowUnhandledRequests()).To(BeFalse())
- })
-
- Context("when true", func() {
- BeforeEach(func() {
- s.SetAllowUnhandledRequests(true)
- s.SetUnhandledRequestStatusCode(http.StatusForbidden)
- resp, err = http.Get(s.URL() + "/foo")
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- It("should allow unhandled requests and respond with the passed in status code", func() {
- Expect(err).ShouldNot(HaveOccurred())
- Expect(resp.StatusCode).Should(Equal(http.StatusForbidden))
-
- data, err := ioutil.ReadAll(resp.Body)
- Expect(err).ShouldNot(HaveOccurred())
- Expect(data).Should(BeEmpty())
- })
-
- It("should record the requests", func() {
- Expect(s.ReceivedRequests()).Should(HaveLen(1))
- Expect(s.ReceivedRequests()[0].URL.Path).Should(Equal("/foo"))
- })
- })
-
- Context("when false", func() {
- It("should fail when attempting a request", func() {
- failures := InterceptGomegaFailures(func() {
- http.Get(s.URL() + "/foo")
- })
-
- Expect(failures[0]).Should(ContainSubstring("Received Unhandled Request"))
- })
- })
- })
-
- Describe("Managing Handlers", func() {
- var called []string
- BeforeEach(func() {
- called = []string{}
- s.RouteToHandler("GET", "/routed", func(w http.ResponseWriter, req *http.Request) {
- called = append(called, "r1")
- })
- s.RouteToHandler("POST", regexp.MustCompile(`/routed\d`), func(w http.ResponseWriter, req *http.Request) {
- called = append(called, "r2")
- })
- s.AppendHandlers(func(w http.ResponseWriter, req *http.Request) {
- called = append(called, "A")
- }, func(w http.ResponseWriter, req *http.Request) {
- called = append(called, "B")
- })
- })
-
- It("should prefer routed handlers if there is a match", func() {
- http.Get(s.URL() + "/routed")
- http.Post(s.URL()+"/routed7", "application/json", nil)
- http.Get(s.URL() + "/foo")
- http.Get(s.URL() + "/routed")
- http.Post(s.URL()+"/routed9", "application/json", nil)
- http.Get(s.URL() + "/bar")
-
- failures := InterceptGomegaFailures(func() {
- http.Get(s.URL() + "/foo")
- http.Get(s.URL() + "/routed/not/a/match")
- http.Get(s.URL() + "/routed7")
- http.Post(s.URL()+"/routed", "application/json", nil)
- })
-
- Expect(failures[0]).Should(ContainSubstring("Received Unhandled Request"))
- Expect(failures).Should(HaveLen(4))
-
- http.Post(s.URL()+"/routed3", "application/json", nil)
-
- Expect(called).Should(Equal([]string{"r1", "r2", "A", "r1", "r2", "B", "r2"}))
- })
-
- It("should override routed handlers when reregistered", func() {
- s.RouteToHandler("GET", "/routed", func(w http.ResponseWriter, req *http.Request) {
- called = append(called, "r3")
- })
- s.RouteToHandler("POST", regexp.MustCompile(`/routed\d`), func(w http.ResponseWriter, req *http.Request) {
- called = append(called, "r4")
- })
-
- http.Get(s.URL() + "/routed")
- http.Post(s.URL()+"/routed7", "application/json", nil)
-
- Expect(called).Should(Equal([]string{"r3", "r4"}))
- })
-
- It("should call the appended handlers, in order, as requests come in", func() {
- http.Get(s.URL() + "/foo")
- Expect(called).Should(Equal([]string{"A"}))
-
- http.Get(s.URL() + "/foo")
- Expect(called).Should(Equal([]string{"A", "B"}))
-
- failures := InterceptGomegaFailures(func() {
- http.Get(s.URL() + "/foo")
- })
-
- Expect(failures[0]).Should(ContainSubstring("Received Unhandled Request"))
- })
-
- Describe("Overwriting an existing handler", func() {
- BeforeEach(func() {
- s.SetHandler(0, func(w http.ResponseWriter, req *http.Request) {
- called = append(called, "C")
- })
- })
-
- It("should override the specified handler", func() {
- http.Get(s.URL() + "/foo")
- http.Get(s.URL() + "/foo")
- Expect(called).Should(Equal([]string{"C", "B"}))
- })
- })
-
- Describe("Getting an existing handler", func() {
- It("should return the handler func", func() {
- s.GetHandler(1)(nil, nil)
- Expect(called).Should(Equal([]string{"B"}))
- })
- })
-
- Describe("Wrapping an existing handler", func() {
- BeforeEach(func() {
- s.WrapHandler(0, func(w http.ResponseWriter, req *http.Request) {
- called = append(called, "C")
- })
- })
-
- It("should wrap the existing handler in a new handler", func() {
- http.Get(s.URL() + "/foo")
- http.Get(s.URL() + "/foo")
- Expect(called).Should(Equal([]string{"A", "C", "B"}))
- })
- })
- })
-
- Describe("When a handler fails", func() {
- BeforeEach(func() {
- s.SetUnhandledRequestStatusCode(http.StatusForbidden) //just to be clear that 500s aren't coming from unhandled requests
- })
-
- Context("because the handler has panicked", func() {
- BeforeEach(func() {
- s.AppendHandlers(func(w http.ResponseWriter, req *http.Request) {
- panic("bam")
- })
- })
-
- It("should respond with a 500 and make a failing assertion", func() {
- var resp *http.Response
- var err error
-
- failures := InterceptGomegaFailures(func() {
- resp, err = http.Get(s.URL())
- })
-
- Expect(err).ShouldNot(HaveOccurred())
- Expect(resp.StatusCode).Should(Equal(http.StatusInternalServerError))
- Expect(failures).Should(ConsistOf(ContainSubstring("Handler Panicked")))
- })
- })
-
- Context("because an assertion has failed", func() {
- BeforeEach(func() {
- s.AppendHandlers(func(w http.ResponseWriter, req *http.Request) {
- // Expect(true).Should(BeFalse()) <-- would be nice to do it this way, but the test just can't be written this way
-
- By("We're cheating a bit here -- we're throwing a GINKGO_PANIC which simulates a failed assertion")
- panic(GINKGO_PANIC)
- })
- })
-
- It("should respond with a 500 and *not* make a failing assertion, instead relying on Ginkgo to have already been notified of the error", func() {
- resp, err := http.Get(s.URL())
-
- Expect(err).ShouldNot(HaveOccurred())
- Expect(resp.StatusCode).Should(Equal(http.StatusInternalServerError))
- })
- })
- })
-
- Describe("Logging to the Writer", func() {
- var buf *gbytes.Buffer
- BeforeEach(func() {
- buf = gbytes.NewBuffer()
- s.Writer = buf
- s.AppendHandlers(func(w http.ResponseWriter, req *http.Request) {})
- s.AppendHandlers(func(w http.ResponseWriter, req *http.Request) {})
- })
-
- It("should write to the buffer when a request comes in", func() {
- http.Get(s.URL() + "/foo")
- Expect(buf).Should(gbytes.Say("GHTTP Received Request: GET - /foo\n"))
-
- http.Post(s.URL()+"/bar", "", nil)
- Expect(buf).Should(gbytes.Say("GHTTP Received Request: POST - /bar\n"))
- })
- })
-
- Describe("Request Handlers", func() {
- Describe("VerifyRequest", func() {
- BeforeEach(func() {
- s.AppendHandlers(VerifyRequest("GET", "/foo"))
- })
-
- It("should verify the method, path", func() {
- resp, err = http.Get(s.URL() + "/foo?baz=bar")
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- It("should verify the method, path", func() {
- failures := InterceptGomegaFailures(func() {
- http.Get(s.URL() + "/foo2")
- })
- Expect(failures).Should(HaveLen(1))
- })
-
- It("should verify the method, path", func() {
- failures := InterceptGomegaFailures(func() {
- http.Post(s.URL()+"/foo", "application/json", nil)
- })
- Expect(failures).Should(HaveLen(1))
- })
-
- Context("when passed a rawQuery", func() {
- It("should also be possible to verify the rawQuery", func() {
- s.SetHandler(0, VerifyRequest("GET", "/foo", "baz=bar"))
- resp, err = http.Get(s.URL() + "/foo?baz=bar")
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- It("should match irregardless of query parameter ordering", func() {
- s.SetHandler(0, VerifyRequest("GET", "/foo", "type=get&name=money"))
- u, _ := url.Parse(s.URL() + "/foo")
- u.RawQuery = url.Values{
- "type": []string{"get"},
- "name": []string{"money"},
- }.Encode()
-
- resp, err = http.Get(u.String())
- Expect(err).ShouldNot(HaveOccurred())
- })
- })
-
- Context("when passed a matcher for path", func() {
- It("should apply the matcher", func() {
- s.SetHandler(0, VerifyRequest("GET", MatchRegexp(`/foo/[a-f]*/3`)))
- resp, err = http.Get(s.URL() + "/foo/abcdefa/3")
- Expect(err).ShouldNot(HaveOccurred())
- })
- })
- })
-
- Describe("VerifyContentType", func() {
- BeforeEach(func() {
- s.AppendHandlers(CombineHandlers(
- VerifyRequest("GET", "/foo"),
- VerifyContentType("application/octet-stream"),
- ))
- })
-
- It("should verify the content type", func() {
- req, err := http.NewRequest("GET", s.URL()+"/foo", nil)
- Expect(err).ShouldNot(HaveOccurred())
- req.Header.Set("Content-Type", "application/octet-stream")
-
- resp, err = http.DefaultClient.Do(req)
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- It("should verify the content type", func() {
- req, err := http.NewRequest("GET", s.URL()+"/foo", nil)
- Expect(err).ShouldNot(HaveOccurred())
- req.Header.Set("Content-Type", "application/json")
-
- failures := InterceptGomegaFailures(func() {
- http.DefaultClient.Do(req)
- })
- Expect(failures).Should(HaveLen(1))
- })
-
- It("should verify the content type", func() {
- req, err := http.NewRequest("GET", s.URL()+"/foo", nil)
- Expect(err).ShouldNot(HaveOccurred())
- req.Header.Set("Content-Type", "application/octet-stream; charset=utf-8")
-
- failures := InterceptGomegaFailures(func() {
- http.DefaultClient.Do(req)
- })
- Expect(failures).Should(HaveLen(1))
- })
- })
-
- Describe("Verify BasicAuth", func() {
- BeforeEach(func() {
- s.AppendHandlers(CombineHandlers(
- VerifyRequest("GET", "/foo"),
- VerifyBasicAuth("bob", "password"),
- ))
- })
-
- It("should verify basic auth", func() {
- req, err := http.NewRequest("GET", s.URL()+"/foo", nil)
- Expect(err).ShouldNot(HaveOccurred())
- req.SetBasicAuth("bob", "password")
-
- resp, err = http.DefaultClient.Do(req)
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- It("should verify basic auth", func() {
- req, err := http.NewRequest("GET", s.URL()+"/foo", nil)
- Expect(err).ShouldNot(HaveOccurred())
- req.SetBasicAuth("bob", "bassword")
-
- failures := InterceptGomegaFailures(func() {
- http.DefaultClient.Do(req)
- })
- Expect(failures).Should(HaveLen(1))
- })
-
- It("should require basic auth header", func() {
- req, err := http.NewRequest("GET", s.URL()+"/foo", nil)
- Expect(err).ShouldNot(HaveOccurred())
-
- failures := InterceptGomegaFailures(func() {
- http.DefaultClient.Do(req)
- })
- Expect(failures).Should(ContainElement(ContainSubstring("Authorization header must be specified")))
- })
- })
-
- Describe("VerifyHeader", func() {
- BeforeEach(func() {
- s.AppendHandlers(CombineHandlers(
- VerifyRequest("GET", "/foo"),
- VerifyHeader(http.Header{
- "accept": []string{"jpeg", "png"},
- "cache-control": []string{"omicron"},
- "Return-Path": []string{"hobbiton"},
- }),
- ))
- })
-
- It("should verify the headers", func() {
- req, err := http.NewRequest("GET", s.URL()+"/foo", nil)
- Expect(err).ShouldNot(HaveOccurred())
- req.Header.Add("Accept", "jpeg")
- req.Header.Add("Accept", "png")
- req.Header.Add("Cache-Control", "omicron")
- req.Header.Add("return-path", "hobbiton")
-
- resp, err = http.DefaultClient.Do(req)
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- It("should verify the headers", func() {
- req, err := http.NewRequest("GET", s.URL()+"/foo", nil)
- Expect(err).ShouldNot(HaveOccurred())
- req.Header.Add("Schmaccept", "jpeg")
- req.Header.Add("Schmaccept", "png")
- req.Header.Add("Cache-Control", "omicron")
- req.Header.Add("return-path", "hobbiton")
-
- failures := InterceptGomegaFailures(func() {
- http.DefaultClient.Do(req)
- })
- Expect(failures).Should(HaveLen(1))
- })
- })
-
- Describe("VerifyHeaderKV", func() {
- BeforeEach(func() {
- s.AppendHandlers(CombineHandlers(
- VerifyRequest("GET", "/foo"),
- VerifyHeaderKV("accept", "jpeg", "png"),
- VerifyHeaderKV("cache-control", "omicron"),
- VerifyHeaderKV("Return-Path", "hobbiton"),
- ))
- })
-
- It("should verify the headers", func() {
- req, err := http.NewRequest("GET", s.URL()+"/foo", nil)
- Expect(err).ShouldNot(HaveOccurred())
- req.Header.Add("Accept", "jpeg")
- req.Header.Add("Accept", "png")
- req.Header.Add("Cache-Control", "omicron")
- req.Header.Add("return-path", "hobbiton")
-
- resp, err = http.DefaultClient.Do(req)
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- It("should verify the headers", func() {
- req, err := http.NewRequest("GET", s.URL()+"/foo", nil)
- Expect(err).ShouldNot(HaveOccurred())
- req.Header.Add("Accept", "jpeg")
- req.Header.Add("Cache-Control", "omicron")
- req.Header.Add("return-path", "hobbiton")
-
- failures := InterceptGomegaFailures(func() {
- http.DefaultClient.Do(req)
- })
- Expect(failures).Should(HaveLen(1))
- })
- })
-
- Describe("VerifyBody", func() {
- BeforeEach(func() {
- s.AppendHandlers(CombineHandlers(
- VerifyRequest("POST", "/foo"),
- VerifyBody([]byte("some body")),
- ))
- })
-
- It("should verify the body", func() {
- resp, err = http.Post(s.URL()+"/foo", "", bytes.NewReader([]byte("some body")))
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- It("should verify the body", func() {
- failures := InterceptGomegaFailures(func() {
- http.Post(s.URL()+"/foo", "", bytes.NewReader([]byte("wrong body")))
- })
- Expect(failures).Should(HaveLen(1))
- })
- })
-
- Describe("VerifyMimeType", func() {
- BeforeEach(func() {
- s.AppendHandlers(CombineHandlers(
- VerifyMimeType("application/json"),
- ))
- })
-
- It("should verify the mime type in content-type header", func() {
- resp, err = http.Post(s.URL()+"/foo", "application/json; charset=utf-8", bytes.NewReader([]byte(`{}`)))
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- It("should verify the mime type in content-type header", func() {
- failures := InterceptGomegaFailures(func() {
- http.Post(s.URL()+"/foo", "text/plain", bytes.NewReader([]byte(`{}`)))
- })
- Expect(failures).Should(HaveLen(1))
- })
- })
-
- Describe("VerifyJSON", func() {
- BeforeEach(func() {
- s.AppendHandlers(CombineHandlers(
- VerifyRequest("POST", "/foo"),
- VerifyJSON(`{"a":3, "b":2}`),
- ))
- })
-
- It("should verify the json body and the content type", func() {
- resp, err = http.Post(s.URL()+"/foo", "application/json", bytes.NewReader([]byte(`{"b":2, "a":3}`)))
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- It("should verify the json body and the content type", func() {
- failures := InterceptGomegaFailures(func() {
- http.Post(s.URL()+"/foo", "application/json", bytes.NewReader([]byte(`{"b":2, "a":4}`)))
- })
- Expect(failures).Should(HaveLen(1))
- })
-
- It("should verify the json body and the content type", func() {
- failures := InterceptGomegaFailures(func() {
- http.Post(s.URL()+"/foo", "application/not-json", bytes.NewReader([]byte(`{"b":2, "a":3}`)))
- })
- Expect(failures).Should(HaveLen(1))
- })
-
- It("should verify the json body and the content type", func() {
- resp, err = http.Post(s.URL()+"/foo", "application/json; charset=utf-8", bytes.NewReader([]byte(`{"b":2, "a":3}`)))
- Expect(err).ShouldNot(HaveOccurred())
- })
- })
-
- Describe("VerifyJSONRepresenting", func() {
- BeforeEach(func() {
- s.AppendHandlers(CombineHandlers(
- VerifyRequest("POST", "/foo"),
- VerifyJSONRepresenting([]int{1, 3, 5}),
- ))
- })
-
- It("should verify the json body and the content type", func() {
- resp, err = http.Post(s.URL()+"/foo", "application/json", bytes.NewReader([]byte(`[1,3,5]`)))
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- It("should verify the json body and the content type", func() {
- failures := InterceptGomegaFailures(func() {
- http.Post(s.URL()+"/foo", "application/json", bytes.NewReader([]byte(`[1,3]`)))
- })
- Expect(failures).Should(HaveLen(1))
- })
- })
-
- Describe("VerifyForm", func() {
- var formValues url.Values
-
- BeforeEach(func() {
- formValues = make(url.Values)
- formValues.Add("users", "user1")
- formValues.Add("users", "user2")
- formValues.Add("group", "users")
- })
-
- Context("when encoded in the URL", func() {
- BeforeEach(func() {
- s.AppendHandlers(CombineHandlers(
- VerifyRequest("GET", "/foo"),
- VerifyForm(url.Values{
- "users": []string{"user1", "user2"},
- "group": []string{"users"},
- }),
- ))
- })
-
- It("should verify form values", func() {
- resp, err = http.Get(s.URL() + "/foo?" + formValues.Encode())
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- It("should ignore extra values", func() {
- formValues.Add("extra", "value")
- resp, err = http.Get(s.URL() + "/foo?" + formValues.Encode())
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- It("fail on missing values", func() {
- formValues.Del("group")
- failures := InterceptGomegaFailures(func() {
- resp, err = http.Get(s.URL() + "/foo?" + formValues.Encode())
- })
- Expect(failures).Should(HaveLen(1))
- })
-
- It("fail on incorrect values", func() {
- formValues.Set("group", "wheel")
- failures := InterceptGomegaFailures(func() {
- resp, err = http.Get(s.URL() + "/foo?" + formValues.Encode())
- })
- Expect(failures).Should(HaveLen(1))
- })
- })
-
- Context("when present in the body", func() {
- BeforeEach(func() {
- s.AppendHandlers(CombineHandlers(
- VerifyRequest("POST", "/foo"),
- VerifyForm(url.Values{
- "users": []string{"user1", "user2"},
- "group": []string{"users"},
- }),
- ))
- })
-
- It("should verify form values", func() {
- resp, err = http.PostForm(s.URL()+"/foo", formValues)
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- It("should ignore extra values", func() {
- formValues.Add("extra", "value")
- resp, err = http.PostForm(s.URL()+"/foo", formValues)
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- It("fail on missing values", func() {
- formValues.Del("group")
- failures := InterceptGomegaFailures(func() {
- resp, err = http.PostForm(s.URL()+"/foo", formValues)
- })
- Expect(failures).Should(HaveLen(1))
- })
-
- It("fail on incorrect values", func() {
- formValues.Set("group", "wheel")
- failures := InterceptGomegaFailures(func() {
- resp, err = http.PostForm(s.URL()+"/foo", formValues)
- })
- Expect(failures).Should(HaveLen(1))
- })
- })
- })
-
- Describe("VerifyFormKV", func() {
- Context("when encoded in the URL", func() {
- BeforeEach(func() {
- s.AppendHandlers(CombineHandlers(
- VerifyRequest("GET", "/foo"),
- VerifyFormKV("users", "user1", "user2"),
- ))
- })
-
- It("verifies the form value", func() {
- resp, err = http.Get(s.URL() + "/foo?users=user1&users=user2")
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- It("verifies the form value", func() {
- failures := InterceptGomegaFailures(func() {
- resp, err = http.Get(s.URL() + "/foo?users=user1")
- })
- Expect(failures).Should(HaveLen(1))
- })
- })
-
- Context("when present in the body", func() {
- BeforeEach(func() {
- s.AppendHandlers(CombineHandlers(
- VerifyRequest("POST", "/foo"),
- VerifyFormKV("users", "user1", "user2"),
- ))
- })
-
- It("verifies the form value", func() {
- resp, err = http.PostForm(s.URL()+"/foo", url.Values{"users": []string{"user1", "user2"}})
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- It("verifies the form value", func() {
- failures := InterceptGomegaFailures(func() {
- resp, err = http.PostForm(s.URL()+"/foo", url.Values{"users": []string{"user1"}})
- })
- Expect(failures).Should(HaveLen(1))
- })
- })
- })
-
- Describe("VerifyProtoRepresenting", func() {
- var message *protobuf.SimpleMessage
-
- BeforeEach(func() {
- message = new(protobuf.SimpleMessage)
- message.Description = proto.String("A description")
- message.Id = proto.Int32(0)
-
- s.AppendHandlers(CombineHandlers(
- VerifyRequest("POST", "/proto"),
- VerifyProtoRepresenting(message),
- ))
- })
-
- It("verifies the proto body and the content type", func() {
- serialized, err := proto.Marshal(message)
- Expect(err).ShouldNot(HaveOccurred())
-
- resp, err = http.Post(s.URL()+"/proto", "application/x-protobuf", bytes.NewReader(serialized))
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- It("should verify the proto body and the content type", func() {
- serialized, err := proto.Marshal(&protobuf.SimpleMessage{
- Description: proto.String("A description"),
- Id: proto.Int32(0),
- Metadata: proto.String("some metadata"),
- })
- Expect(err).ShouldNot(HaveOccurred())
-
- failures := InterceptGomegaFailures(func() {
- http.Post(s.URL()+"/proto", "application/x-protobuf", bytes.NewReader(serialized))
- })
- Expect(failures).Should(HaveLen(1))
- })
-
- It("should verify the proto body and the content type", func() {
- serialized, err := proto.Marshal(message)
- Expect(err).ShouldNot(HaveOccurred())
-
- failures := InterceptGomegaFailures(func() {
- http.Post(s.URL()+"/proto", "application/not-x-protobuf", bytes.NewReader(serialized))
- })
- Expect(failures).Should(HaveLen(1))
- })
- })
-
- Describe("RespondWith", func() {
- Context("without headers", func() {
- BeforeEach(func() {
- s.AppendHandlers(CombineHandlers(
- VerifyRequest("POST", "/foo"),
- RespondWith(http.StatusCreated, "sweet"),
- ), CombineHandlers(
- VerifyRequest("POST", "/foo"),
- RespondWith(http.StatusOK, []byte("sour")),
- ))
- })
-
- It("should return the response", func() {
- resp, err = http.Post(s.URL()+"/foo", "application/json", nil)
- Expect(err).ShouldNot(HaveOccurred())
-
- Expect(resp.StatusCode).Should(Equal(http.StatusCreated))
-
- body, err := ioutil.ReadAll(resp.Body)
- Expect(err).ShouldNot(HaveOccurred())
- Expect(body).Should(Equal([]byte("sweet")))
-
- resp, err = http.Post(s.URL()+"/foo", "application/json", nil)
- Expect(err).ShouldNot(HaveOccurred())
-
- Expect(resp.StatusCode).Should(Equal(http.StatusOK))
-
- body, err = ioutil.ReadAll(resp.Body)
- Expect(err).ShouldNot(HaveOccurred())
- Expect(body).Should(Equal([]byte("sour")))
- })
- })
-
- Context("with headers", func() {
- BeforeEach(func() {
- s.AppendHandlers(CombineHandlers(
- VerifyRequest("POST", "/foo"),
- RespondWith(http.StatusCreated, "sweet", http.Header{"X-Custom-Header": []string{"my header"}}),
- ))
- })
-
- It("should return the headers too", func() {
- resp, err = http.Post(s.URL()+"/foo", "application/json", nil)
- Expect(err).ShouldNot(HaveOccurred())
-
- Expect(resp.StatusCode).Should(Equal(http.StatusCreated))
- Expect(ioutil.ReadAll(resp.Body)).Should(Equal([]byte("sweet")))
- Expect(resp.Header.Get("X-Custom-Header")).Should(Equal("my header"))
- })
- })
- })
-
- Describe("RespondWithPtr", func() {
- var code int
- var byteBody []byte
- var stringBody string
- BeforeEach(func() {
- code = http.StatusOK
- byteBody = []byte("sweet")
- stringBody = "sour"
-
- s.AppendHandlers(CombineHandlers(
- VerifyRequest("POST", "/foo"),
- RespondWithPtr(&code, &byteBody),
- ), CombineHandlers(
- VerifyRequest("POST", "/foo"),
- RespondWithPtr(&code, &stringBody),
- ))
- })
-
- It("should return the response", func() {
- code = http.StatusCreated
- byteBody = []byte("tasty")
- stringBody = "treat"
-
- resp, err = http.Post(s.URL()+"/foo", "application/json", nil)
- Expect(err).ShouldNot(HaveOccurred())
-
- Expect(resp.StatusCode).Should(Equal(http.StatusCreated))
-
- body, err := ioutil.ReadAll(resp.Body)
- Expect(err).ShouldNot(HaveOccurred())
- Expect(body).Should(Equal([]byte("tasty")))
-
- resp, err = http.Post(s.URL()+"/foo", "application/json", nil)
- Expect(err).ShouldNot(HaveOccurred())
-
- Expect(resp.StatusCode).Should(Equal(http.StatusCreated))
-
- body, err = ioutil.ReadAll(resp.Body)
- Expect(err).ShouldNot(HaveOccurred())
- Expect(body).Should(Equal([]byte("treat")))
- })
-
- Context("when passed a nil body", func() {
- BeforeEach(func() {
- s.SetHandler(0, CombineHandlers(
- VerifyRequest("POST", "/foo"),
- RespondWithPtr(&code, nil),
- ))
- })
-
- It("should return an empty body and not explode", func() {
- resp, err = http.Post(s.URL()+"/foo", "application/json", nil)
-
- Expect(err).ShouldNot(HaveOccurred())
- Expect(resp.StatusCode).Should(Equal(http.StatusOK))
- body, err := ioutil.ReadAll(resp.Body)
- Expect(err).ShouldNot(HaveOccurred())
- Expect(body).Should(BeEmpty())
-
- Expect(s.ReceivedRequests()).Should(HaveLen(1))
- })
- })
- })
-
- Describe("RespondWithJSON", func() {
- Context("when no optional headers are set", func() {
- BeforeEach(func() {
- s.AppendHandlers(CombineHandlers(
- VerifyRequest("POST", "/foo"),
- RespondWithJSONEncoded(http.StatusCreated, []int{1, 2, 3}),
- ))
- })
-
- It("should return the response", func() {
- resp, err = http.Post(s.URL()+"/foo", "application/json", nil)
- Expect(err).ShouldNot(HaveOccurred())
-
- Expect(resp.StatusCode).Should(Equal(http.StatusCreated))
-
- body, err := ioutil.ReadAll(resp.Body)
- Expect(err).ShouldNot(HaveOccurred())
- Expect(body).Should(MatchJSON("[1,2,3]"))
- })
-
- It("should set the Content-Type header to application/json", func() {
- resp, err = http.Post(s.URL()+"/foo", "application/json", nil)
- Expect(err).ShouldNot(HaveOccurred())
-
- Expect(resp.Header["Content-Type"]).Should(Equal([]string{"application/json"}))
- })
- })
-
- Context("when optional headers are set", func() {
- var headers http.Header
- BeforeEach(func() {
- headers = http.Header{"Stuff": []string{"things"}}
- })
-
- JustBeforeEach(func() {
- s.AppendHandlers(CombineHandlers(
- VerifyRequest("POST", "/foo"),
- RespondWithJSONEncoded(http.StatusCreated, []int{1, 2, 3}, headers),
- ))
- })
-
- It("should preserve those headers", func() {
- resp, err = http.Post(s.URL()+"/foo", "application/json", nil)
- Expect(err).ShouldNot(HaveOccurred())
-
- Expect(resp.Header["Stuff"]).Should(Equal([]string{"things"}))
- })
-
- It("should set the Content-Type header to application/json", func() {
- resp, err = http.Post(s.URL()+"/foo", "application/json", nil)
- Expect(err).ShouldNot(HaveOccurred())
-
- Expect(resp.Header["Content-Type"]).Should(Equal([]string{"application/json"}))
- })
-
- Context("when setting the Content-Type explicitly", func() {
- BeforeEach(func() {
- headers["Content-Type"] = []string{"not-json"}
- })
-
- It("should use the Content-Type header that was explicitly set", func() {
- resp, err = http.Post(s.URL()+"/foo", "application/json", nil)
- Expect(err).ShouldNot(HaveOccurred())
-
- Expect(resp.Header["Content-Type"]).Should(Equal([]string{"not-json"}))
- })
- })
- })
- })
-
- Describe("RespondWithJSONPtr", func() {
- type testObject struct {
- Key string
- Value string
- }
-
- var code int
- var object testObject
-
- Context("when no optional headers are set", func() {
- BeforeEach(func() {
- code = http.StatusOK
- object = testObject{}
- s.AppendHandlers(CombineHandlers(
- VerifyRequest("POST", "/foo"),
- RespondWithJSONEncodedPtr(&code, &object),
- ))
- })
-
- It("should return the response", func() {
- code = http.StatusCreated
- object = testObject{
- Key: "Jim",
- Value: "Codes",
- }
- resp, err = http.Post(s.URL()+"/foo", "application/json", nil)
- Expect(err).ShouldNot(HaveOccurred())
-
- Expect(resp.StatusCode).Should(Equal(http.StatusCreated))
-
- body, err := ioutil.ReadAll(resp.Body)
- Expect(err).ShouldNot(HaveOccurred())
- Expect(body).Should(MatchJSON(`{"Key": "Jim", "Value": "Codes"}`))
- })
-
- It("should set the Content-Type header to application/json", func() {
- resp, err = http.Post(s.URL()+"/foo", "application/json", nil)
- Expect(err).ShouldNot(HaveOccurred())
-
- Expect(resp.Header["Content-Type"]).Should(Equal([]string{"application/json"}))
- })
- })
-
- Context("when optional headers are set", func() {
- var headers http.Header
- BeforeEach(func() {
- headers = http.Header{"Stuff": []string{"things"}}
- })
-
- JustBeforeEach(func() {
- code = http.StatusOK
- object = testObject{}
- s.AppendHandlers(CombineHandlers(
- VerifyRequest("POST", "/foo"),
- RespondWithJSONEncodedPtr(&code, &object, headers),
- ))
- })
-
- It("should preserve those headers", func() {
- resp, err = http.Post(s.URL()+"/foo", "application/json", nil)
- Expect(err).ShouldNot(HaveOccurred())
-
- Expect(resp.Header["Stuff"]).Should(Equal([]string{"things"}))
- })
-
- It("should set the Content-Type header to application/json", func() {
- resp, err = http.Post(s.URL()+"/foo", "application/json", nil)
- Expect(err).ShouldNot(HaveOccurred())
-
- Expect(resp.Header["Content-Type"]).Should(Equal([]string{"application/json"}))
- })
-
- Context("when setting the Content-Type explicitly", func() {
- BeforeEach(func() {
- headers["Content-Type"] = []string{"not-json"}
- })
-
- It("should use the Content-Type header that was explicitly set", func() {
- resp, err = http.Post(s.URL()+"/foo", "application/json", nil)
- Expect(err).ShouldNot(HaveOccurred())
-
- Expect(resp.Header["Content-Type"]).Should(Equal([]string{"not-json"}))
- })
- })
- })
- })
-
- Describe("RespondWithProto", func() {
- var message *protobuf.SimpleMessage
-
- BeforeEach(func() {
- message = new(protobuf.SimpleMessage)
- message.Description = proto.String("A description")
- message.Id = proto.Int32(99)
- })
-
- Context("when no optional headers are set", func() {
- BeforeEach(func() {
- s.AppendHandlers(CombineHandlers(
- VerifyRequest("POST", "/proto"),
- RespondWithProto(http.StatusCreated, message),
- ))
- })
-
- It("should return the response", func() {
- resp, err = http.Post(s.URL()+"/proto", "application/x-protobuf", nil)
- Expect(err).ShouldNot(HaveOccurred())
-
- Expect(resp.StatusCode).Should(Equal(http.StatusCreated))
-
- var received protobuf.SimpleMessage
- body, err := ioutil.ReadAll(resp.Body)
- err = proto.Unmarshal(body, &received)
- Expect(err).ShouldNot(HaveOccurred())
- })
-
- It("should set the Content-Type header to application/x-protobuf", func() {
- resp, err = http.Post(s.URL()+"/proto", "application/x-protobuf", nil)
- Expect(err).ShouldNot(HaveOccurred())
-
- Expect(resp.Header["Content-Type"]).Should(Equal([]string{"application/x-protobuf"}))
- })
- })
-
- Context("when optional headers are set", func() {
- var headers http.Header
- BeforeEach(func() {
- headers = http.Header{"Stuff": []string{"things"}}
- })
-
- JustBeforeEach(func() {
- s.AppendHandlers(CombineHandlers(
- VerifyRequest("POST", "/proto"),
- RespondWithProto(http.StatusCreated, message, headers),
- ))
- })
-
- It("should preserve those headers", func() {
- resp, err = http.Post(s.URL()+"/proto", "application/x-protobuf", nil)
- Expect(err).ShouldNot(HaveOccurred())
-
- Expect(resp.Header["Stuff"]).Should(Equal([]string{"things"}))
- })
-
- It("should set the Content-Type header to application/x-protobuf", func() {
- resp, err = http.Post(s.URL()+"/proto", "application/x-protobuf", nil)
- Expect(err).ShouldNot(HaveOccurred())
-
- Expect(resp.Header["Content-Type"]).Should(Equal([]string{"application/x-protobuf"}))
- })
-
- Context("when setting the Content-Type explicitly", func() {
- BeforeEach(func() {
- headers["Content-Type"] = []string{"not-x-protobuf"}
- })
-
- It("should use the Content-Type header that was explicitly set", func() {
- resp, err = http.Post(s.URL()+"/proto", "application/x-protobuf", nil)
- Expect(err).ShouldNot(HaveOccurred())
-
- Expect(resp.Header["Content-Type"]).Should(Equal([]string{"not-x-protobuf"}))
- })
- })
- })
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/gstruct/elements.go b/vendor/github.com/onsi/gomega/gstruct/elements.go
deleted file mode 100644
index 13bf5b895..000000000
--- a/vendor/github.com/onsi/gomega/gstruct/elements.go
+++ /dev/null
@@ -1,159 +0,0 @@
-package gstruct
-
-import (
- "errors"
- "fmt"
- "reflect"
- "runtime/debug"
-
- "github.com/onsi/gomega/format"
- errorsutil "github.com/onsi/gomega/gstruct/errors"
- "github.com/onsi/gomega/types"
-)
-
-//MatchAllElements succeeds if every element of a slice matches the element matcher it maps to
-//through the id function, and every element matcher is matched.
-// idFn := func(element interface{}) string {
-// return fmt.Sprintf("%v", element)
-// }
-//
-// Expect([]string{"a", "b"}).To(MatchAllElements(idFn, Elements{
-// "a": Equal("a"),
-// "b": Equal("b"),
-// }))
-func MatchAllElements(identifier Identifier, elements Elements) types.GomegaMatcher {
- return &ElementsMatcher{
- Identifier: identifier,
- Elements: elements,
- }
-}
-
-//MatchElements succeeds if each element of a slice matches the element matcher it maps to
-//through the id function. It can ignore extra elements and/or missing elements.
-// idFn := func(element interface{}) string {
-// return fmt.Sprintf("%v", element)
-// }
-//
-// Expect([]string{"a", "b", "c"}).To(MatchElements(idFn, IgnoreExtras, Elements{
-// "a": Equal("a"),
-// "b": Equal("b"),
-// }))
-// Expect([]string{"a", "c"}).To(MatchElements(idFn, IgnoreMissing, Elements{
-// "a": Equal("a"),
-// "b": Equal("b"),
-// "c": Equal("c"),
-// "d": Equal("d"),
-// }))
-func MatchElements(identifier Identifier, options Options, elements Elements) types.GomegaMatcher {
- return &ElementsMatcher{
- Identifier: identifier,
- Elements: elements,
- IgnoreExtras: options&IgnoreExtras != 0,
- IgnoreMissing: options&IgnoreMissing != 0,
- AllowDuplicates: options&AllowDuplicates != 0,
- }
-}
-
-// ElementsMatcher is a NestingMatcher that applies custom matchers to each element of a slice mapped
-// by the Identifier function.
-// TODO: Extend this to work with arrays & maps (map the key) as well.
-type ElementsMatcher struct {
- // Matchers for each element.
- Elements Elements
- // Function mapping an element to the string key identifying its matcher.
- Identifier Identifier
-
- // Whether to ignore extra elements or consider it an error.
- IgnoreExtras bool
- // Whether to ignore missing elements or consider it an error.
- IgnoreMissing bool
- // Whether to key duplicates when matching IDs.
- AllowDuplicates bool
-
- // State.
- failures []error
-}
-
-// Element ID to matcher.
-type Elements map[string]types.GomegaMatcher
-
-// Function for identifying (mapping) elements.
-type Identifier func(element interface{}) string
-
-func (m *ElementsMatcher) Match(actual interface{}) (success bool, err error) {
- if reflect.TypeOf(actual).Kind() != reflect.Slice {
- return false, fmt.Errorf("%v is type %T, expected slice", actual, actual)
- }
-
- m.failures = m.matchElements(actual)
- if len(m.failures) > 0 {
- return false, nil
- }
- return true, nil
-}
-
-func (m *ElementsMatcher) matchElements(actual interface{}) (errs []error) {
- // Provide more useful error messages in the case of a panic.
- defer func() {
- if err := recover(); err != nil {
- errs = append(errs, fmt.Errorf("panic checking %+v: %v\n%s", actual, err, debug.Stack()))
- }
- }()
-
- val := reflect.ValueOf(actual)
- elements := map[string]bool{}
- for i := 0; i < val.Len(); i++ {
- element := val.Index(i).Interface()
- id := m.Identifier(element)
- if elements[id] {
- if !m.AllowDuplicates {
- errs = append(errs, fmt.Errorf("found duplicate element ID %s", id))
- continue
- }
- }
- elements[id] = true
-
- matcher, expected := m.Elements[id]
- if !expected {
- if !m.IgnoreExtras {
- errs = append(errs, fmt.Errorf("unexpected element %s", id))
- }
- continue
- }
-
- match, err := matcher.Match(element)
- if match {
- continue
- }
-
- if err == nil {
- if nesting, ok := matcher.(errorsutil.NestingMatcher); ok {
- err = errorsutil.AggregateError(nesting.Failures())
- } else {
- err = errors.New(matcher.FailureMessage(element))
- }
- }
- errs = append(errs, errorsutil.Nest(fmt.Sprintf("[%s]", id), err))
- }
-
- for id := range m.Elements {
- if !elements[id] && !m.IgnoreMissing {
- errs = append(errs, fmt.Errorf("missing expected element %s", id))
- }
- }
-
- return errs
-}
-
-func (m *ElementsMatcher) FailureMessage(actual interface{}) (message string) {
- failure := errorsutil.AggregateError(m.failures)
- return format.Message(actual, fmt.Sprintf("to match elements: %v", failure))
-}
-
-func (m *ElementsMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "not to match elements")
-}
-
-func (m *ElementsMatcher) Failures() []error {
- return m.failures
-}
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 355d463eb..000000000
--- 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"),
- })
- Expect(allElements).Should(m, "should match all elements")
- Expect(missingElements).ShouldNot(m, "should fail with missing elements")
- Expect(extraElements).ShouldNot(m, "should fail with extra elements")
- Expect(duplicateElements).ShouldNot(m, "should fail with duplicate elements")
- Expect(nils).ShouldNot(m, "should fail with an uninitialized slice")
-
- m = MatchAllElements(id, Elements{
- "a": Equal("a"),
- "b": Equal("fail"),
- })
- Expect(allElements).ShouldNot(m, "should run nested matchers")
-
- m = MatchAllElements(id, Elements{})
- Expect(empty).Should(m, "should handle empty slices")
- Expect(allElements).ShouldNot(m, "should handle only empty slices")
- Expect(nils).Should(m, "should handle nil slices")
- })
-
- It("should ignore extra elements", func() {
- m := MatchElements(id, IgnoreExtras, Elements{
- "b": Equal("b"),
- "a": Equal("a"),
- })
- Expect(allElements).Should(m, "should match all elements")
- Expect(missingElements).ShouldNot(m, "should fail with missing elements")
- Expect(extraElements).Should(m, "should ignore extra elements")
- Expect(duplicateElements).ShouldNot(m, "should fail with duplicate elements")
- Expect(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"),
- })
- Expect(allElements).Should(m, "should match all elements")
- Expect(missingElements).Should(m, "should ignore missing elements")
- Expect(extraElements).ShouldNot(m, "should fail with extra elements")
- Expect(duplicateElements).ShouldNot(m, "should fail with duplicate elements")
- Expect(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"),
- })
- Expect(allElements).Should(m, "should match all elements")
- Expect(missingElements).Should(m, "should ignore missing elements")
- Expect(extraElements).Should(m, "should ignore extra elements")
- Expect(duplicateElements).ShouldNot(m, "should fail with duplicate elements")
- Expect(nils).Should(m, "should ignore an uninitialized slice")
-
- m = MatchElements(id, IgnoreExtras|IgnoreMissing, Elements{
- "a": Equal("a"),
- "b": Equal("fail"),
- })
- Expect(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"),
- })
- Expect(allElements).Should(m, "should match all elements")
- Expect(includingBadElements).ShouldNot(m, "should reject if a member fails the matcher")
- Expect(extraElements).ShouldNot(m, "should reject with extra keys")
- Expect(missingElements).ShouldNot(m, "should reject with missing keys")
- Expect(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"),
- })
- Expect(allElements).Should(m, "should match all elements")
- Expect(includingBadElements).ShouldNot(m, "should reject if a member fails the matcher")
- Expect(extraElements).ShouldNot(m, "should reject with extra keys")
- Expect(missingElements).Should(m, "should allow missing keys")
- Expect(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"),
- })
- Expect(allElements).Should(m, "should match all elements")
- Expect(includingBadElements).ShouldNot(m, "should reject if a member fails the matcher")
- Expect(extraElements).Should(m, "should allow extra keys")
- Expect(missingElements).ShouldNot(m, "should reject missing keys")
- Expect(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"),
- })
- Expect(allElements).Should(m, "should match all elements")
- Expect(includingBadElements).ShouldNot(m, "should reject if a member fails the matcher")
- Expect(extraElements).Should(m, "should allow extra keys")
- Expect(missingElements).Should(m, "should allow missing keys")
- Expect(nils).Should(m, "should allow an uninitialized slice")
- })
- })
-})
-
-func id(element interface{}) string {
- return element.(string)
-}
diff --git a/vendor/github.com/onsi/gomega/gstruct/errors/nested_types.go b/vendor/github.com/onsi/gomega/gstruct/errors/nested_types.go
deleted file mode 100644
index 188492b21..000000000
--- a/vendor/github.com/onsi/gomega/gstruct/errors/nested_types.go
+++ /dev/null
@@ -1,72 +0,0 @@
-package errors
-
-import (
- "fmt"
- "strings"
-
- "github.com/onsi/gomega/types"
-)
-
-// A stateful matcher that nests other matchers within it and preserves the error types of the
-// nested matcher failures.
-type NestingMatcher interface {
- types.GomegaMatcher
-
- // Returns the failures of nested matchers.
- Failures() []error
-}
-
-// An error type for labeling errors on deeply nested matchers.
-type NestedError struct {
- Path string
- Err error
-}
-
-func (e *NestedError) Error() string {
- // Indent Errors.
- indented := strings.Replace(e.Err.Error(), "\n", "\n\t", -1)
- return fmt.Sprintf("%s:\n\t%v", e.Path, indented)
-}
-
-// Create a NestedError with the given path.
-// If err is a NestedError, prepend the path to it.
-// If err is an AggregateError, recursively Nest each error.
-func Nest(path string, err error) error {
- if ag, ok := err.(AggregateError); ok {
- var errs AggregateError
- for _, e := range ag {
- errs = append(errs, Nest(path, e))
- }
- return errs
- }
- if ne, ok := err.(*NestedError); ok {
- return &NestedError{
- Path: path + ne.Path,
- Err: ne.Err,
- }
- }
- return &NestedError{
- Path: path,
- Err: err,
- }
-}
-
-// An error type for treating multiple errors as a single error.
-type AggregateError []error
-
-// Error is part of the error interface.
-func (err AggregateError) Error() string {
- if len(err) == 0 {
- // This should never happen, really.
- return ""
- }
- if len(err) == 1 {
- return err[0].Error()
- }
- result := fmt.Sprintf("[%s", err[0].Error())
- for i := 1; i < len(err); i++ {
- result += fmt.Sprintf(", %s", err[i].Error())
- }
- result += "]"
- return result
-}
diff --git a/vendor/github.com/onsi/gomega/gstruct/fields.go b/vendor/github.com/onsi/gomega/gstruct/fields.go
deleted file mode 100644
index 2eb2d0887..000000000
--- a/vendor/github.com/onsi/gomega/gstruct/fields.go
+++ /dev/null
@@ -1,168 +0,0 @@
-package gstruct
-
-import (
- "errors"
- "fmt"
- "reflect"
- "runtime/debug"
- "strings"
-
- "github.com/onsi/gomega/format"
- errorsutil "github.com/onsi/gomega/gstruct/errors"
- "github.com/onsi/gomega/types"
-)
-
-//MatchAllFields succeeds if every field of a struct matches the field matcher associated with
-//it, and every element matcher is matched.
-// actual := struct{
-// A int
-// B []bool
-// C string
-// }{
-// A: 5,
-// B: []bool{true, false},
-// C: "foo",
-// }
-//
-// Expect(actual).To(MatchAllFields(Fields{
-// "A": Equal(5),
-// "B": ConsistOf(true, false),
-// "C": Equal("foo"),
-// }))
-func MatchAllFields(fields Fields) types.GomegaMatcher {
- return &FieldsMatcher{
- Fields: fields,
- }
-}
-
-//MatchFields succeeds if each element of a struct matches the field matcher associated with
-//it. It can ignore extra fields and/or missing fields.
-// actual := struct{
-// A int
-// B []bool
-// C string
-// }{
-// A: 5,
-// B: []bool{true, false},
-// C: "foo",
-// }
-//
-// Expect(actual).To(MatchFields(IgnoreExtras, Fields{
-// "A": Equal(5),
-// "B": ConsistOf(true, false),
-// }))
-// Expect(actual).To(MatchFields(IgnoreMissing, Fields{
-// "A": Equal(5),
-// "B": ConsistOf(true, false),
-// "C": Equal("foo"),
-// "D": Equal("extra"),
-// }))
-func MatchFields(options Options, fields Fields) types.GomegaMatcher {
- return &FieldsMatcher{
- Fields: fields,
- IgnoreExtras: options&IgnoreExtras != 0,
- IgnoreMissing: options&IgnoreMissing != 0,
- }
-}
-
-type FieldsMatcher struct {
- // Matchers for each field.
- Fields Fields
-
- // Whether to ignore extra elements or consider it an error.
- IgnoreExtras bool
- // Whether to ignore missing elements or consider it an error.
- IgnoreMissing bool
-
- // State.
- failures []error
-}
-
-// Field name to matcher.
-type Fields map[string]types.GomegaMatcher
-
-func (m *FieldsMatcher) Match(actual interface{}) (success bool, err error) {
- if reflect.TypeOf(actual).Kind() != reflect.Struct {
- return false, fmt.Errorf("%v is type %T, expected struct", actual, actual)
- }
-
- m.failures = m.matchFields(actual)
- if len(m.failures) > 0 {
- return false, nil
- }
- return true, nil
-}
-
-func (m *FieldsMatcher) matchFields(actual interface{}) (errs []error) {
- val := reflect.ValueOf(actual)
- typ := val.Type()
- fields := map[string]bool{}
- for i := 0; i < val.NumField(); i++ {
- fieldName := typ.Field(i).Name
- fields[fieldName] = true
-
- err := func() (err error) {
- // This test relies heavily on reflect, which tends to panic.
- // Recover here to provide more useful error messages in that case.
- defer func() {
- if r := recover(); r != nil {
- err = fmt.Errorf("panic checking %+v: %v\n%s", actual, r, debug.Stack())
- }
- }()
-
- matcher, expected := m.Fields[fieldName]
- if !expected {
- if !m.IgnoreExtras {
- return fmt.Errorf("unexpected field %s: %+v", fieldName, actual)
- }
- return nil
- }
-
- var field interface{}
- if val.Field(i).IsValid() {
- field = val.Field(i).Interface()
- } else {
- field = reflect.Zero(typ.Field(i).Type)
- }
-
- match, err := matcher.Match(field)
- if err != nil {
- return err
- } else if !match {
- if nesting, ok := matcher.(errorsutil.NestingMatcher); ok {
- return errorsutil.AggregateError(nesting.Failures())
- }
- return errors.New(matcher.FailureMessage(field))
- }
- return nil
- }()
- if err != nil {
- errs = append(errs, errorsutil.Nest("."+fieldName, err))
- }
- }
-
- for field := range m.Fields {
- if !fields[field] && !m.IgnoreMissing {
- errs = append(errs, fmt.Errorf("missing expected field %s", field))
- }
- }
-
- return errs
-}
-
-func (m *FieldsMatcher) FailureMessage(actual interface{}) (message string) {
- failures := make([]string, len(m.failures))
- for i := range m.failures {
- failures[i] = m.failures[i].Error()
- }
- return format.Message(reflect.TypeOf(actual).Name(),
- fmt.Sprintf("to match fields: {\n%v\n}\n", strings.Join(failures, "\n")))
-}
-
-func (m *FieldsMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return format.Message(actual, "not to match fields")
-}
-
-func (m *FieldsMatcher) Failures() []error {
- return m.failures
-}
diff --git a/vendor/github.com/onsi/gomega/gstruct/fields_test.go b/vendor/github.com/onsi/gomega/gstruct/fields_test.go
deleted file mode 100644
index e4e039e21..000000000
--- a/vendor/github.com/onsi/gomega/gstruct/fields_test.go
+++ /dev/null
@@ -1,76 +0,0 @@
-package gstruct_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/gstruct"
-)
-
-var _ = Describe("Struct", func() {
- allFields := struct{ A, B string }{"a", "b"}
- missingFields := struct{ A string }{"a"}
- extraFields := struct{ A, B, C string }{"a", "b", "c"}
- emptyFields := struct{ A, B string }{}
-
- It("should strictly match all fields", func() {
- m := MatchAllFields(Fields{
- "B": Equal("b"),
- "A": Equal("a"),
- })
- Expect(allFields).Should(m, "should match all fields")
- Expect(missingFields).ShouldNot(m, "should fail with missing fields")
- Expect(extraFields).ShouldNot(m, "should fail with extra fields")
- Expect(emptyFields).ShouldNot(m, "should fail with empty fields")
-
- m = MatchAllFields(Fields{
- "A": Equal("a"),
- "B": Equal("fail"),
- })
- Expect(allFields).ShouldNot(m, "should run nested matchers")
- })
-
- It("should handle empty structs", func() {
- m := MatchAllFields(Fields{})
- Expect(struct{}{}).Should(m, "should handle empty structs")
- Expect(allFields).ShouldNot(m, "should fail with extra fields")
- })
-
- It("should ignore missing fields", func() {
- m := MatchFields(IgnoreMissing, Fields{
- "B": Equal("b"),
- "A": Equal("a"),
- })
- Expect(allFields).Should(m, "should match all fields")
- Expect(missingFields).Should(m, "should ignore missing fields")
- Expect(extraFields).ShouldNot(m, "should fail with extra fields")
- Expect(emptyFields).ShouldNot(m, "should fail with empty fields")
- })
-
- It("should ignore extra fields", func() {
- m := MatchFields(IgnoreExtras, Fields{
- "B": Equal("b"),
- "A": Equal("a"),
- })
- Expect(allFields).Should(m, "should match all fields")
- Expect(missingFields).ShouldNot(m, "should fail with missing fields")
- Expect(extraFields).Should(m, "should ignore extra fields")
- Expect(emptyFields).ShouldNot(m, "should fail with empty fields")
- })
-
- It("should ignore missing and extra fields", func() {
- m := MatchFields(IgnoreMissing|IgnoreExtras, Fields{
- "B": Equal("b"),
- "A": Equal("a"),
- })
- Expect(allFields).Should(m, "should match all fields")
- Expect(missingFields).Should(m, "should ignore missing fields")
- Expect(extraFields).Should(m, "should ignore extra fields")
- Expect(emptyFields).ShouldNot(m, "should fail with empty fields")
-
- m = MatchFields(IgnoreMissing|IgnoreExtras, Fields{
- "A": Equal("a"),
- "B": Equal("fail"),
- })
- Expect(allFields).ShouldNot(m, "should run nested matchers")
- })
-})
diff --git a/vendor/github.com/onsi/gomega/gstruct/gstruct_tests_suite_test.go b/vendor/github.com/onsi/gomega/gstruct/gstruct_tests_suite_test.go
deleted file mode 100644
index d47566304..000000000
--- a/vendor/github.com/onsi/gomega/gstruct/gstruct_tests_suite_test.go
+++ /dev/null
@@ -1,13 +0,0 @@
-package gstruct_test
-
-import (
- "testing"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-)
-
-func Test(t *testing.T) {
- RegisterFailHandler(Fail)
- RunSpecs(t, "Gstruct Suite")
-}
diff --git a/vendor/github.com/onsi/gomega/gstruct/ignore.go b/vendor/github.com/onsi/gomega/gstruct/ignore.go
deleted file mode 100644
index 0365f32ad..000000000
--- a/vendor/github.com/onsi/gomega/gstruct/ignore.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package gstruct
-
-import (
- "github.com/onsi/gomega/types"
-)
-
-//Ignore ignores the actual value and always succeeds.
-// Expect(nil).To(Ignore())
-// Expect(true).To(Ignore())
-func Ignore() types.GomegaMatcher {
- return &IgnoreMatcher{true}
-}
-
-//Reject ignores the actual value and always fails. It can be used in conjunction with IgnoreMissing
-//to catch problematic elements, or to verify tests are running.
-// Expect(nil).NotTo(Reject())
-// Expect(true).NotTo(Reject())
-func Reject() types.GomegaMatcher {
- return &IgnoreMatcher{false}
-}
-
-// A matcher that either always succeeds or always fails.
-type IgnoreMatcher struct {
- Succeed bool
-}
-
-func (m *IgnoreMatcher) Match(actual interface{}) (bool, error) {
- return m.Succeed, nil
-}
-
-func (m *IgnoreMatcher) FailureMessage(_ interface{}) (message string) {
- return "Unconditional failure"
-}
-
-func (m *IgnoreMatcher) NegatedFailureMessage(_ interface{}) (message string) {
- return "Unconditional success"
-}
diff --git a/vendor/github.com/onsi/gomega/gstruct/ignore_test.go b/vendor/github.com/onsi/gomega/gstruct/ignore_test.go
deleted file mode 100644
index 07775e742..000000000
--- a/vendor/github.com/onsi/gomega/gstruct/ignore_test.go
+++ /dev/null
@@ -1,23 +0,0 @@
-package gstruct_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/gstruct"
-)
-
-var _ = Describe("Ignore", func() {
- It("should always succeed", func() {
- Expect(nil).Should(Ignore())
- Expect(struct{}{}).Should(Ignore())
- Expect(0).Should(Ignore())
- Expect(false).Should(Ignore())
- })
-
- It("should always fail", func() {
- Expect(nil).ShouldNot(Reject())
- Expect(struct{}{}).ShouldNot(Reject())
- Expect(1).ShouldNot(Reject())
- Expect(true).ShouldNot(Reject())
- })
-})
diff --git a/vendor/github.com/onsi/gomega/gstruct/pointer.go b/vendor/github.com/onsi/gomega/gstruct/pointer.go
deleted file mode 100644
index 0a2f35de3..000000000
--- a/vendor/github.com/onsi/gomega/gstruct/pointer.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package gstruct
-
-import (
- "fmt"
- "reflect"
-
- "github.com/onsi/gomega/format"
- "github.com/onsi/gomega/types"
-)
-
-//PointTo applies the given matcher to the value pointed to by actual. It fails if the pointer is
-//nil.
-// actual := 5
-// Expect(&actual).To(PointTo(Equal(5)))
-func PointTo(matcher types.GomegaMatcher) types.GomegaMatcher {
- return &PointerMatcher{
- Matcher: matcher,
- }
-}
-
-type PointerMatcher struct {
- Matcher types.GomegaMatcher
-
- // Failure message.
- failure string
-}
-
-func (m *PointerMatcher) Match(actual interface{}) (bool, error) {
- val := reflect.ValueOf(actual)
-
- // return error if actual type is not a pointer
- if val.Kind() != reflect.Ptr {
- return false, fmt.Errorf("PointerMatcher expects a pointer but we have '%s'", val.Kind())
- }
-
- if !val.IsValid() || val.IsNil() {
- m.failure = format.Message(actual, "not to be <nil>")
- return false, nil
- }
-
- // Forward the value.
- elem := val.Elem().Interface()
- match, err := m.Matcher.Match(elem)
- if !match {
- m.failure = m.Matcher.FailureMessage(elem)
- }
- return match, err
-}
-
-func (m *PointerMatcher) FailureMessage(_ interface{}) (message string) {
- return m.failure
-}
-
-func (m *PointerMatcher) NegatedFailureMessage(actual interface{}) (message string) {
- return m.Matcher.NegatedFailureMessage(actual)
-}
diff --git a/vendor/github.com/onsi/gomega/gstruct/pointer_test.go b/vendor/github.com/onsi/gomega/gstruct/pointer_test.go
deleted file mode 100644
index 805a92abe..000000000
--- a/vendor/github.com/onsi/gomega/gstruct/pointer_test.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package gstruct_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/gstruct"
-)
-
-var _ = Describe("PointTo", func() {
- It("should fail when passed nil", func() {
- var p *struct{}
- Expect(p).Should(BeNil())
- })
-
- It("should succeed when passed non-nil pointer", func() {
- var s struct{}
- Expect(&s).Should(PointTo(Ignore()))
- })
-
- It("should unwrap the pointee value", func() {
- i := 1
- Expect(&i).Should(PointTo(Equal(1)))
- Expect(&i).ShouldNot(PointTo(Equal(2)))
- })
-
- It("should work with nested pointers", func() {
- i := 1
- ip := &i
- ipp := &ip
- Expect(ipp).Should(PointTo(PointTo(Equal(1))))
- Expect(ipp).ShouldNot(PointTo(PointTo(Equal(2))))
- })
-})
diff --git a/vendor/github.com/onsi/gomega/gstruct/types.go b/vendor/github.com/onsi/gomega/gstruct/types.go
deleted file mode 100644
index 48cbbe8f6..000000000
--- a/vendor/github.com/onsi/gomega/gstruct/types.go
+++ /dev/null
@@ -1,15 +0,0 @@
-package gstruct
-
-//Options is the type for options passed to some matchers.
-type Options int
-
-const (
- //IgnoreExtras tells the matcher to ignore extra elements or fields, rather than triggering a failure.
- IgnoreExtras Options = 1 << iota
- //IgnoreMissing tells the matcher to ignore missing elements or fields, rather than triggering a failure.
- IgnoreMissing
- //AllowDuplicates tells the matcher to permit multiple members of the slice to produce the same ID when
- //considered by the indentifier function. All members that map to a given key must still match successfully
- //with the matcher that is provided for that key.
- AllowDuplicates
-)
diff --git a/vendor/github.com/onsi/gomega/internal/assertion/assertion_suite_test.go b/vendor/github.com/onsi/gomega/internal/assertion/assertion_suite_test.go
deleted file mode 100644
index dae47a48b..000000000
--- a/vendor/github.com/onsi/gomega/internal/assertion/assertion_suite_test.go
+++ /dev/null
@@ -1,13 +0,0 @@
-package assertion_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-
- "testing"
-)
-
-func TestAssertion(t *testing.T) {
- RegisterFailHandler(Fail)
- RunSpecs(t, "Assertion Suite")
-}
diff --git a/vendor/github.com/onsi/gomega/internal/assertion/assertion_test.go b/vendor/github.com/onsi/gomega/internal/assertion/assertion_test.go
deleted file mode 100644
index cac0d24c5..000000000
--- a/vendor/github.com/onsi/gomega/internal/assertion/assertion_test.go
+++ /dev/null
@@ -1,258 +0,0 @@
-package assertion_test
-
-import (
- "errors"
-
- "github.com/onsi/gomega/internal/testingtsupport"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/internal/assertion"
- "github.com/onsi/gomega/internal/fakematcher"
- "github.com/onsi/gomega/types"
-)
-
-var _ = Describe("Assertion", func() {
- var (
- a *Assertion
- failureMessage string
- failureCallerSkip int
- matcher *fakematcher.FakeMatcher
- )
-
- input := "The thing I'm testing"
-
- var fakeFailWrapper = &types.GomegaFailWrapper{
- Fail: func(message string, callerSkip ...int) {
- failureMessage = message
- if len(callerSkip) == 1 {
- failureCallerSkip = callerSkip[0]
- }
- },
- TWithHelper: testingtsupport.EmptyTWithHelper{},
- }
-
- BeforeEach(func() {
- matcher = &fakematcher.FakeMatcher{}
- failureMessage = ""
- failureCallerSkip = 0
- a = New(input, fakeFailWrapper, 1)
- })
-
- Context("when called", func() {
- It("should pass the provided input value to the matcher", func() {
- a.Should(matcher)
-
- Expect(matcher.ReceivedActual).Should(Equal(input))
- matcher.ReceivedActual = ""
-
- a.ShouldNot(matcher)
-
- Expect(matcher.ReceivedActual).Should(Equal(input))
- matcher.ReceivedActual = ""
-
- a.To(matcher)
-
- Expect(matcher.ReceivedActual).Should(Equal(input))
- matcher.ReceivedActual = ""
-
- a.ToNot(matcher)
-
- Expect(matcher.ReceivedActual).Should(Equal(input))
- matcher.ReceivedActual = ""
-
- a.NotTo(matcher)
-
- Expect(matcher.ReceivedActual).Should(Equal(input))
- })
- })
-
- Context("when the matcher succeeds", func() {
- BeforeEach(func() {
- matcher.MatchesToReturn = true
- matcher.ErrToReturn = nil
- })
-
- Context("and a positive assertion is being made", func() {
- It("should not call the failure callback", func() {
- a.Should(matcher)
- Expect(failureMessage).Should(Equal(""))
- })
-
- It("should be true", func() {
- Expect(a.Should(matcher)).Should(BeTrue())
- })
- })
-
- Context("and a negative assertion is being made", func() {
- It("should call the failure callback", func() {
- a.ShouldNot(matcher)
- Expect(failureMessage).Should(Equal("negative: The thing I'm testing"))
- Expect(failureCallerSkip).Should(Equal(3))
- })
-
- It("should be false", func() {
- Expect(a.ShouldNot(matcher)).Should(BeFalse())
- })
- })
- })
-
- Context("when the matcher fails", func() {
- BeforeEach(func() {
- matcher.MatchesToReturn = false
- matcher.ErrToReturn = nil
- })
-
- Context("and a positive assertion is being made", func() {
- It("should call the failure callback", func() {
- a.Should(matcher)
- Expect(failureMessage).Should(Equal("positive: The thing I'm testing"))
- Expect(failureCallerSkip).Should(Equal(3))
- })
-
- It("should be false", func() {
- Expect(a.Should(matcher)).Should(BeFalse())
- })
- })
-
- Context("and a negative assertion is being made", func() {
- It("should not call the failure callback", func() {
- a.ShouldNot(matcher)
- Expect(failureMessage).Should(Equal(""))
- })
-
- It("should be true", func() {
- Expect(a.ShouldNot(matcher)).Should(BeTrue())
- })
- })
- })
-
- Context("When reporting a failure", func() {
- BeforeEach(func() {
- matcher.MatchesToReturn = false
- matcher.ErrToReturn = nil
- })
-
- Context("and there is an optional description", func() {
- It("should append the description to the failure message", func() {
- a.Should(matcher, "A description")
- Expect(failureMessage).Should(Equal("A description\npositive: The thing I'm testing"))
- Expect(failureCallerSkip).Should(Equal(3))
- })
- })
-
- Context("and there are multiple arguments to the optional description", func() {
- It("should append the formatted description to the failure message", func() {
- a.Should(matcher, "A description of [%d]", 3)
- Expect(failureMessage).Should(Equal("A description of [3]\npositive: The thing I'm testing"))
- Expect(failureCallerSkip).Should(Equal(3))
- })
- })
- })
-
- Context("When the matcher returns an error", func() {
- BeforeEach(func() {
- matcher.ErrToReturn = errors.New("Kaboom!")
- })
-
- Context("and a positive assertion is being made", func() {
- It("should call the failure callback", func() {
- matcher.MatchesToReturn = true
- a.Should(matcher)
- Expect(failureMessage).Should(Equal("Kaboom!"))
- Expect(failureCallerSkip).Should(Equal(3))
- })
- })
-
- Context("and a negative assertion is being made", func() {
- It("should call the failure callback", func() {
- matcher.MatchesToReturn = false
- a.ShouldNot(matcher)
- Expect(failureMessage).Should(Equal("Kaboom!"))
- Expect(failureCallerSkip).Should(Equal(3))
- })
- })
-
- It("should always be false", func() {
- Expect(a.Should(matcher)).Should(BeFalse())
- Expect(a.ShouldNot(matcher)).Should(BeFalse())
- })
- })
-
- Context("when there are extra parameters", func() {
- It("(a simple example)", func() {
- Expect(func() (string, int, error) {
- return "foo", 0, nil
- }()).Should(Equal("foo"))
- })
-
- Context("when the parameters are all nil or zero", func() {
- It("should invoke the matcher", func() {
- matcher.MatchesToReturn = true
- matcher.ErrToReturn = nil
-
- var typedNil []string
- a = New(input, fakeFailWrapper, 1, 0, nil, typedNil)
-
- result := a.Should(matcher)
- Expect(result).Should(BeTrue())
- Expect(matcher.ReceivedActual).Should(Equal(input))
-
- Expect(failureMessage).Should(BeZero())
- })
- })
-
- Context("when any of the parameters are not nil or zero", func() {
- It("should call the failure callback", func() {
- matcher.MatchesToReturn = false
- matcher.ErrToReturn = nil
-
- a = New(input, fakeFailWrapper, 1, errors.New("foo"))
- result := a.Should(matcher)
- Expect(result).Should(BeFalse())
- Expect(matcher.ReceivedActual).Should(BeZero(), "The matcher doesn't even get called")
- Expect(failureMessage).Should(ContainSubstring("foo"))
- failureMessage = ""
-
- a = New(input, fakeFailWrapper, 1, nil, 1)
- result = a.ShouldNot(matcher)
- Expect(result).Should(BeFalse())
- Expect(failureMessage).Should(ContainSubstring("1"))
- failureMessage = ""
-
- a = New(input, fakeFailWrapper, 1, nil, 0, []string{"foo"})
- result = a.To(matcher)
- Expect(result).Should(BeFalse())
- Expect(failureMessage).Should(ContainSubstring("foo"))
- failureMessage = ""
-
- a = New(input, fakeFailWrapper, 1, nil, 0, []string{"foo"})
- result = a.ToNot(matcher)
- Expect(result).Should(BeFalse())
- Expect(failureMessage).Should(ContainSubstring("foo"))
- failureMessage = ""
-
- a = New(input, fakeFailWrapper, 1, nil, 0, []string{"foo"})
- result = a.NotTo(matcher)
- Expect(result).Should(BeFalse())
- Expect(failureMessage).Should(ContainSubstring("foo"))
- Expect(failureCallerSkip).Should(Equal(3))
- })
- })
- })
-
- Context("Making an assertion without a registered fail handler", func() {
- It("should panic", func() {
- defer func() {
- e := recover()
- RegisterFailHandler(Fail)
- if e == nil {
- Fail("expected a panic to have occurred")
- }
- }()
-
- RegisterFailHandler(nil)
- Expect(true).Should(BeTrue())
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion_suite_test.go b/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion_suite_test.go
deleted file mode 100644
index bdb0c3d22..000000000
--- a/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion_suite_test.go
+++ /dev/null
@@ -1,13 +0,0 @@
-package asyncassertion_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-
- "testing"
-)
-
-func TestAsyncAssertion(t *testing.T) {
- RegisterFailHandler(Fail)
- RunSpecs(t, "AsyncAssertion Suite")
-}
diff --git a/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion_test.go b/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion_test.go
deleted file mode 100644
index afd61a7cd..000000000
--- a/vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion_test.go
+++ /dev/null
@@ -1,351 +0,0 @@
-package asyncassertion_test
-
-import (
- "errors"
- "time"
-
- "github.com/onsi/gomega/internal/testingtsupport"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/internal/asyncassertion"
- "github.com/onsi/gomega/types"
-)
-
-var _ = Describe("Async Assertion", func() {
- var (
- failureMessage string
- callerSkip int
- )
-
- var fakeFailWrapper = &types.GomegaFailWrapper{
- Fail: func(message string, skip ...int) {
- failureMessage = message
- callerSkip = skip[0]
- },
- TWithHelper: testingtsupport.EmptyTWithHelper{},
- }
-
- BeforeEach(func() {
- failureMessage = ""
- callerSkip = 0
- })
-
- Describe("Eventually", func() {
- Context("the positive case", func() {
- It("should poll the function and matcher", func() {
- counter := 0
- a := New(AsyncAssertionTypeEventually, func() int {
- counter++
- return counter
- }, fakeFailWrapper, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1)
-
- a.Should(BeNumerically("==", 5))
- Expect(failureMessage).Should(BeZero())
- })
-
- It("should continue when the matcher errors", func() {
- counter := 0
- a := New(AsyncAssertionTypeEventually, func() interface{} {
- counter++
- if counter == 5 {
- return "not-a-number" //this should cause the matcher to error
- }
- return counter
- }, fakeFailWrapper, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1)
-
- a.Should(BeNumerically("==", 5), "My description %d", 2)
-
- Expect(failureMessage).Should(ContainSubstring("Timed out after"))
- Expect(failureMessage).Should(ContainSubstring("My description 2"))
- Expect(callerSkip).Should(Equal(4))
- })
-
- It("should be able to timeout", func() {
- counter := 0
- a := New(AsyncAssertionTypeEventually, func() int {
- counter++
- return counter
- }, fakeFailWrapper, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1)
-
- a.Should(BeNumerically(">", 100), "My description %d", 2)
-
- Expect(counter).Should(BeNumerically(">", 8))
- Expect(counter).Should(BeNumerically("<=", 10))
- Expect(failureMessage).Should(ContainSubstring("Timed out after"))
- Expect(failureMessage).Should(MatchRegexp(`\<int\>: \d`), "Should pass the correct value to the matcher message formatter.")
- Expect(failureMessage).Should(ContainSubstring("My description 2"))
- Expect(callerSkip).Should(Equal(4))
- })
- })
-
- Context("the negative case", func() {
- It("should poll the function and matcher", func() {
- counter := 0
- a := New(AsyncAssertionTypeEventually, func() int {
- counter += 1
- return counter
- }, fakeFailWrapper, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1)
-
- a.ShouldNot(BeNumerically("<", 3))
-
- Expect(counter).Should(Equal(3))
- Expect(failureMessage).Should(BeZero())
- })
-
- It("should timeout when the matcher errors", func() {
- a := New(AsyncAssertionTypeEventually, func() interface{} {
- return 0 //this should cause the matcher to error
- }, fakeFailWrapper, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1)
-
- a.ShouldNot(HaveLen(0), "My description %d", 2)
-
- Expect(failureMessage).Should(ContainSubstring("Timed out after"))
- Expect(failureMessage).Should(ContainSubstring("Error:"))
- Expect(failureMessage).Should(ContainSubstring("My description 2"))
- Expect(callerSkip).Should(Equal(4))
- })
-
- It("should be able to timeout", func() {
- a := New(AsyncAssertionTypeEventually, func() int {
- return 0
- }, fakeFailWrapper, time.Duration(0.1*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1)
-
- a.ShouldNot(Equal(0), "My description %d", 2)
-
- Expect(failureMessage).Should(ContainSubstring("Timed out after"))
- Expect(failureMessage).Should(ContainSubstring("<int>: 0"), "Should pass the correct value to the matcher message formatter.")
- Expect(failureMessage).Should(ContainSubstring("My description 2"))
- Expect(callerSkip).Should(Equal(4))
- })
- })
-
- Context("with a function that returns multiple values", func() {
- It("should eventually succeed if the additional arguments are nil", func() {
- i := 0
- Eventually(func() (int, error) {
- i++
- return i, nil
- }).Should(Equal(10))
- })
-
- It("should eventually timeout if the additional arguments are not nil", func() {
- i := 0
- a := New(AsyncAssertionTypeEventually, func() (int, error) {
- i++
- return i, errors.New("bam")
- }, fakeFailWrapper, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1)
- a.Should(Equal(2))
-
- Expect(failureMessage).Should(ContainSubstring("Timed out after"))
- Expect(failureMessage).Should(ContainSubstring("Error:"))
- Expect(failureMessage).Should(ContainSubstring("bam"))
- Expect(callerSkip).Should(Equal(4))
- })
- })
-
- Context("Making an assertion without a registered fail handler", func() {
- It("should panic", func() {
- defer func() {
- e := recover()
- RegisterFailHandler(Fail)
- if e == nil {
- Fail("expected a panic to have occurred")
- }
- }()
-
- RegisterFailHandler(nil)
- c := make(chan bool, 1)
- c <- true
- Eventually(c).Should(Receive())
- })
- })
- })
-
- Describe("Consistently", func() {
- Describe("The positive case", func() {
- Context("when the matcher consistently passes for the duration", func() {
- It("should pass", func() {
- calls := 0
- a := New(AsyncAssertionTypeConsistently, func() string {
- calls++
- return "foo"
- }, fakeFailWrapper, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1)
-
- a.Should(Equal("foo"))
- Expect(calls).Should(BeNumerically(">", 8))
- Expect(calls).Should(BeNumerically("<=", 10))
- Expect(failureMessage).Should(BeZero())
- })
- })
-
- Context("when the matcher fails at some point", func() {
- It("should fail", func() {
- calls := 0
- a := New(AsyncAssertionTypeConsistently, func() interface{} {
- calls++
- if calls > 5 {
- return "bar"
- }
- return "foo"
- }, fakeFailWrapper, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1)
-
- a.Should(Equal("foo"))
- Expect(failureMessage).Should(ContainSubstring("to equal"))
- Expect(callerSkip).Should(Equal(4))
- })
- })
-
- Context("when the matcher errors at some point", func() {
- It("should fail", func() {
- calls := 0
- a := New(AsyncAssertionTypeConsistently, func() interface{} {
- calls++
- if calls > 5 {
- return 3
- }
- return []int{1, 2, 3}
- }, fakeFailWrapper, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1)
-
- a.Should(HaveLen(3))
- Expect(failureMessage).Should(ContainSubstring("HaveLen matcher expects"))
- Expect(callerSkip).Should(Equal(4))
- })
- })
- })
-
- Describe("The negative case", func() {
- Context("when the matcher consistently passes for the duration", func() {
- It("should pass", func() {
- c := make(chan bool)
- a := New(AsyncAssertionTypeConsistently, c, fakeFailWrapper, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1)
-
- a.ShouldNot(Receive())
- Expect(failureMessage).Should(BeZero())
- })
- })
-
- Context("when the matcher fails at some point", func() {
- It("should fail", func() {
- c := make(chan bool)
- go func() {
- time.Sleep(time.Duration(100 * time.Millisecond))
- c <- true
- }()
-
- a := New(AsyncAssertionTypeConsistently, c, fakeFailWrapper, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1)
-
- a.ShouldNot(Receive())
- Expect(failureMessage).Should(ContainSubstring("not to receive anything"))
- })
- })
-
- Context("when the matcher errors at some point", func() {
- It("should fail", func() {
- calls := 0
- a := New(AsyncAssertionTypeConsistently, func() interface{} {
- calls++
- return calls
- }, fakeFailWrapper, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1)
-
- a.ShouldNot(BeNumerically(">", 5))
- Expect(failureMessage).Should(ContainSubstring("not to be >"))
- Expect(callerSkip).Should(Equal(4))
- })
- })
- })
-
- Context("with a function that returns multiple values", func() {
- It("should consistently succeed if the additional arguments are nil", func() {
- i := 2
- Consistently(func() (int, error) {
- i++
- return i, nil
- }).Should(BeNumerically(">=", 2))
- })
-
- It("should eventually timeout if the additional arguments are not nil", func() {
- i := 2
- a := New(AsyncAssertionTypeEventually, func() (int, error) {
- i++
- return i, errors.New("bam")
- }, fakeFailWrapper, time.Duration(0.2*float64(time.Second)), time.Duration(0.02*float64(time.Second)), 1)
- a.Should(BeNumerically(">=", 2))
-
- Expect(failureMessage).Should(ContainSubstring("Error:"))
- Expect(failureMessage).Should(ContainSubstring("bam"))
- Expect(callerSkip).Should(Equal(4))
- })
- })
-
- Context("Making an assertion without a registered fail handler", func() {
- It("should panic", func() {
- defer func() {
- e := recover()
- RegisterFailHandler(Fail)
- if e == nil {
- Fail("expected a panic to have occurred")
- }
- }()
-
- RegisterFailHandler(nil)
- c := make(chan bool)
- Consistently(c).ShouldNot(Receive())
- })
- })
- })
-
- Context("when passed a function with the wrong # or arguments & returns", func() {
- It("should panic", func() {
- Expect(func() {
- New(AsyncAssertionTypeEventually, func() {}, fakeFailWrapper, 0, 0, 1)
- }).Should(Panic())
-
- Expect(func() {
- New(AsyncAssertionTypeEventually, func(a string) int { return 0 }, fakeFailWrapper, 0, 0, 1)
- }).Should(Panic())
-
- Expect(func() {
- New(AsyncAssertionTypeEventually, func() int { return 0 }, fakeFailWrapper, 0, 0, 1)
- }).ShouldNot(Panic())
-
- Expect(func() {
- New(AsyncAssertionTypeEventually, func() (int, error) { return 0, nil }, fakeFailWrapper, 0, 0, 1)
- }).ShouldNot(Panic())
- })
- })
-
- Describe("bailing early", func() {
- Context("when actual is a value", func() {
- It("Eventually should bail out and fail early if the matcher says to", func() {
- c := make(chan bool)
- close(c)
-
- t := time.Now()
- failures := InterceptGomegaFailures(func() {
- Eventually(c, 0.1).Should(Receive())
- })
- Expect(time.Since(t)).Should(BeNumerically("<", 90*time.Millisecond))
-
- Expect(failures).Should(HaveLen(1))
- })
- })
-
- Context("when actual is a function", func() {
- It("should never bail early", func() {
- c := make(chan bool)
- close(c)
-
- t := time.Now()
- failures := InterceptGomegaFailures(func() {
- Eventually(func() chan bool {
- return c
- }, 0.1).Should(Receive())
- })
- Expect(time.Since(t)).Should(BeNumerically(">=", 90*time.Millisecond))
-
- Expect(failures).Should(HaveLen(1))
- })
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/internal/fakematcher/fake_matcher.go b/vendor/github.com/onsi/gomega/internal/fakematcher/fake_matcher.go
deleted file mode 100644
index 6e351a7de..000000000
--- a/vendor/github.com/onsi/gomega/internal/fakematcher/fake_matcher.go
+++ /dev/null
@@ -1,23 +0,0 @@
-package fakematcher
-
-import "fmt"
-
-type FakeMatcher struct {
- ReceivedActual interface{}
- MatchesToReturn bool
- ErrToReturn error
-}
-
-func (matcher *FakeMatcher) Match(actual interface{}) (bool, error) {
- matcher.ReceivedActual = actual
-
- return matcher.MatchesToReturn, matcher.ErrToReturn
-}
-
-func (matcher *FakeMatcher) FailureMessage(actual interface{}) string {
- return fmt.Sprintf("positive: %v", actual)
-}
-
-func (matcher *FakeMatcher) NegatedFailureMessage(actual interface{}) string {
- return fmt.Sprintf("negative: %v", actual)
-}
diff --git a/vendor/github.com/onsi/gomega/internal/testingtsupport/testing_t_support_test.go b/vendor/github.com/onsi/gomega/internal/testingtsupport/testing_t_support_test.go
deleted file mode 100644
index 8fd8f0a6c..000000000
--- a/vendor/github.com/onsi/gomega/internal/testingtsupport/testing_t_support_test.go
+++ /dev/null
@@ -1,92 +0,0 @@
-package testingtsupport_test
-
-import (
- "regexp"
- "time"
-
- "github.com/onsi/gomega/internal/testingtsupport"
-
- . "github.com/onsi/gomega"
-
- "fmt"
- "testing"
-)
-
-func TestTestingT(t *testing.T) {
- RegisterTestingT(t)
- Ω(true).Should(BeTrue())
-}
-
-type FakeTWithHelper struct {
- LastFatal string
-}
-
-func (f *FakeTWithHelper) Fatalf(format string, args ...interface{}) {
- f.LastFatal = fmt.Sprintf(format, args...)
-}
-
-func TestGomegaWithTWithoutHelper(t *testing.T) {
- g := NewGomegaWithT(t)
-
- testingtsupport.StackTracePruneRE = regexp.MustCompile(`\/ginkgo\/`)
-
- f := &FakeTWithHelper{}
- testG := NewGomegaWithT(f)
-
- testG.Expect("foo").To(Equal("foo"))
- g.Expect(f.LastFatal).To(BeZero())
-
- testG.Expect("foo").To(Equal("bar"))
- g.Expect(f.LastFatal).To(ContainSubstring("<string>: foo"))
- g.Expect(f.LastFatal).To(ContainSubstring("testingtsupport_test"), "It should include a stacktrace")
-
- testG.Eventually("foo2", time.Millisecond).Should(Equal("bar"))
- g.Expect(f.LastFatal).To(ContainSubstring("<string>: foo2"))
-
- testG.Consistently("foo3", time.Millisecond).Should(Equal("bar"))
- g.Expect(f.LastFatal).To(ContainSubstring("<string>: foo3"))
-}
-
-type FakeTWithoutHelper struct {
- LastFatal string
- HelperCount int
-}
-
-func (f *FakeTWithoutHelper) Fatalf(format string, args ...interface{}) {
- f.LastFatal = fmt.Sprintf(format, args...)
-}
-
-func (f *FakeTWithoutHelper) Helper() {
- f.HelperCount += 1
-}
-
-func (f *FakeTWithoutHelper) ResetHelper() {
- f.HelperCount = 0
-}
-
-func TestGomegaWithTWithHelper(t *testing.T) {
- g := NewGomegaWithT(t)
-
- f := &FakeTWithoutHelper{}
- testG := NewGomegaWithT(f)
-
- testG.Expect("foo").To(Equal("foo"))
- g.Expect(f.LastFatal).To(BeZero())
- g.Expect(f.HelperCount).To(BeNumerically(">", 0))
- f.ResetHelper()
-
- testG.Expect("foo").To(Equal("bar"))
- g.Expect(f.LastFatal).To(ContainSubstring("<string>: foo"))
- g.Expect(f.LastFatal).NotTo(ContainSubstring("testingtsupport_test"), "It should _not_ include a stacktrace")
- g.Expect(f.HelperCount).To(BeNumerically(">", 0))
- f.ResetHelper()
-
- testG.Eventually("foo2", time.Millisecond).Should(Equal("bar"))
- g.Expect(f.LastFatal).To(ContainSubstring("<string>: foo2"))
- g.Expect(f.HelperCount).To(BeNumerically(">", 0))
- f.ResetHelper()
-
- testG.Consistently("foo3", time.Millisecond).Should(Equal("bar"))
- g.Expect(f.LastFatal).To(ContainSubstring("<string>: foo3"))
- g.Expect(f.HelperCount).To(BeNumerically(">", 0))
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/and_test.go b/vendor/github.com/onsi/gomega/matchers/and_test.go
deleted file mode 100644
index acf778cd6..000000000
--- a/vendor/github.com/onsi/gomega/matchers/and_test.go
+++ /dev/null
@@ -1,103 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
- "github.com/onsi/gomega/types"
-)
-
-// sample data
-var (
- // example input
- input = "hi"
- // some matchers that succeed against the input
- true1 = HaveLen(2)
- true2 = Equal("hi")
- true3 = MatchRegexp("hi")
- // some matchers that fail against the input.
- false1 = HaveLen(1)
- false2 = Equal("hip")
- false3 = MatchRegexp("hope")
-)
-
-// verifyFailureMessage expects the matcher to fail with the given input, and verifies the failure message.
-func verifyFailureMessage(m types.GomegaMatcher, input string, expectedFailureMsgFragment string) {
- Expect(m.Match(input)).To(BeFalse())
- Expect(m.FailureMessage(input)).To(Equal(
- "Expected\n <string>: " + input + "\n" + expectedFailureMsgFragment))
-}
-
-var _ = Describe("AndMatcher", func() {
- It("works with positive cases", func() {
- Expect(input).To(And())
- Expect(input).To(And(true1))
- Expect(input).To(And(true1, true2))
- Expect(input).To(And(true1, true2, true3))
-
- // use alias
- Expect(input).To(SatisfyAll(true1, true2, true3))
- })
-
- It("works with negative cases", func() {
- Expect(input).ToNot(And(false1, false2))
- Expect(input).ToNot(And(true1, true2, false3))
- Expect(input).ToNot(And(true1, false2, false3))
- Expect(input).ToNot(And(false1, true1, true2))
- })
-
- Context("failure messages", func() {
- Context("when match fails", func() {
- It("gives a descriptive message", func() {
- verifyFailureMessage(And(false1, true1), input, "to have length 1")
- verifyFailureMessage(And(true1, false2), input, "to equal\n <string>: hip")
- verifyFailureMessage(And(true1, true2, false3), input, "to match regular expression\n <string>: hope")
- })
- })
-
- Context("when match succeeds, but expected it to fail", func() {
- It("gives a descriptive message", func() {
- verifyFailureMessage(Not(And(true1, true2)), input,
- `To not satisfy all of these matchers: [%!s(*matchers.HaveLenMatcher=&{2}) %!s(*matchers.EqualMatcher=&{hi})]`)
- })
- })
- })
-
- Context("MatchMayChangeInTheFuture", func() {
- Context("Match returned false", func() {
- Context("returns value of the failed matcher", func() {
- It("false if failed matcher not going to change", func() {
- // 3 matchers: 1st returns true, 2nd returns false and is not going to change, 3rd is never called
- m := And(Not(BeNil()), Or(), Equal(1))
- Expect(m.Match("hi")).To(BeFalse())
- Expect(m.(*AndMatcher).MatchMayChangeInTheFuture("hi")).To(BeFalse()) // empty Or() indicates not going to change
- })
- It("true if failed matcher indicates it might change", func() {
- // 3 matchers: 1st returns true, 2nd returns false and "might" change, 3rd is never called
- m := And(Not(BeNil()), Equal(5), Equal(1))
- Expect(m.Match("hi")).To(BeFalse())
- Expect(m.(*AndMatcher).MatchMayChangeInTheFuture("hi")).To(BeTrue()) // Equal(5) indicates it might change
- })
- })
- })
- Context("Match returned true", func() {
- It("returns true if any of the matchers could change", func() {
- // 3 matchers, all return true, and all could change
- m := And(Not(BeNil()), Equal("hi"), HaveLen(2))
- Expect(m.Match("hi")).To(BeTrue())
- Expect(m.(*AndMatcher).MatchMayChangeInTheFuture("hi")).To(BeTrue()) // all 3 of these matchers default to 'true'
- })
- It("returns false if none of the matchers could change", func() {
- // empty And() has the property of always matching, and never can change since there are no sub-matchers that could change
- m := And()
- Expect(m.Match("anything")).To(BeTrue())
- Expect(m.(*AndMatcher).MatchMayChangeInTheFuture("anything")).To(BeFalse())
-
- // And() with 3 sub-matchers that return true, and can't change
- m = And(And(), And(), And())
- Expect(m.Match("hi")).To(BeTrue())
- Expect(m.(*AndMatcher).MatchMayChangeInTheFuture("hi")).To(BeFalse()) // the 3 empty And()'s won't change
- })
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher_test.go
deleted file mode 100644
index 471a46d97..000000000
--- a/vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher_test.go
+++ /dev/null
@@ -1,46 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("AssignableToTypeOf", func() {
- Context("When asserting assignability between types", func() {
- It("should do the right thing", func() {
- Expect(0).Should(BeAssignableToTypeOf(0))
- Expect(5).Should(BeAssignableToTypeOf(-1))
- Expect("foo").Should(BeAssignableToTypeOf("bar"))
- Expect(struct{ Foo string }{}).Should(BeAssignableToTypeOf(struct{ Foo string }{}))
-
- Expect(0).ShouldNot(BeAssignableToTypeOf("bar"))
- Expect(5).ShouldNot(BeAssignableToTypeOf(struct{ Foo string }{}))
- Expect("foo").ShouldNot(BeAssignableToTypeOf(42))
- })
- })
-
- Context("When asserting nil values", func() {
- It("should error", func() {
- success, err := (&AssignableToTypeOfMatcher{Expected: nil}).Match(nil)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
-
- Context("When actual is nil and expected is not nil", func() {
- It("should return false without error", func() {
- success, err := (&AssignableToTypeOfMatcher{Expected: 17}).Match(nil)
- Expect(success).Should(BeFalse())
- Expect(err).ShouldNot(HaveOccurred())
- })
- })
-
- Context("When actual is not nil and expected is nil", func() {
- It("should error", func() {
- success, err := (&AssignableToTypeOfMatcher{Expected: nil}).Match(17)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/be_a_directory_test.go b/vendor/github.com/onsi/gomega/matchers/be_a_directory_test.go
deleted file mode 100644
index bc8742763..000000000
--- a/vendor/github.com/onsi/gomega/matchers/be_a_directory_test.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package matchers_test
-
-import (
- "io/ioutil"
- "os"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("BeADirectoryMatcher", func() {
- Context("when passed a string", func() {
- It("should do the right thing", func() {
- Expect("/dne/test").ShouldNot(BeADirectory())
-
- tmpFile, err := ioutil.TempFile("", "gomega-test-tempfile")
- Expect(err).ShouldNot(HaveOccurred())
- defer os.Remove(tmpFile.Name())
- Expect(tmpFile.Name()).ShouldNot(BeADirectory())
-
- tmpDir, err := ioutil.TempDir("", "gomega-test-tempdir")
- Expect(err).ShouldNot(HaveOccurred())
- defer os.Remove(tmpDir)
- Expect(tmpDir).Should(BeADirectory())
- })
- })
-
- Context("when passed something else", func() {
- It("should error", func() {
- success, err := (&BeADirectoryMatcher{}).Match(nil)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- success, err = (&BeADirectoryMatcher{}).Match(true)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/be_a_regular_file_test.go b/vendor/github.com/onsi/gomega/matchers/be_a_regular_file_test.go
deleted file mode 100644
index eae06a03e..000000000
--- a/vendor/github.com/onsi/gomega/matchers/be_a_regular_file_test.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package matchers_test
-
-import (
- "io/ioutil"
- "os"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("BeARegularFileMatcher", func() {
- Context("when passed a string", func() {
- It("should do the right thing", func() {
- Expect("/dne/test").ShouldNot(BeARegularFile())
-
- tmpFile, err := ioutil.TempFile("", "gomega-test-tempfile")
- Expect(err).ShouldNot(HaveOccurred())
- defer os.Remove(tmpFile.Name())
- Expect(tmpFile.Name()).Should(BeARegularFile())
-
- tmpDir, err := ioutil.TempDir("", "gomega-test-tempdir")
- Expect(err).ShouldNot(HaveOccurred())
- defer os.Remove(tmpDir)
- Expect(tmpDir).ShouldNot(BeARegularFile())
- })
- })
-
- Context("when passed something else", func() {
- It("should error", func() {
- success, err := (&BeARegularFileMatcher{}).Match(nil)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- success, err = (&BeARegularFileMatcher{}).Match(true)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/be_an_existing_file_test.go b/vendor/github.com/onsi/gomega/matchers/be_an_existing_file_test.go
deleted file mode 100644
index e28bd0d65..000000000
--- a/vendor/github.com/onsi/gomega/matchers/be_an_existing_file_test.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package matchers_test
-
-import (
- "io/ioutil"
- "os"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("BeAnExistingFileMatcher", func() {
- Context("when passed a string", func() {
- It("should do the right thing", func() {
- Expect("/dne/test").ShouldNot(BeAnExistingFile())
-
- tmpFile, err := ioutil.TempFile("", "gomega-test-tempfile")
- Expect(err).ShouldNot(HaveOccurred())
- defer os.Remove(tmpFile.Name())
- Expect(tmpFile.Name()).Should(BeAnExistingFile())
-
- tmpDir, err := ioutil.TempDir("", "gomega-test-tempdir")
- Expect(err).ShouldNot(HaveOccurred())
- defer os.Remove(tmpDir)
- Expect(tmpDir).Should(BeAnExistingFile())
- })
- })
-
- Context("when passed something else", func() {
- It("should error", func() {
- success, err := (&BeAnExistingFileMatcher{}).Match(nil)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- success, err = (&BeAnExistingFileMatcher{}).Match(true)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/be_closed_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/be_closed_matcher_test.go
deleted file mode 100644
index c2e49ab50..000000000
--- a/vendor/github.com/onsi/gomega/matchers/be_closed_matcher_test.go
+++ /dev/null
@@ -1,70 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("BeClosedMatcher", func() {
- Context("when passed a channel", func() {
- It("should do the right thing", func() {
- openChannel := make(chan bool)
- Expect(openChannel).ShouldNot(BeClosed())
-
- var openReaderChannel <-chan bool
- openReaderChannel = openChannel
- Expect(openReaderChannel).ShouldNot(BeClosed())
-
- closedChannel := make(chan bool)
- close(closedChannel)
-
- Expect(closedChannel).Should(BeClosed())
-
- var closedReaderChannel <-chan bool
- closedReaderChannel = closedChannel
- Expect(closedReaderChannel).Should(BeClosed())
- })
- })
-
- Context("when passed a send-only channel", func() {
- It("should error", func() {
- openChannel := make(chan bool)
- var openWriterChannel chan<- bool
- openWriterChannel = openChannel
-
- success, err := (&BeClosedMatcher{}).Match(openWriterChannel)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- closedChannel := make(chan bool)
- close(closedChannel)
-
- var closedWriterChannel chan<- bool
- closedWriterChannel = closedChannel
-
- success, err = (&BeClosedMatcher{}).Match(closedWriterChannel)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- })
- })
-
- Context("when passed something else", func() {
- It("should error", func() {
- var nilChannel chan bool
-
- success, err := (&BeClosedMatcher{}).Match(nilChannel)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- success, err = (&BeClosedMatcher{}).Match(nil)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- success, err = (&BeClosedMatcher{}).Match(7)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/be_empty_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/be_empty_matcher_test.go
deleted file mode 100644
index 132480cfc..000000000
--- a/vendor/github.com/onsi/gomega/matchers/be_empty_matcher_test.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("BeEmpty", func() {
- Context("when passed a supported type", func() {
- It("should do the right thing", func() {
- Expect("").Should(BeEmpty())
- Expect(" ").ShouldNot(BeEmpty())
-
- Expect([0]int{}).Should(BeEmpty())
- Expect([1]int{1}).ShouldNot(BeEmpty())
-
- Expect([]int{}).Should(BeEmpty())
- Expect([]int{1}).ShouldNot(BeEmpty())
-
- Expect(map[string]int{}).Should(BeEmpty())
- Expect(map[string]int{"a": 1}).ShouldNot(BeEmpty())
-
- c := make(chan bool, 1)
- Expect(c).Should(BeEmpty())
- c <- true
- Expect(c).ShouldNot(BeEmpty())
- })
- })
-
- Context("when passed a correctly typed nil", func() {
- It("should be true", func() {
- var nilSlice []int
- Expect(nilSlice).Should(BeEmpty())
-
- var nilMap map[int]string
- Expect(nilMap).Should(BeEmpty())
- })
- })
-
- Context("when passed an unsupported type", func() {
- It("should error", func() {
- success, err := (&BeEmptyMatcher{}).Match(0)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- success, err = (&BeEmptyMatcher{}).Match(nil)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher_test.go
deleted file mode 100644
index 4d9d11d2d..000000000
--- a/vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher_test.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("BeEquivalentTo", func() {
- Context("when asserting that nil is equivalent to nil", func() {
- It("should error", func() {
- success, err := (&BeEquivalentToMatcher{Expected: nil}).Match(nil)
-
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-
- Context("When asserting on nil", func() {
- It("should do the right thing", func() {
- Expect("foo").ShouldNot(BeEquivalentTo(nil))
- Expect(nil).ShouldNot(BeEquivalentTo(3))
- Expect([]int{1, 2}).ShouldNot(BeEquivalentTo(nil))
- })
- })
-
- Context("When asserting on type aliases", func() {
- It("should the right thing", func() {
- Expect(StringAlias("foo")).Should(BeEquivalentTo("foo"))
- Expect("foo").Should(BeEquivalentTo(StringAlias("foo")))
- Expect(StringAlias("foo")).ShouldNot(BeEquivalentTo("bar"))
- Expect("foo").ShouldNot(BeEquivalentTo(StringAlias("bar")))
- })
- })
-
- Context("When asserting on numbers", func() {
- It("should convert actual to expected and do the right thing", func() {
- Expect(5).Should(BeEquivalentTo(5))
- Expect(5.0).Should(BeEquivalentTo(5.0))
- Expect(5).Should(BeEquivalentTo(5.0))
-
- Expect(5).ShouldNot(BeEquivalentTo("5"))
- Expect(5).ShouldNot(BeEquivalentTo(3))
-
- //Here be dragons!
- Expect(5.1).Should(BeEquivalentTo(5))
- Expect(5).ShouldNot(BeEquivalentTo(5.1))
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/be_false_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/be_false_matcher_test.go
deleted file mode 100644
index 25e70633d..000000000
--- a/vendor/github.com/onsi/gomega/matchers/be_false_matcher_test.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("BeFalse", func() {
- It("should handle true and false correctly", func() {
- Expect(true).ShouldNot(BeFalse())
- Expect(false).Should(BeFalse())
- })
-
- It("should only support booleans", func() {
- success, err := (&BeFalseMatcher{}).Match("foo")
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/be_identical_to_test.go b/vendor/github.com/onsi/gomega/matchers/be_identical_to_test.go
deleted file mode 100644
index 7fdd56eed..000000000
--- a/vendor/github.com/onsi/gomega/matchers/be_identical_to_test.go
+++ /dev/null
@@ -1,61 +0,0 @@
-package matchers_test
-
-import (
- "errors"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("BeIdenticalTo", func() {
- Context("when asserting that nil equals nil", func() {
- It("should error", func() {
- success, err := (&BeIdenticalToMatcher{Expected: nil}).Match(nil)
-
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-
- It("should treat the same pointer to a struct as identical", func() {
- mySpecialStruct := myCustomType{}
- Expect(&mySpecialStruct).Should(BeIdenticalTo(&mySpecialStruct))
- Expect(&myCustomType{}).ShouldNot(BeIdenticalTo(&mySpecialStruct))
- })
-
- It("should be strict about types", func() {
- Expect(5).ShouldNot(BeIdenticalTo("5"))
- Expect(5).ShouldNot(BeIdenticalTo(5.0))
- Expect(5).ShouldNot(BeIdenticalTo(3))
- })
-
- It("should treat primtives as identical", func() {
- Expect("5").Should(BeIdenticalTo("5"))
- Expect("5").ShouldNot(BeIdenticalTo("55"))
-
- Expect(5.55).Should(BeIdenticalTo(5.55))
- Expect(5.55).ShouldNot(BeIdenticalTo(6.66))
-
- Expect(5).Should(BeIdenticalTo(5))
- Expect(5).ShouldNot(BeIdenticalTo(55))
- })
-
- It("should treat the same pointers to a slice as identical", func() {
- mySlice := []int{1, 2}
- Expect(&mySlice).Should(BeIdenticalTo(&mySlice))
- Expect(&mySlice).ShouldNot(BeIdenticalTo(&[]int{1, 2}))
- })
-
- It("should treat the same pointers to a map as identical", func() {
- myMap := map[string]string{"a": "b", "c": "d"}
- Expect(&myMap).Should(BeIdenticalTo(&myMap))
- Expect(myMap).ShouldNot(BeIdenticalTo(map[string]string{"a": "b", "c": "d"}))
- })
-
- It("should treat the same pointers to an error as identical", func() {
- myError := errors.New("foo")
- Expect(&myError).Should(BeIdenticalTo(&myError))
- Expect(errors.New("foo")).ShouldNot(BeIdenticalTo(errors.New("bar")))
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/be_nil_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/be_nil_matcher_test.go
deleted file mode 100644
index c35aa3d7c..000000000
--- a/vendor/github.com/onsi/gomega/matchers/be_nil_matcher_test.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-)
-
-var _ = Describe("BeNil", func() {
- It("should succeed when passed nil", func() {
- Expect(nil).Should(BeNil())
- })
-
- It("should succeed when passed a typed nil", func() {
- var a []int
- Expect(a).Should(BeNil())
- })
-
- It("should succeed when passing nil pointer", func() {
- var f *struct{}
- Expect(f).Should(BeNil())
- })
-
- It("should not succeed when not passed nil", func() {
- Expect(0).ShouldNot(BeNil())
- Expect(false).ShouldNot(BeNil())
- Expect("").ShouldNot(BeNil())
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher_test.go
deleted file mode 100644
index a32d2b8b1..000000000
--- a/vendor/github.com/onsi/gomega/matchers/be_numerically_matcher_test.go
+++ /dev/null
@@ -1,172 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("BeNumerically", func() {
- Context("when passed a number", func() {
- It("should support ==", func() {
- Expect(uint32(5)).Should(BeNumerically("==", 5))
- Expect(float64(5.0)).Should(BeNumerically("==", 5))
- Expect(int8(5)).Should(BeNumerically("==", 5))
- })
-
- It("should not have false positives", func() {
- Expect(5.1).ShouldNot(BeNumerically("==", 5))
- Expect(5).ShouldNot(BeNumerically("==", 5.1))
- })
-
- It("should support >", func() {
- Expect(uint32(5)).Should(BeNumerically(">", 4))
- Expect(float64(5.0)).Should(BeNumerically(">", 4.9))
- Expect(int8(5)).Should(BeNumerically(">", 4))
-
- Expect(uint32(5)).ShouldNot(BeNumerically(">", 5))
- Expect(float64(5.0)).ShouldNot(BeNumerically(">", 5.0))
- Expect(int8(5)).ShouldNot(BeNumerically(">", 5))
- })
-
- It("should support <", func() {
- Expect(uint32(5)).Should(BeNumerically("<", 6))
- Expect(float64(5.0)).Should(BeNumerically("<", 5.1))
- Expect(int8(5)).Should(BeNumerically("<", 6))
-
- Expect(uint32(5)).ShouldNot(BeNumerically("<", 5))
- Expect(float64(5.0)).ShouldNot(BeNumerically("<", 5.0))
- Expect(int8(5)).ShouldNot(BeNumerically("<", 5))
- })
-
- It("should support >=", func() {
- Expect(uint32(5)).Should(BeNumerically(">=", 4))
- Expect(float64(5.0)).Should(BeNumerically(">=", 4.9))
- Expect(int8(5)).Should(BeNumerically(">=", 4))
-
- Expect(uint32(5)).Should(BeNumerically(">=", 5))
- Expect(float64(5.0)).Should(BeNumerically(">=", 5.0))
- Expect(int8(5)).Should(BeNumerically(">=", 5))
-
- Expect(uint32(5)).ShouldNot(BeNumerically(">=", 6))
- Expect(float64(5.0)).ShouldNot(BeNumerically(">=", 5.1))
- Expect(int8(5)).ShouldNot(BeNumerically(">=", 6))
- })
-
- It("should support <=", func() {
- Expect(uint32(5)).Should(BeNumerically("<=", 6))
- Expect(float64(5.0)).Should(BeNumerically("<=", 5.1))
- Expect(int8(5)).Should(BeNumerically("<=", 6))
-
- Expect(uint32(5)).Should(BeNumerically("<=", 5))
- Expect(float64(5.0)).Should(BeNumerically("<=", 5.0))
- Expect(int8(5)).Should(BeNumerically("<=", 5))
-
- Expect(uint32(5)).ShouldNot(BeNumerically("<=", 4))
- Expect(float64(5.0)).ShouldNot(BeNumerically("<=", 4.9))
- Expect(int8(5)).Should(BeNumerically("<=", 5))
- })
-
- Context("when passed ~", func() {
- Context("when passed a float", func() {
- Context("and there is no precision parameter", func() {
- It("should default to 1e-8", func() {
- Expect(5.00000001).Should(BeNumerically("~", 5.00000002))
- Expect(5.00000001).ShouldNot(BeNumerically("~", 5.0000001))
- })
-
- It("should show failure message", func() {
- actual := BeNumerically("~", 4.98).FailureMessage(123)
- expected := "Expected\n <int>: 123\nto be ~\n <float64>: 4.98"
- Expect(actual).To(Equal(expected))
- })
-
- It("should show negated failure message", func() {
- actual := BeNumerically("~", 4.98).NegatedFailureMessage(123)
- expected := "Expected\n <int>: 123\nnot to be ~\n <float64>: 4.98"
- Expect(actual).To(Equal(expected))
- })
- })
-
- Context("and there is a precision parameter", func() {
- It("should use the precision parameter", func() {
- Expect(5.1).Should(BeNumerically("~", 5.19, 0.1))
- Expect(5.1).Should(BeNumerically("~", 5.01, 0.1))
- Expect(5.1).ShouldNot(BeNumerically("~", 5.22, 0.1))
- Expect(5.1).ShouldNot(BeNumerically("~", 4.98, 0.1))
- })
-
- It("should show precision in failure message", func() {
- actual := BeNumerically("~", 4.98, 0.1).FailureMessage(123)
- expected := "Expected\n <int>: 123\nto be within 0.1 of ~\n <float64>: 4.98"
- Expect(actual).To(Equal(expected))
- })
-
- It("should show precision in negated failure message", func() {
- actual := BeNumerically("~", 4.98, 0.1).NegatedFailureMessage(123)
- expected := "Expected\n <int>: 123\nnot to be within 0.1 of ~\n <float64>: 4.98"
- Expect(actual).To(Equal(expected))
- })
- })
- })
-
- Context("when passed an int/uint", func() {
- Context("and there is no precision parameter", func() {
- It("should just do strict equality", func() {
- Expect(5).Should(BeNumerically("~", 5))
- Expect(5).ShouldNot(BeNumerically("~", 6))
- Expect(uint(5)).ShouldNot(BeNumerically("~", 6))
- })
- })
-
- Context("and there is a precision parameter", func() {
- It("should use precision paramter", func() {
- Expect(5).Should(BeNumerically("~", 6, 2))
- Expect(5).ShouldNot(BeNumerically("~", 8, 2))
- Expect(uint(5)).Should(BeNumerically("~", 6, 1))
- })
- })
- })
- })
- })
-
- Context("when passed a non-number", func() {
- It("should error", func() {
- success, err := (&BeNumericallyMatcher{Comparator: "==", CompareTo: []interface{}{5}}).Match("foo")
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- success, err = (&BeNumericallyMatcher{Comparator: "=="}).Match(5)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- success, err = (&BeNumericallyMatcher{Comparator: "~", CompareTo: []interface{}{3.0, "foo"}}).Match(5.0)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- success, err = (&BeNumericallyMatcher{Comparator: "==", CompareTo: []interface{}{"bar"}}).Match(5)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- success, err = (&BeNumericallyMatcher{Comparator: "==", CompareTo: []interface{}{"bar"}}).Match("foo")
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- success, err = (&BeNumericallyMatcher{Comparator: "==", CompareTo: []interface{}{nil}}).Match(0)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- success, err = (&BeNumericallyMatcher{Comparator: "==", CompareTo: []interface{}{0}}).Match(nil)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-
- Context("when passed an unsupported comparator", func() {
- It("should error", func() {
- success, err := (&BeNumericallyMatcher{Comparator: "!=", CompareTo: []interface{}{5}}).Match(4)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/be_sent_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/be_sent_matcher_test.go
deleted file mode 100644
index 68ec72879..000000000
--- a/vendor/github.com/onsi/gomega/matchers/be_sent_matcher_test.go
+++ /dev/null
@@ -1,107 +0,0 @@
-package matchers_test
-
-import (
- "time"
-
- . "github.com/onsi/gomega/matchers"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-)
-
-var _ = Describe("BeSent", func() {
- Context("when passed a channel and a matching type", func() {
- Context("when the channel is ready to receive", func() {
- It("should succeed and send the value down the channel", func() {
- c := make(chan string)
- d := make(chan string)
- go func() {
- val := <-c
- d <- val
- }()
-
- time.Sleep(10 * time.Millisecond)
-
- Expect(c).Should(BeSent("foo"))
- Eventually(d).Should(Receive(Equal("foo")))
- })
-
- It("should succeed (with a buffered channel)", func() {
- c := make(chan string, 1)
- Expect(c).Should(BeSent("foo"))
- Expect(<-c).Should(Equal("foo"))
- })
- })
-
- Context("when the channel is not ready to receive", func() {
- It("should fail and not send down the channel", func() {
- c := make(chan string)
- Expect(c).ShouldNot(BeSent("foo"))
- Consistently(c).ShouldNot(Receive())
- })
- })
-
- Context("when the channel is eventually ready to receive", func() {
- It("should succeed", func() {
- c := make(chan string)
- d := make(chan string)
- go func() {
- time.Sleep(30 * time.Millisecond)
- val := <-c
- d <- val
- }()
-
- Eventually(c).Should(BeSent("foo"))
- Eventually(d).Should(Receive(Equal("foo")))
- })
- })
-
- Context("when the channel is closed", func() {
- It("should error", func() {
- c := make(chan string)
- close(c)
- success, err := (&BeSentMatcher{Arg: "foo"}).Match(c)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
-
- It("should short-circuit Eventually", func() {
- c := make(chan string)
- close(c)
-
- t := time.Now()
- failures := InterceptGomegaFailures(func() {
- Eventually(c, 10.0).Should(BeSent("foo"))
- })
- Expect(failures).Should(HaveLen(1))
- Expect(time.Since(t)).Should(BeNumerically("<", time.Second))
- })
- })
- })
-
- Context("when passed a channel and a non-matching type", func() {
- It("should error", func() {
- success, err := (&BeSentMatcher{Arg: "foo"}).Match(make(chan int, 1))
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-
- Context("when passed a receive-only channel", func() {
- It("should error", func() {
- var c <-chan string
- c = make(chan string, 1)
- success, err := (&BeSentMatcher{Arg: "foo"}).Match(c)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-
- Context("when passed a nonchannel", func() {
- It("should error", func() {
- success, err := (&BeSentMatcher{Arg: "foo"}).Match("bar")
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/be_temporally_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/be_temporally_matcher_test.go
deleted file mode 100644
index 95a3a103e..000000000
--- a/vendor/github.com/onsi/gomega/matchers/be_temporally_matcher_test.go
+++ /dev/null
@@ -1,99 +0,0 @@
-package matchers_test
-
-import (
- "time"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("BeTemporally", func() {
-
- var t0, t1, t2 time.Time
- BeforeEach(func() {
- t0 = time.Now()
- t1 = t0.Add(time.Second)
- t2 = t0.Add(-time.Second)
- })
-
- Context("When comparing times", func() {
-
- It("should support ==", func() {
- Expect(t0).Should(BeTemporally("==", t0))
- Expect(t1).ShouldNot(BeTemporally("==", t0))
- Expect(t0).ShouldNot(BeTemporally("==", t1))
- Expect(t0).ShouldNot(BeTemporally("==", time.Time{}))
- })
-
- It("should support >", func() {
- Expect(t0).Should(BeTemporally(">", t2))
- Expect(t0).ShouldNot(BeTemporally(">", t0))
- Expect(t2).ShouldNot(BeTemporally(">", t0))
- })
-
- It("should support <", func() {
- Expect(t0).Should(BeTemporally("<", t1))
- Expect(t0).ShouldNot(BeTemporally("<", t0))
- Expect(t1).ShouldNot(BeTemporally("<", t0))
- })
-
- It("should support >=", func() {
- Expect(t0).Should(BeTemporally(">=", t2))
- Expect(t0).Should(BeTemporally(">=", t0))
- Expect(t0).ShouldNot(BeTemporally(">=", t1))
- })
-
- It("should support <=", func() {
- Expect(t0).Should(BeTemporally("<=", t1))
- Expect(t0).Should(BeTemporally("<=", t0))
- Expect(t0).ShouldNot(BeTemporally("<=", t2))
- })
-
- Context("when passed ~", func() {
- Context("and there is no precision parameter", func() {
- BeforeEach(func() {
- t1 = t0.Add(time.Millisecond / 2)
- t2 = t0.Add(-2 * time.Millisecond)
- })
- It("should approximate", func() {
- Expect(t0).Should(BeTemporally("~", t0))
- Expect(t0).Should(BeTemporally("~", t1))
- Expect(t0).ShouldNot(BeTemporally("~", t2))
- })
- })
-
- Context("and there is a precision parameter", func() {
- BeforeEach(func() {
- t2 = t0.Add(3 * time.Second)
- })
- It("should use precision paramter", func() {
- d := 2 * time.Second
- Expect(t0).Should(BeTemporally("~", t0, d))
- Expect(t0).Should(BeTemporally("~", t1, d))
- Expect(t0).ShouldNot(BeTemporally("~", t2, d))
- })
- })
- })
- })
-
- Context("when passed a non-time", func() {
- It("should error", func() {
- success, err := (&BeTemporallyMatcher{Comparator: "==", CompareTo: t0}).Match("foo")
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- success, err = (&BeTemporallyMatcher{Comparator: "=="}).Match(nil)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-
- Context("when passed an unsupported comparator", func() {
- It("should error", func() {
- success, err := (&BeTemporallyMatcher{Comparator: "!=", CompareTo: t0}).Match(t2)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/be_true_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/be_true_matcher_test.go
deleted file mode 100644
index 9eda62c33..000000000
--- a/vendor/github.com/onsi/gomega/matchers/be_true_matcher_test.go
+++ /dev/null
@@ -1,20 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("BeTrue", func() {
- It("should handle true and false correctly", func() {
- Expect(true).Should(BeTrue())
- Expect(false).ShouldNot(BeTrue())
- })
-
- It("should only support booleans", func() {
- success, err := (&BeTrueMatcher{}).Match("foo")
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/be_zero_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/be_zero_matcher_test.go
deleted file mode 100644
index c89e10330..000000000
--- a/vendor/github.com/onsi/gomega/matchers/be_zero_matcher_test.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-)
-
-var _ = Describe("BeZero", func() {
- It("succeeds for zero values for its type", func() {
- Expect(nil).Should(BeZero())
-
- Expect("").Should(BeZero())
- Expect(" ").ShouldNot(BeZero())
-
- Expect(0).Should(BeZero())
- Expect(1).ShouldNot(BeZero())
-
- Expect(0.0).Should(BeZero())
- Expect(0.1).ShouldNot(BeZero())
-
- // Expect([]int{}).Should(BeZero())
- Expect([]int{1}).ShouldNot(BeZero())
-
- // Expect(map[string]int{}).Should(BeZero())
- Expect(map[string]int{"a": 1}).ShouldNot(BeZero())
-
- Expect(myCustomType{}).Should(BeZero())
- Expect(myCustomType{s: "a"}).ShouldNot(BeZero())
- })
-
- It("builds failure message", func() {
- actual := BeZero().FailureMessage(123)
- Expect(actual).To(Equal("Expected\n <int>: 123\nto be zero-valued"))
- })
-
- It("builds negated failure message", func() {
- actual := BeZero().NegatedFailureMessage(123)
- Expect(actual).To(Equal("Expected\n <int>: 123\nnot to be zero-valued"))
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/consist_of_test.go b/vendor/github.com/onsi/gomega/matchers/consist_of_test.go
deleted file mode 100644
index f6971c4f5..000000000
--- a/vendor/github.com/onsi/gomega/matchers/consist_of_test.go
+++ /dev/null
@@ -1,75 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-)
-
-var _ = Describe("ConsistOf", func() {
- Context("with a slice", func() {
- It("should do the right thing", func() {
- Expect([]string{"foo", "bar", "baz"}).Should(ConsistOf("foo", "bar", "baz"))
- Expect([]string{"foo", "bar", "baz"}).Should(ConsistOf("foo", "bar", "baz"))
- Expect([]string{"foo", "bar", "baz"}).Should(ConsistOf("baz", "bar", "foo"))
- Expect([]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf("baz", "bar", "foo", "foo"))
- Expect([]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf("baz", "foo"))
- })
- })
-
- Context("with an array", func() {
- It("should do the right thing", func() {
- Expect([3]string{"foo", "bar", "baz"}).Should(ConsistOf("foo", "bar", "baz"))
- Expect([3]string{"foo", "bar", "baz"}).Should(ConsistOf("baz", "bar", "foo"))
- Expect([3]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf("baz", "bar", "foo", "foo"))
- Expect([3]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf("baz", "foo"))
- })
- })
-
- Context("with a map", func() {
- It("should apply to the values", func() {
- Expect(map[int]string{1: "foo", 2: "bar", 3: "baz"}).Should(ConsistOf("foo", "bar", "baz"))
- Expect(map[int]string{1: "foo", 2: "bar", 3: "baz"}).Should(ConsistOf("baz", "bar", "foo"))
- Expect(map[int]string{1: "foo", 2: "bar", 3: "baz"}).ShouldNot(ConsistOf("baz", "bar", "foo", "foo"))
- Expect(map[int]string{1: "foo", 2: "bar", 3: "baz"}).ShouldNot(ConsistOf("baz", "foo"))
- })
-
- })
-
- Context("with anything else", func() {
- It("should error", func() {
- failures := InterceptGomegaFailures(func() {
- Expect("foo").Should(ConsistOf("f", "o", "o"))
- })
-
- Expect(failures).Should(HaveLen(1))
- })
- })
-
- Context("when passed matchers", func() {
- It("should pass if the matchers pass", func() {
- Expect([]string{"foo", "bar", "baz"}).Should(ConsistOf("foo", MatchRegexp("^ba"), "baz"))
- Expect([]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf("foo", MatchRegexp("^ba")))
- Expect([]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf("foo", MatchRegexp("^ba"), MatchRegexp("foo")))
- Expect([]string{"foo", "bar", "baz"}).Should(ConsistOf("foo", MatchRegexp("^ba"), MatchRegexp("^ba")))
- Expect([]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf("foo", MatchRegexp("^ba"), MatchRegexp("turducken")))
- })
-
- It("should not depend on the order of the matchers", func() {
- Expect([][]int{{1, 2}, {2}}).Should(ConsistOf(ContainElement(1), ContainElement(2)))
- Expect([][]int{{1, 2}, {2}}).Should(ConsistOf(ContainElement(2), ContainElement(1)))
- })
-
- Context("when a matcher errors", func() {
- It("should soldier on", func() {
- Expect([]string{"foo", "bar", "baz"}).ShouldNot(ConsistOf(BeFalse(), "foo", "bar"))
- Expect([]interface{}{"foo", "bar", false}).Should(ConsistOf(BeFalse(), ContainSubstring("foo"), "bar"))
- })
- })
- })
-
- Context("when passed exactly one argument, and that argument is a slice", func() {
- It("should match against the elements of that argument", func() {
- Expect([]string{"foo", "bar", "baz"}).Should(ConsistOf([]string{"foo", "bar", "baz"}))
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/contain_element_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/contain_element_matcher_test.go
deleted file mode 100644
index 60fb55e96..000000000
--- a/vendor/github.com/onsi/gomega/matchers/contain_element_matcher_test.go
+++ /dev/null
@@ -1,76 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("ContainElement", func() {
- Context("when passed a supported type", func() {
- Context("and expecting a non-matcher", func() {
- It("should do the right thing", func() {
- Expect([2]int{1, 2}).Should(ContainElement(2))
- Expect([2]int{1, 2}).ShouldNot(ContainElement(3))
-
- Expect([]int{1, 2}).Should(ContainElement(2))
- Expect([]int{1, 2}).ShouldNot(ContainElement(3))
-
- Expect(map[string]int{"foo": 1, "bar": 2}).Should(ContainElement(2))
- Expect(map[int]int{3: 1, 4: 2}).ShouldNot(ContainElement(3))
-
- arr := make([]myCustomType, 2)
- arr[0] = myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}
- arr[1] = myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "c"}}
- Expect(arr).Should(ContainElement(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}))
- Expect(arr).ShouldNot(ContainElement(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"b", "c"}}))
- })
- })
-
- Context("and expecting a matcher", func() {
- It("should pass each element through the matcher", func() {
- Expect([]int{1, 2, 3}).Should(ContainElement(BeNumerically(">=", 3)))
- Expect([]int{1, 2, 3}).ShouldNot(ContainElement(BeNumerically(">", 3)))
- Expect(map[string]int{"foo": 1, "bar": 2}).Should(ContainElement(BeNumerically(">=", 2)))
- Expect(map[string]int{"foo": 1, "bar": 2}).ShouldNot(ContainElement(BeNumerically(">", 2)))
- })
-
- It("should power through even if the matcher ever fails", func() {
- Expect([]interface{}{1, 2, "3", 4}).Should(ContainElement(BeNumerically(">=", 3)))
- })
-
- It("should fail if the matcher fails", func() {
- actual := []interface{}{1, 2, "3", "4"}
- success, err := (&ContainElementMatcher{Element: BeNumerically(">=", 3)}).Match(actual)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
- })
-
- Context("when passed a correctly typed nil", func() {
- It("should operate succesfully on the passed in value", func() {
- var nilSlice []int
- Expect(nilSlice).ShouldNot(ContainElement(1))
-
- var nilMap map[int]string
- Expect(nilMap).ShouldNot(ContainElement("foo"))
- })
- })
-
- Context("when passed an unsupported type", func() {
- It("should error", func() {
- success, err := (&ContainElementMatcher{Element: 0}).Match(0)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- success, err = (&ContainElementMatcher{Element: 0}).Match("abc")
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- success, err = (&ContainElementMatcher{Element: 0}).Match(nil)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/contain_substring_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/contain_substring_matcher_test.go
deleted file mode 100644
index efffb4732..000000000
--- a/vendor/github.com/onsi/gomega/matchers/contain_substring_matcher_test.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("ContainSubstringMatcher", func() {
- Context("when actual is a string", func() {
- It("should match against the string", func() {
- Expect("Marvelous").Should(ContainSubstring("rve"))
- Expect("Marvelous").ShouldNot(ContainSubstring("boo"))
- })
- })
-
- Context("when the matcher is called with multiple arguments", func() {
- It("should pass the string and arguments to sprintf", func() {
- Expect("Marvelous3").Should(ContainSubstring("velous%d", 3))
- })
- })
-
- Context("when actual is a stringer", func() {
- It("should call the stringer and match agains the returned string", func() {
- Expect(&myStringer{a: "Abc3"}).Should(ContainSubstring("bc3"))
- })
- })
-
- Context("when actual is neither a string nor a stringer", func() {
- It("should error", func() {
- success, err := (&ContainSubstringMatcher{Substr: "2"}).Match(2)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/equal_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/equal_matcher_test.go
deleted file mode 100644
index 3ab991e4f..000000000
--- a/vendor/github.com/onsi/gomega/matchers/equal_matcher_test.go
+++ /dev/null
@@ -1,80 +0,0 @@
-package matchers_test
-
-import (
- "errors"
- "strings"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("Equal", func() {
- Context("when asserting that nil equals nil", func() {
- It("should error", func() {
- success, err := (&EqualMatcher{Expected: nil}).Match(nil)
-
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-
- Context("When asserting equality between objects", func() {
- It("should do the right thing", func() {
- Expect(5).Should(Equal(5))
- Expect(5.0).Should(Equal(5.0))
-
- Expect(5).ShouldNot(Equal("5"))
- Expect(5).ShouldNot(Equal(5.0))
- Expect(5).ShouldNot(Equal(3))
-
- Expect("5").Should(Equal("5"))
- Expect([]int{1, 2}).Should(Equal([]int{1, 2}))
- Expect([]int{1, 2}).ShouldNot(Equal([]int{2, 1}))
- Expect([]byte{'f', 'o', 'o'}).Should(Equal([]byte{'f', 'o', 'o'}))
- Expect([]byte{'f', 'o', 'o'}).ShouldNot(Equal([]byte{'b', 'a', 'r'}))
- Expect(map[string]string{"a": "b", "c": "d"}).Should(Equal(map[string]string{"a": "b", "c": "d"}))
- Expect(map[string]string{"a": "b", "c": "d"}).ShouldNot(Equal(map[string]string{"a": "b", "c": "e"}))
- Expect(errors.New("foo")).Should(Equal(errors.New("foo")))
- Expect(errors.New("foo")).ShouldNot(Equal(errors.New("bar")))
-
- Expect(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}).Should(Equal(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}))
- Expect(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}).ShouldNot(Equal(myCustomType{s: "bar", n: 3, f: 2.0, arr: []string{"a", "b"}}))
- Expect(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}).ShouldNot(Equal(myCustomType{s: "foo", n: 2, f: 2.0, arr: []string{"a", "b"}}))
- Expect(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}).ShouldNot(Equal(myCustomType{s: "foo", n: 3, f: 3.0, arr: []string{"a", "b"}}))
- Expect(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b"}}).ShouldNot(Equal(myCustomType{s: "foo", n: 3, f: 2.0, arr: []string{"a", "b", "c"}}))
- })
- })
-
- Describe("failure messages", func() {
- It("shows the two strings simply when they are short", func() {
- subject := EqualMatcher{Expected: "eric"}
-
- failureMessage := subject.FailureMessage("tim")
- Expect(failureMessage).To(BeEquivalentTo(expectedShortStringFailureMessage))
- })
-
- It("shows the exact point where two long strings differ", func() {
- stringWithB := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
- stringWithZ := "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
-
- subject := EqualMatcher{Expected: stringWithZ}
-
- failureMessage := subject.FailureMessage(stringWithB)
- Expect(failureMessage).To(BeEquivalentTo(expectedLongStringFailureMessage))
- })
- })
-})
-
-var expectedShortStringFailureMessage = strings.TrimSpace(`
-Expected
- <string>: tim
-to equal
- <string>: eric
-`)
-var expectedLongStringFailureMessage = strings.TrimSpace(`
-Expected
- <string>: "...aaaaabaaaaa..."
-to equal |
- <string>: "...aaaaazaaaaa..."
-`)
diff --git a/vendor/github.com/onsi/gomega/matchers/have_cap_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/have_cap_matcher_test.go
deleted file mode 100644
index 8a61f2e2c..000000000
--- a/vendor/github.com/onsi/gomega/matchers/have_cap_matcher_test.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("HaveCap", func() {
- Context("when passed a supported type", func() {
- It("should do the right thing", func() {
- Expect([0]int{}).Should(HaveCap(0))
- Expect([2]int{1}).Should(HaveCap(2))
-
- Expect([]int{}).Should(HaveCap(0))
- Expect([]int{1, 2, 3, 4, 5}[:2]).Should(HaveCap(5))
- Expect(make([]int, 0, 5)).Should(HaveCap(5))
-
- c := make(chan bool, 3)
- Expect(c).Should(HaveCap(3))
- c <- true
- c <- true
- Expect(c).Should(HaveCap(3))
-
- Expect(make(chan bool)).Should(HaveCap(0))
- })
- })
-
- Context("when passed a correctly typed nil", func() {
- It("should operate succesfully on the passed in value", func() {
- var nilSlice []int
- Expect(nilSlice).Should(HaveCap(0))
-
- var nilChan chan int
- Expect(nilChan).Should(HaveCap(0))
- })
- })
-
- Context("when passed an unsupported type", func() {
- It("should error", func() {
- success, err := (&HaveCapMatcher{Count: 0}).Match(0)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- success, err = (&HaveCapMatcher{Count: 0}).Match(nil)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/have_key_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/have_key_matcher_test.go
deleted file mode 100644
index 0f1561b7d..000000000
--- a/vendor/github.com/onsi/gomega/matchers/have_key_matcher_test.go
+++ /dev/null
@@ -1,73 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("HaveKey", func() {
- var (
- stringKeys map[string]int
- intKeys map[int]string
- objKeys map[*myCustomType]string
-
- customA *myCustomType
- customB *myCustomType
- )
- BeforeEach(func() {
- stringKeys = map[string]int{"foo": 2, "bar": 3}
- intKeys = map[int]string{2: "foo", 3: "bar"}
-
- customA = &myCustomType{s: "a", n: 2, f: 2.3, arr: []string{"ice", "cream"}}
- customB = &myCustomType{s: "b", n: 4, f: 3.1, arr: []string{"cake"}}
- objKeys = map[*myCustomType]string{customA: "aardvark", customB: "kangaroo"}
- })
-
- Context("when passed a map", func() {
- It("should do the right thing", func() {
- Expect(stringKeys).Should(HaveKey("foo"))
- Expect(stringKeys).ShouldNot(HaveKey("baz"))
-
- Expect(intKeys).Should(HaveKey(2))
- Expect(intKeys).ShouldNot(HaveKey(4))
-
- Expect(objKeys).Should(HaveKey(customA))
- Expect(objKeys).Should(HaveKey(&myCustomType{s: "b", n: 4, f: 3.1, arr: []string{"cake"}}))
- Expect(objKeys).ShouldNot(HaveKey(&myCustomType{s: "b", n: 4, f: 3.1, arr: []string{"apple", "pie"}}))
- })
- })
-
- Context("when passed a correctly typed nil", func() {
- It("should operate succesfully on the passed in value", func() {
- var nilMap map[int]string
- Expect(nilMap).ShouldNot(HaveKey("foo"))
- })
- })
-
- Context("when the passed in key is actually a matcher", func() {
- It("should pass each element through the matcher", func() {
- Expect(stringKeys).Should(HaveKey(ContainSubstring("oo")))
- Expect(stringKeys).ShouldNot(HaveKey(ContainSubstring("foobar")))
- })
-
- It("should fail if the matcher ever fails", func() {
- actual := map[int]string{1: "a", 3: "b", 2: "c"}
- success, err := (&HaveKeyMatcher{Key: ContainSubstring("ar")}).Match(actual)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-
- Context("when passed something that is not a map", func() {
- It("should error", func() {
- success, err := (&HaveKeyMatcher{Key: "foo"}).Match([]string{"foo"})
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- success, err = (&HaveKeyMatcher{Key: "foo"}).Match(nil)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher_test.go
deleted file mode 100644
index 0a49ec993..000000000
--- a/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher_test.go
+++ /dev/null
@@ -1,82 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("HaveKeyWithValue", func() {
- var (
- stringKeys map[string]int
- intKeys map[int]string
- objKeys map[*myCustomType]*myCustomType
-
- customA *myCustomType
- customB *myCustomType
- )
- BeforeEach(func() {
- stringKeys = map[string]int{"foo": 2, "bar": 3}
- intKeys = map[int]string{2: "foo", 3: "bar"}
-
- customA = &myCustomType{s: "a", n: 2, f: 2.3, arr: []string{"ice", "cream"}}
- customB = &myCustomType{s: "b", n: 4, f: 3.1, arr: []string{"cake"}}
- objKeys = map[*myCustomType]*myCustomType{customA: customA, customB: customA}
- })
-
- Context("when passed a map", func() {
- It("should do the right thing", func() {
- Expect(stringKeys).Should(HaveKeyWithValue("foo", 2))
- Expect(stringKeys).ShouldNot(HaveKeyWithValue("foo", 1))
- Expect(stringKeys).ShouldNot(HaveKeyWithValue("baz", 2))
- Expect(stringKeys).ShouldNot(HaveKeyWithValue("baz", 1))
-
- Expect(intKeys).Should(HaveKeyWithValue(2, "foo"))
- Expect(intKeys).ShouldNot(HaveKeyWithValue(4, "foo"))
- Expect(intKeys).ShouldNot(HaveKeyWithValue(2, "baz"))
-
- Expect(objKeys).Should(HaveKeyWithValue(customA, customA))
- Expect(objKeys).Should(HaveKeyWithValue(&myCustomType{s: "b", n: 4, f: 3.1, arr: []string{"cake"}}, &myCustomType{s: "a", n: 2, f: 2.3, arr: []string{"ice", "cream"}}))
- Expect(objKeys).ShouldNot(HaveKeyWithValue(&myCustomType{s: "b", n: 4, f: 3.1, arr: []string{"apple", "pie"}}, customA))
- })
- })
-
- Context("when passed a correctly typed nil", func() {
- It("should operate succesfully on the passed in value", func() {
- var nilMap map[int]string
- Expect(nilMap).ShouldNot(HaveKeyWithValue("foo", "bar"))
- })
- })
-
- Context("when the passed in key or value is actually a matcher", func() {
- It("should pass each element through the matcher", func() {
- Expect(stringKeys).Should(HaveKeyWithValue(ContainSubstring("oo"), 2))
- Expect(intKeys).Should(HaveKeyWithValue(2, ContainSubstring("oo")))
- Expect(stringKeys).ShouldNot(HaveKeyWithValue(ContainSubstring("foobar"), 2))
- })
-
- It("should fail if the matcher ever fails", func() {
- actual := map[int]string{1: "a", 3: "b", 2: "c"}
- success, err := (&HaveKeyWithValueMatcher{Key: ContainSubstring("ar"), Value: 2}).Match(actual)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- otherActual := map[string]int{"a": 1, "b": 2, "c": 3}
- success, err = (&HaveKeyWithValueMatcher{Key: "a", Value: ContainSubstring("1")}).Match(otherActual)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-
- Context("when passed something that is not a map", func() {
- It("should error", func() {
- success, err := (&HaveKeyWithValueMatcher{Key: "foo", Value: "bar"}).Match([]string{"foo"})
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- success, err = (&HaveKeyWithValueMatcher{Key: "foo", Value: "bar"}).Match(nil)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/have_len_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/have_len_matcher_test.go
deleted file mode 100644
index c60f63886..000000000
--- a/vendor/github.com/onsi/gomega/matchers/have_len_matcher_test.go
+++ /dev/null
@@ -1,53 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("HaveLen", func() {
- Context("when passed a supported type", func() {
- It("should do the right thing", func() {
- Expect("").Should(HaveLen(0))
- Expect("AA").Should(HaveLen(2))
-
- Expect([0]int{}).Should(HaveLen(0))
- Expect([2]int{1, 2}).Should(HaveLen(2))
-
- Expect([]int{}).Should(HaveLen(0))
- Expect([]int{1, 2, 3}).Should(HaveLen(3))
-
- Expect(map[string]int{}).Should(HaveLen(0))
- Expect(map[string]int{"a": 1, "b": 2, "c": 3, "d": 4}).Should(HaveLen(4))
-
- c := make(chan bool, 3)
- Expect(c).Should(HaveLen(0))
- c <- true
- c <- true
- Expect(c).Should(HaveLen(2))
- })
- })
-
- Context("when passed a correctly typed nil", func() {
- It("should operate succesfully on the passed in value", func() {
- var nilSlice []int
- Expect(nilSlice).Should(HaveLen(0))
-
- var nilMap map[int]string
- Expect(nilMap).Should(HaveLen(0))
- })
- })
-
- Context("when passed an unsupported type", func() {
- It("should error", func() {
- success, err := (&HaveLenMatcher{Count: 0}).Match(0)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- success, err = (&HaveLenMatcher{Count: 0}).Match(nil)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher_test.go
deleted file mode 100644
index 0ad632ec1..000000000
--- a/vendor/github.com/onsi/gomega/matchers/have_occurred_matcher_test.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package matchers_test
-
-import (
- "errors"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-type CustomErr struct {
- msg string
-}
-
-func (e *CustomErr) Error() string {
- return e.msg
-}
-
-var _ = Describe("HaveOccurred", func() {
- It("should succeed if matching an error", func() {
- Expect(errors.New("Foo")).Should(HaveOccurred())
- })
-
- It("should not succeed with nil", func() {
- Expect(nil).ShouldNot(HaveOccurred())
- })
-
- It("should only support errors and nil", func() {
- success, err := (&HaveOccurredMatcher{}).Match("foo")
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- success, err = (&HaveOccurredMatcher{}).Match("")
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
-
- It("doesn't support non-error type", func() {
- success, err := (&HaveOccurredMatcher{}).Match(AnyType{})
- Expect(success).Should(BeFalse())
- Expect(err).Should(MatchError("Expected an error-type. Got:\n <matchers_test.AnyType>: {}"))
- })
-
- It("doesn't support non-error pointer type", func() {
- success, err := (&HaveOccurredMatcher{}).Match(&AnyType{})
- Expect(success).Should(BeFalse())
- Expect(err).Should(MatchError(MatchRegexp(`Expected an error-type. Got:\n <*matchers_test.AnyType | 0x[[:xdigit:]]+>: {}`)))
- })
-
- It("should succeed with pointer types that conform to error interface", func() {
- err := &CustomErr{"ohai"}
- Expect(err).Should(HaveOccurred())
- })
-
- It("should not succeed with nil pointers to types that conform to error interface", func() {
- var err *CustomErr = nil
- Expect(err).ShouldNot(HaveOccurred())
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/have_prefix_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/have_prefix_matcher_test.go
deleted file mode 100644
index fe29b7b5d..000000000
--- a/vendor/github.com/onsi/gomega/matchers/have_prefix_matcher_test.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("HavePrefixMatcher", func() {
- Context("when actual is a string", func() {
- It("should match a string prefix", func() {
- Expect("Ab").Should(HavePrefix("A"))
- Expect("A").ShouldNot(HavePrefix("Ab"))
- })
- })
-
- Context("when the matcher is called with multiple arguments", func() {
- It("should pass the string and arguments to sprintf", func() {
- Expect("C3PO").Should(HavePrefix("C%dP", 3))
- })
- })
-
- Context("when actual is a stringer", func() {
- It("should call the stringer and match against the returned string", func() {
- Expect(&myStringer{a: "Ab"}).Should(HavePrefix("A"))
- })
- })
-
- Context("when actual is neither a string nor a stringer", func() {
- It("should error", func() {
- success, err := (&HavePrefixMatcher{Prefix: "2"}).Match(2)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/have_suffix_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/have_suffix_matcher_test.go
deleted file mode 100644
index 2ae29821a..000000000
--- a/vendor/github.com/onsi/gomega/matchers/have_suffix_matcher_test.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("HaveSuffixMatcher", func() {
- Context("when actual is a string", func() {
- It("should match a string suffix", func() {
- Expect("Ab").Should(HaveSuffix("b"))
- Expect("A").ShouldNot(HaveSuffix("Ab"))
- })
- })
-
- Context("when the matcher is called with multiple arguments", func() {
- It("should pass the string and arguments to sprintf", func() {
- Expect("C3PO").Should(HaveSuffix("%dPO", 3))
- })
- })
-
- Context("when actual is a stringer", func() {
- It("should call the stringer and match against the returned string", func() {
- Expect(&myStringer{a: "Ab"}).Should(HaveSuffix("b"))
- })
- })
-
- Context("when actual is neither a string nor a stringer", func() {
- It("should error", func() {
- success, err := (&HaveSuffixMatcher{Suffix: "2"}).Match(2)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/match_error_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/match_error_matcher_test.go
deleted file mode 100644
index 9bf89fc46..000000000
--- a/vendor/github.com/onsi/gomega/matchers/match_error_matcher_test.go
+++ /dev/null
@@ -1,107 +0,0 @@
-package matchers_test
-
-import (
- "errors"
- "fmt"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-type CustomError struct {
-}
-
-func (c CustomError) Error() string {
- return "an error"
-}
-
-var _ = Describe("MatchErrorMatcher", func() {
- Context("When asserting against an error", func() {
- It("should succeed when matching with an error", func() {
- err := errors.New("an error")
- fmtErr := fmt.Errorf("an error")
- customErr := CustomError{}
-
- Expect(err).Should(MatchError(errors.New("an error")))
- Expect(err).ShouldNot(MatchError(errors.New("another error")))
-
- Expect(fmtErr).Should(MatchError(errors.New("an error")))
- Expect(customErr).Should(MatchError(CustomError{}))
- })
-
- It("should succeed when matching with a string", func() {
- err := errors.New("an error")
- fmtErr := fmt.Errorf("an error")
- customErr := CustomError{}
-
- Expect(err).Should(MatchError("an error"))
- Expect(err).ShouldNot(MatchError("another error"))
-
- Expect(fmtErr).Should(MatchError("an error"))
- Expect(customErr).Should(MatchError("an error"))
- })
-
- Context("when passed a matcher", func() {
- It("should pass if the matcher passes against the error string", func() {
- err := errors.New("error 123 abc")
-
- Expect(err).Should(MatchError(MatchRegexp(`\d{3}`)))
- })
-
- It("should fail if the matcher fails against the error string", func() {
- err := errors.New("no digits")
- Expect(err).ShouldNot(MatchError(MatchRegexp(`\d`)))
- })
- })
-
- It("should fail when passed anything else", func() {
- actualErr := errors.New("an error")
- _, err := (&MatchErrorMatcher{
- Expected: []byte("an error"),
- }).Match(actualErr)
- Expect(err).Should(HaveOccurred())
-
- _, err = (&MatchErrorMatcher{
- Expected: 3,
- }).Match(actualErr)
- Expect(err).Should(HaveOccurred())
- })
- })
-
- Context("when passed nil", func() {
- It("should fail", func() {
- _, err := (&MatchErrorMatcher{
- Expected: "an error",
- }).Match(nil)
- Expect(err).Should(HaveOccurred())
- })
- })
-
- Context("when passed a non-error", func() {
- It("should fail", func() {
- _, err := (&MatchErrorMatcher{
- Expected: "an error",
- }).Match("an error")
- Expect(err).Should(HaveOccurred())
-
- _, err = (&MatchErrorMatcher{
- Expected: "an error",
- }).Match(3)
- Expect(err).Should(HaveOccurred())
- })
- })
-
- Context("when passed an error that is also a string", func() {
- It("should use it as an error", func() {
- var e mockErr = "mockErr"
-
- // this fails if the matcher casts e to a string before comparison
- Expect(e).Should(MatchError(e))
- })
- })
-})
-
-type mockErr string
-
-func (m mockErr) Error() string { return string(m) }
diff --git a/vendor/github.com/onsi/gomega/matchers/match_json_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/match_json_matcher_test.go
deleted file mode 100644
index 4a1a9db20..000000000
--- a/vendor/github.com/onsi/gomega/matchers/match_json_matcher_test.go
+++ /dev/null
@@ -1,103 +0,0 @@
-package matchers_test
-
-import (
- "encoding/json"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("MatchJSONMatcher", func() {
- Context("When passed stringifiables", func() {
- It("should succeed if the JSON matches", func() {
- Expect("{}").Should(MatchJSON("{}"))
- Expect(`{"a":1}`).Should(MatchJSON(`{"a":1}`))
- Expect(`{
- "a":1
- }`).Should(MatchJSON(`{"a":1}`))
- Expect(`{"a":1, "b":2}`).Should(MatchJSON(`{"b":2, "a":1}`))
- Expect(`{"a":1}`).ShouldNot(MatchJSON(`{"b":2, "a":1}`))
-
- Expect(`{"a":"a", "b":"b"}`).ShouldNot(MatchJSON(`{"a":"a", "b":"b", "c":"c"}`))
- Expect(`{"a":"a", "b":"b", "c":"c"}`).ShouldNot(MatchJSON(`{"a":"a", "b":"b"}`))
-
- Expect(`{"a":null, "b":null}`).ShouldNot(MatchJSON(`{"c":"c", "d":"d"}`))
- Expect(`{"a":null, "b":null, "c":null}`).ShouldNot(MatchJSON(`{"a":null, "b":null, "d":null}`))
- })
-
- It("should work with byte arrays", func() {
- Expect([]byte("{}")).Should(MatchJSON([]byte("{}")))
- Expect("{}").Should(MatchJSON([]byte("{}")))
- Expect([]byte("{}")).Should(MatchJSON("{}"))
- })
-
- It("should work with json.RawMessage", func() {
- Expect([]byte(`{"a": 1}`)).Should(MatchJSON(json.RawMessage(`{"a": 1}`)))
- })
- })
-
- Context("when a key mismatch is found", func() {
- It("reports the first found mismatch", func() {
- subject := MatchJSONMatcher{JSONToMatch: `5`}
- actual := `7`
- subject.Match(actual)
-
- failureMessage := subject.FailureMessage(`7`)
- Expect(failureMessage).ToNot(ContainSubstring("first mismatched key"))
-
- subject = MatchJSONMatcher{JSONToMatch: `{"a": 1, "b.g": {"c": 2, "1": ["hello", "see ya"]}}`}
- actual = `{"a": 1, "b.g": {"c": 2, "1": ["hello", "goodbye"]}}`
- subject.Match(actual)
-
- failureMessage = subject.FailureMessage(actual)
- Expect(failureMessage).To(ContainSubstring(`first mismatched key: "b.g"."1"[1]`))
- })
- })
-
- Context("when the expected is not valid JSON", func() {
- It("should error and explain why", func() {
- success, err := (&MatchJSONMatcher{JSONToMatch: `{}`}).Match(`oops`)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- Expect(err.Error()).Should(ContainSubstring("Actual 'oops' should be valid JSON"))
- })
- })
-
- Context("when the actual is not valid JSON", func() {
- It("should error and explain why", func() {
- success, err := (&MatchJSONMatcher{JSONToMatch: `oops`}).Match(`{}`)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- Expect(err.Error()).Should(ContainSubstring("Expected 'oops' should be valid JSON"))
- })
- })
-
- Context("when the expected is neither a string nor a stringer nor a byte array", func() {
- It("should error", func() {
- success, err := (&MatchJSONMatcher{JSONToMatch: 2}).Match("{}")
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- Expect(err.Error()).Should(ContainSubstring("MatchJSONMatcher matcher requires a string, stringer, or []byte. Got expected:\n <int>: 2"))
-
- success, err = (&MatchJSONMatcher{JSONToMatch: nil}).Match("{}")
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- Expect(err.Error()).Should(ContainSubstring("MatchJSONMatcher matcher requires a string, stringer, or []byte. Got expected:\n <nil>: nil"))
- })
- })
-
- Context("when the actual is neither a string nor a stringer nor a byte array", func() {
- It("should error", func() {
- success, err := (&MatchJSONMatcher{JSONToMatch: "{}"}).Match(2)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- Expect(err.Error()).Should(ContainSubstring("MatchJSONMatcher matcher requires a string, stringer, or []byte. Got actual:\n <int>: 2"))
-
- success, err = (&MatchJSONMatcher{JSONToMatch: "{}"}).Match(nil)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- Expect(err.Error()).Should(ContainSubstring("MatchJSONMatcher matcher requires a string, stringer, or []byte. Got actual:\n <nil>: nil"))
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/match_regexp_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/match_regexp_matcher_test.go
deleted file mode 100644
index ac2538bb4..000000000
--- a/vendor/github.com/onsi/gomega/matchers/match_regexp_matcher_test.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("MatchRegexp", func() {
- Context("when actual is a string", func() {
- It("should match against the string", func() {
- Expect(" a2!bla").Should(MatchRegexp(`\d!`))
- Expect(" a2!bla").ShouldNot(MatchRegexp(`[A-Z]`))
- })
- })
-
- Context("when actual is a stringer", func() {
- It("should call the stringer and match agains the returned string", func() {
- Expect(&myStringer{a: "Abc3"}).Should(MatchRegexp(`[A-Z][a-z]+\d`))
- })
- })
-
- Context("when the matcher is called with multiple arguments", func() {
- It("should pass the string and arguments to sprintf", func() {
- Expect(" a23!bla").Should(MatchRegexp(`\d%d!`, 3))
- })
- })
-
- Context("when actual is neither a string nor a stringer", func() {
- It("should error", func() {
- success, err := (&MatchRegexpMatcher{Regexp: `\d`}).Match(2)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-
- Context("when the passed in regexp fails to compile", func() {
- It("should error", func() {
- success, err := (&MatchRegexpMatcher{Regexp: "("}).Match("Foo")
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/match_xml_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/match_xml_matcher_test.go
deleted file mode 100644
index 0b559b22e..000000000
--- a/vendor/github.com/onsi/gomega/matchers/match_xml_matcher_test.go
+++ /dev/null
@@ -1,97 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("MatchXMLMatcher", func() {
-
- var (
- sample_01 = readFileContents("test_data/xml/sample_01.xml")
- sample_02 = readFileContents("test_data/xml/sample_02.xml")
- sample_03 = readFileContents("test_data/xml/sample_03.xml")
- sample_04 = readFileContents("test_data/xml/sample_04.xml")
- sample_05 = readFileContents("test_data/xml/sample_05.xml")
- sample_06 = readFileContents("test_data/xml/sample_06.xml")
- sample_07 = readFileContents("test_data/xml/sample_07.xml")
- sample_08 = readFileContents("test_data/xml/sample_08.xml")
- sample_09 = readFileContents("test_data/xml/sample_09.xml")
- sample_10 = readFileContents("test_data/xml/sample_10.xml")
- sample_11 = readFileContents("test_data/xml/sample_11.xml")
- )
-
- Context("When passed stringifiables", func() {
- It("matches documents regardless of the attribute order", func() {
- a := `<a foo="bar" ka="boom"></a>`
- b := `<a ka="boom" foo="bar"></a>`
- Expect(b).Should(MatchXML(a))
- Expect(a).Should(MatchXML(b))
- })
-
- It("should succeed if the XML matches", func() {
- Expect(sample_01).Should(MatchXML(sample_01)) // same XML
- Expect(sample_01).Should(MatchXML(sample_02)) // same XML with blank lines
- Expect(sample_01).Should(MatchXML(sample_03)) // same XML with different formatting
- Expect(sample_01).ShouldNot(MatchXML(sample_04)) // same structures with different values
- Expect(sample_01).ShouldNot(MatchXML(sample_05)) // different structures
- Expect(sample_06).ShouldNot(MatchXML(sample_07)) // same xml names with different namespaces
- Expect(sample_07).ShouldNot(MatchXML(sample_08)) // same structures with different values
- Expect(sample_09).ShouldNot(MatchXML(sample_10)) // same structures with different attribute values
- Expect(sample_11).Should(MatchXML(sample_11)) // with non UTF-8 encoding
- })
-
- It("should work with byte arrays", func() {
- Expect([]byte(sample_01)).Should(MatchXML([]byte(sample_01)))
- Expect([]byte(sample_01)).Should(MatchXML(sample_01))
- Expect(sample_01).Should(MatchXML([]byte(sample_01)))
- })
- })
-
- Context("when the expected is not valid XML", func() {
- It("should error and explain why", func() {
- success, err := (&MatchXMLMatcher{XMLToMatch: sample_01}).Match(`oops`)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- Expect(err.Error()).Should(ContainSubstring("Actual 'oops' should be valid XML"))
- })
- })
-
- Context("when the actual is not valid XML", func() {
- It("should error and explain why", func() {
- success, err := (&MatchXMLMatcher{XMLToMatch: `oops`}).Match(sample_01)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- Expect(err.Error()).Should(ContainSubstring("Expected 'oops' should be valid XML"))
- })
- })
-
- Context("when the expected is neither a string nor a stringer nor a byte array", func() {
- It("should error", func() {
- success, err := (&MatchXMLMatcher{XMLToMatch: 2}).Match(sample_01)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- Expect(err.Error()).Should(ContainSubstring("MatchXMLMatcher matcher requires a string, stringer, or []byte. Got expected:\n <int>: 2"))
-
- success, err = (&MatchXMLMatcher{XMLToMatch: nil}).Match(sample_01)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- Expect(err.Error()).Should(ContainSubstring("MatchXMLMatcher matcher requires a string, stringer, or []byte. Got expected:\n <nil>: nil"))
- })
- })
-
- Context("when the actual is neither a string nor a stringer nor a byte array", func() {
- It("should error", func() {
- success, err := (&MatchXMLMatcher{XMLToMatch: sample_01}).Match(2)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- Expect(err.Error()).Should(ContainSubstring("MatchXMLMatcher matcher requires a string, stringer, or []byte. Got actual:\n <int>: 2"))
-
- success, err = (&MatchXMLMatcher{XMLToMatch: sample_01}).Match(nil)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- Expect(err.Error()).Should(ContainSubstring("MatchXMLMatcher matcher requires a string, stringer, or []byte. Got actual:\n <nil>: nil"))
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher_test.go
deleted file mode 100644
index 1b0044fd0..000000000
--- a/vendor/github.com/onsi/gomega/matchers/match_yaml_matcher_test.go
+++ /dev/null
@@ -1,101 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("MatchYAMLMatcher", func() {
- Context("When passed stringifiables", func() {
- It("should succeed if the YAML matches", func() {
- Expect("---").Should(MatchYAML(""))
- Expect("a: 1").Should(MatchYAML(`{"a":1}`))
- Expect("a: 1\nb: 2").Should(MatchYAML(`{"b":2, "a":1}`))
- })
-
- It("should explain if the YAML does not match when it should", func() {
- message := (&MatchYAMLMatcher{YAMLToMatch: "a: 1"}).FailureMessage("b: 2")
- Expect(message).To(MatchRegexp(`Expected\s+<string>: b: 2\s+to match YAML of\s+<string>: a: 1`))
- })
-
- It("should normalise the expected and actual when explaining if the YAML does not match when it should", func() {
- message := (&MatchYAMLMatcher{YAMLToMatch: "a: 'one'"}).FailureMessage("{b: two}")
- Expect(message).To(MatchRegexp(`Expected\s+<string>: b: two\s+to match YAML of\s+<string>: a: one`))
- })
-
- It("should explain if the YAML matches when it should not", func() {
- message := (&MatchYAMLMatcher{YAMLToMatch: "a: 1"}).NegatedFailureMessage("a: 1")
- Expect(message).To(MatchRegexp(`Expected\s+<string>: a: 1\s+not to match YAML of\s+<string>: a: 1`))
- })
-
- It("should normalise the expected and actual when explaining if the YAML matches when it should not", func() {
- message := (&MatchYAMLMatcher{YAMLToMatch: "a: 'one'"}).NegatedFailureMessage("{a: one}")
- Expect(message).To(MatchRegexp(`Expected\s+<string>: a: one\s+not to match YAML of\s+<string>: a: one`))
- })
-
- It("should fail if the YAML does not match", func() {
- Expect("a: 1").ShouldNot(MatchYAML(`{"b":2, "a":1}`))
- })
-
- It("should work with byte arrays", func() {
- Expect([]byte("a: 1")).Should(MatchYAML([]byte("a: 1")))
- Expect("a: 1").Should(MatchYAML([]byte("a: 1")))
- Expect([]byte("a: 1")).Should(MatchYAML("a: 1"))
- })
- })
-
- Context("when the expected is not valid YAML", func() {
- It("should error and explain why", func() {
- success, err := (&MatchYAMLMatcher{YAMLToMatch: ""}).Match("good:\nbad")
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- Expect(err.Error()).Should(ContainSubstring("Actual 'good:\nbad' should be valid YAML"))
- })
- })
-
- Context("when the actual is not valid YAML", func() {
- It("should error and explain why", func() {
- success, err := (&MatchYAMLMatcher{YAMLToMatch: "good:\nbad"}).Match("")
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- Expect(err.Error()).Should(ContainSubstring("Expected 'good:\nbad' should be valid YAML"))
- })
-
- It("errors when passed directly to Message", func() {
- Expect(func() {
- matcher := MatchYAMLMatcher{YAMLToMatch: "good"}
- matcher.FailureMessage("good:\nbad")
- }).To(Panic())
- })
- })
-
- Context("when the expected is neither a string nor a stringer nor a byte array", func() {
- It("should error", func() {
- success, err := (&MatchYAMLMatcher{YAMLToMatch: 2}).Match("")
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- Expect(err.Error()).Should(ContainSubstring("MatchYAMLMatcher matcher requires a string, stringer, or []byte. Got expected:\n <int>: 2"))
-
- success, err = (&MatchYAMLMatcher{YAMLToMatch: nil}).Match("")
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- Expect(err.Error()).Should(ContainSubstring("MatchYAMLMatcher matcher requires a string, stringer, or []byte. Got expected:\n <nil>: nil"))
- })
- })
-
- Context("when the actual is neither a string nor a stringer nor a byte array", func() {
- It("should error", func() {
- success, err := (&MatchYAMLMatcher{YAMLToMatch: ""}).Match(2)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- Expect(err.Error()).Should(ContainSubstring("MatchYAMLMatcher matcher requires a string, stringer, or []byte. Got actual:\n <int>: 2"))
-
- success, err = (&MatchYAMLMatcher{YAMLToMatch: ""}).Match(nil)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- Expect(err.Error()).Should(ContainSubstring("MatchYAMLMatcher matcher requires a string, stringer, or []byte. Got actual:\n <nil>: nil"))
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/matcher_tests_suite_test.go b/vendor/github.com/onsi/gomega/matchers/matcher_tests_suite_test.go
deleted file mode 100644
index b5f76c995..000000000
--- a/vendor/github.com/onsi/gomega/matchers/matcher_tests_suite_test.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package matchers_test
-
-import (
- "fmt"
- "io/ioutil"
- "os"
- "testing"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-)
-
-type myStringer struct {
- a string
-}
-
-func (s *myStringer) String() string {
- return s.a
-}
-
-type StringAlias string
-
-type myCustomType struct {
- s string
- n int
- f float32
- arr []string
-}
-
-func Test(t *testing.T) {
- RegisterFailHandler(Fail)
- RunSpecs(t, "Gomega Matchers")
-}
-
-func readFileContents(filePath string) []byte {
- f := openFile(filePath)
- b, err := ioutil.ReadAll(f)
- if err != nil {
- panic(fmt.Errorf("failed to read file contents: %v", err))
- }
- return b
-}
-
-func openFile(filePath string) *os.File {
- f, err := os.Open(filePath)
- if err != nil {
- panic(fmt.Errorf("failed to open file: %v", err))
- }
- return f
-}
diff --git a/vendor/github.com/onsi/gomega/matchers/not_test.go b/vendor/github.com/onsi/gomega/matchers/not_test.go
deleted file mode 100644
index 06d3ebd17..000000000
--- a/vendor/github.com/onsi/gomega/matchers/not_test.go
+++ /dev/null
@@ -1,64 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("NotMatcher", func() {
- Context("basic examples", func() {
- It("works", func() {
- Expect(input).To(Not(false1))
- Expect(input).To(Not(Not(true2)))
- Expect(input).ToNot(Not(true3))
- Expect(input).ToNot(Not(Not(false1)))
- Expect(input).To(Not(Not(Not(false2))))
- })
-
- It("fails on error", func() {
- failuresMessages := InterceptGomegaFailures(func() {
- Expect(input).To(Not(Panic()))
- })
- Expect(failuresMessages).To(Equal([]string{"PanicMatcher expects a function. Got:\n <string>: hi"}))
- })
- })
-
- Context("De Morgan's laws", func() {
- It("~(A && B) == ~A || ~B", func() {
- Expect(input).To(Not(And(false1, false2)))
- Expect(input).To(Or(Not(false1), Not(false2)))
- })
- It("~(A || B) == ~A && ~B", func() {
- Expect(input).To(Not(Or(false1, false2)))
- Expect(input).To(And(Not(false1), Not(false2)))
- })
- })
-
- Context("failure messages are opposite of original matchers' failure messages", func() {
- Context("when match fails", func() {
- It("gives a descriptive message", func() {
- verifyFailureMessage(Not(HaveLen(2)), input, "not to have length 2")
- })
- })
-
- Context("when match succeeds, but expected it to fail", func() {
- It("gives a descriptive message", func() {
- verifyFailureMessage(Not(Not(HaveLen(3))), input, "to have length 3")
- })
- })
- })
-
- Context("MatchMayChangeInTheFuture()", func() {
- It("Propagates value from wrapped matcher", func() {
- m := Not(Or()) // an empty Or() always returns false, and indicates it cannot change
- Expect(m.Match("anything")).To(BeTrue())
- Expect(m.(*NotMatcher).MatchMayChangeInTheFuture("anything")).To(BeFalse())
- })
- It("Defaults to true", func() {
- m := Not(Equal(1)) // Equal does not have this method
- Expect(m.Match(2)).To(BeTrue())
- Expect(m.(*NotMatcher).MatchMayChangeInTheFuture(2)).To(BeTrue()) // defaults to true
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/or_test.go b/vendor/github.com/onsi/gomega/matchers/or_test.go
deleted file mode 100644
index 1f6dfaf61..000000000
--- a/vendor/github.com/onsi/gomega/matchers/or_test.go
+++ /dev/null
@@ -1,92 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("OrMatcher", func() {
- It("works with positive cases", func() {
- Expect(input).To(Or(true1))
- Expect(input).To(Or(true1, true2))
- Expect(input).To(Or(true1, false1))
- Expect(input).To(Or(false1, true2))
- Expect(input).To(Or(true1, true2, true3))
- Expect(input).To(Or(true1, true2, false3))
- Expect(input).To(Or(true1, false2, true3))
- Expect(input).To(Or(false1, true2, true3))
- Expect(input).To(Or(true1, false2, false3))
- Expect(input).To(Or(false1, false2, true3))
-
- // use alias
- Expect(input).To(SatisfyAny(false1, false2, true3))
- })
-
- It("stops on errors", func() {
- failuresMessages := InterceptGomegaFailures(func() {
- Expect(input).To(Or(Panic(), true1))
- })
- Expect(failuresMessages).To(Equal([]string{"PanicMatcher expects a function. Got:\n <string>: hi"}))
- })
-
- It("works with negative cases", func() {
- Expect(input).ToNot(Or())
- Expect(input).ToNot(Or(false1))
- Expect(input).ToNot(Or(false1, false2))
- Expect(input).ToNot(Or(false1, false2, false3))
- })
-
- Context("failure messages", func() {
- Context("when match fails", func() {
- It("gives a descriptive message", func() {
- verifyFailureMessage(Or(false1, false2), input,
- "To satisfy at least one of these matchers: [%!s(*matchers.HaveLenMatcher=&{1}) %!s(*matchers.EqualMatcher=&{hip})]")
- })
- })
-
- Context("when match succeeds, but expected it to fail", func() {
- It("gives a descriptive message", func() {
- verifyFailureMessage(Not(Or(true1, true2)), input, `not to have length 2`)
- })
- })
- })
-
- Context("MatchMayChangeInTheFuture", func() {
- Context("Match returned false", func() {
- It("returns true if any of the matchers could change", func() {
- // 3 matchers, all return false, and all could change
- m := Or(BeNil(), Equal("hip"), HaveLen(1))
- Expect(m.Match("hi")).To(BeFalse())
- Expect(m.(*OrMatcher).MatchMayChangeInTheFuture("hi")).To(BeTrue()) // all 3 of these matchers default to 'true'
- })
- It("returns false if none of the matchers could change", func() {
- // empty Or() has the property of never matching, and never can change since there are no sub-matchers that could change
- m := Or()
- Expect(m.Match("anything")).To(BeFalse())
- Expect(m.(*OrMatcher).MatchMayChangeInTheFuture("anything")).To(BeFalse())
-
- // Or() with 3 sub-matchers that return false, and can't change
- m = Or(Or(), Or(), Or())
- Expect(m.Match("hi")).To(BeFalse())
- Expect(m.(*OrMatcher).MatchMayChangeInTheFuture("hi")).To(BeFalse()) // the 3 empty Or()'s won't change
- })
- })
- Context("Match returned true", func() {
- Context("returns value of the successful matcher", func() {
- It("false if successful matcher not going to change", func() {
- // 3 matchers: 1st returns false, 2nd returns true and is not going to change, 3rd is never called
- m := Or(BeNil(), And(), Equal(1))
- Expect(m.Match("hi")).To(BeTrue())
- Expect(m.(*OrMatcher).MatchMayChangeInTheFuture("hi")).To(BeFalse())
- })
- It("true if successful matcher indicates it might change", func() {
- // 3 matchers: 1st returns false, 2nd returns true and "might" change, 3rd is never called
- m := Or(Not(BeNil()), Equal("hi"), Equal(1))
- Expect(m.Match("hi")).To(BeTrue())
- Expect(m.(*OrMatcher).MatchMayChangeInTheFuture("hi")).To(BeTrue()) // Equal("hi") indicates it might change
- })
- })
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/panic_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/panic_matcher_test.go
deleted file mode 100644
index 326bb10a4..000000000
--- a/vendor/github.com/onsi/gomega/matchers/panic_matcher_test.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package matchers_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("Panic", func() {
- Context("when passed something that's not a function that takes zero arguments and returns nothing", func() {
- It("should error", func() {
- success, err := (&PanicMatcher{}).Match("foo")
- Expect(success).To(BeFalse())
- Expect(err).To(HaveOccurred())
-
- success, err = (&PanicMatcher{}).Match(nil)
- Expect(success).To(BeFalse())
- Expect(err).To(HaveOccurred())
-
- success, err = (&PanicMatcher{}).Match(func(foo string) {})
- Expect(success).To(BeFalse())
- Expect(err).To(HaveOccurred())
-
- success, err = (&PanicMatcher{}).Match(func() string { return "bar" })
- Expect(success).To(BeFalse())
- Expect(err).To(HaveOccurred())
- })
- })
-
- Context("when passed a function of the correct type", func() {
- It("should call the function and pass if the function panics", func() {
- Expect(func() { panic("ack!") }).To(Panic())
- Expect(func() {}).NotTo(Panic())
- })
- })
-
- Context("when assertion fails", func() {
- It("prints the object passed to Panic when negative", func() {
- failuresMessages := InterceptGomegaFailures(func() {
- Expect(func() { panic("ack!") }).NotTo(Panic())
- })
- Expect(failuresMessages).To(ConsistOf(ContainSubstring("not to panic, but panicked with\n <string>: ack!")))
- })
-
- It("prints simple message when positive", func() {
- failuresMessages := InterceptGomegaFailures(func() {
- Expect(func() {}).To(Panic())
- })
- Expect(failuresMessages).To(ConsistOf(MatchRegexp("Expected\n\\s+<func\\(\\)>: .+\nto panic")))
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/receive_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/receive_matcher_test.go
deleted file mode 100644
index cf04e85dd..000000000
--- a/vendor/github.com/onsi/gomega/matchers/receive_matcher_test.go
+++ /dev/null
@@ -1,304 +0,0 @@
-package matchers_test
-
-import (
- "time"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-type kungFuActor interface {
- DrunkenMaster() bool
-}
-
-type jackie struct {
- name string
-}
-
-func (j *jackie) DrunkenMaster() bool {
- return true
-}
-
-type someError struct{ s string }
-
-func (e *someError) Error() string { return e.s }
-
-var _ = Describe("ReceiveMatcher", func() {
- Context("with no argument", func() {
- Context("for a buffered channel", func() {
- It("should succeed", func() {
- channel := make(chan bool, 1)
-
- Expect(channel).ShouldNot(Receive())
-
- channel <- true
-
- Expect(channel).Should(Receive())
- })
- })
-
- Context("for an unbuffered channel", func() {
- It("should succeed (eventually)", func() {
- channel := make(chan bool)
-
- Expect(channel).ShouldNot(Receive())
-
- go func() {
- time.Sleep(10 * time.Millisecond)
- channel <- true
- }()
-
- Eventually(channel).Should(Receive())
- })
- })
- })
-
- Context("with a pointer argument", func() {
- Context("of the correct type", func() {
- Context("when the channel has an interface type", func() {
- It("should write the value received on the channel to the pointer", func() {
- channel := make(chan error, 1)
-
- var value *someError
-
- Ω(channel).ShouldNot(Receive(&value))
- Ω(value).Should(BeZero())
-
- channel <- &someError{"boooom!"}
-
- Ω(channel).Should(Receive(&value))
- Ω(value).Should(MatchError("boooom!"))
- })
- })
- })
-
- Context("of the correct type", func() {
- It("should write the value received on the channel to the pointer", func() {
- channel := make(chan int, 1)
-
- var value int
-
- Expect(channel).ShouldNot(Receive(&value))
- Expect(value).Should(BeZero())
-
- channel <- 17
-
- Expect(channel).Should(Receive(&value))
- Expect(value).Should(Equal(17))
- })
- })
-
- Context("to various types of objects", func() {
- It("should work", func() {
- //channels of strings
- stringChan := make(chan string, 1)
- stringChan <- "foo"
-
- var s string
- Expect(stringChan).Should(Receive(&s))
- Expect(s).Should(Equal("foo"))
-
- //channels of slices
- sliceChan := make(chan []bool, 1)
- sliceChan <- []bool{true, true, false}
-
- var sl []bool
- Expect(sliceChan).Should(Receive(&sl))
- Expect(sl).Should(Equal([]bool{true, true, false}))
-
- //channels of channels
- chanChan := make(chan chan bool, 1)
- c := make(chan bool)
- chanChan <- c
-
- var receivedC chan bool
- Expect(chanChan).Should(Receive(&receivedC))
- Expect(receivedC).Should(Equal(c))
-
- //channels of interfaces
- jackieChan := make(chan kungFuActor, 1)
- aJackie := &jackie{name: "Jackie Chan"}
- jackieChan <- aJackie
-
- var theJackie kungFuActor
- Expect(jackieChan).Should(Receive(&theJackie))
- Expect(theJackie).Should(Equal(aJackie))
- })
- })
-
- Context("of the wrong type", func() {
- It("should error", func() {
- channel := make(chan int, 1)
- channel <- 10
-
- var incorrectType bool
-
- success, err := (&ReceiveMatcher{Arg: &incorrectType}).Match(channel)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- var notAPointer int
- success, err = (&ReceiveMatcher{Arg: notAPointer}).Match(channel)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
- })
-
- Context("with a matcher", func() {
- It("should defer to the underlying matcher", func() {
- intChannel := make(chan int, 1)
- intChannel <- 3
- Expect(intChannel).Should(Receive(Equal(3)))
-
- intChannel <- 2
- Expect(intChannel).ShouldNot(Receive(Equal(3)))
-
- stringChannel := make(chan []string, 1)
- stringChannel <- []string{"foo", "bar", "baz"}
- Expect(stringChannel).Should(Receive(ContainElement(ContainSubstring("fo"))))
-
- stringChannel <- []string{"foo", "bar", "baz"}
- Expect(stringChannel).ShouldNot(Receive(ContainElement(ContainSubstring("archipelago"))))
- })
-
- It("should defer to the underlying matcher for the message", func() {
- matcher := Receive(Equal(3))
- channel := make(chan int, 1)
- channel <- 2
- matcher.Match(channel)
- Expect(matcher.FailureMessage(channel)).Should(MatchRegexp(`Expected\s+<int>: 2\s+to equal\s+<int>: 3`))
-
- channel <- 3
- matcher.Match(channel)
- Expect(matcher.NegatedFailureMessage(channel)).Should(MatchRegexp(`Expected\s+<int>: 3\s+not to equal\s+<int>: 3`))
- })
-
- It("should work just fine with Eventually", func() {
- stringChannel := make(chan string)
-
- go func() {
- time.Sleep(5 * time.Millisecond)
- stringChannel <- "A"
- time.Sleep(5 * time.Millisecond)
- stringChannel <- "B"
- }()
-
- Eventually(stringChannel).Should(Receive(Equal("B")))
- })
-
- Context("if the matcher errors", func() {
- It("should error", func() {
- channel := make(chan int, 1)
- channel <- 3
- success, err := (&ReceiveMatcher{Arg: ContainSubstring("three")}).Match(channel)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-
- Context("if nothing is received", func() {
- It("should fail", func() {
- channel := make(chan int, 1)
- success, err := (&ReceiveMatcher{Arg: Equal(1)}).Match(channel)
- Expect(success).Should(BeFalse())
- Expect(err).ShouldNot(HaveOccurred())
- })
- })
- })
-
- Context("When actual is a *closed* channel", func() {
- Context("for a buffered channel", func() {
- It("should work until it hits the end of the buffer", func() {
- channel := make(chan bool, 1)
- channel <- true
-
- close(channel)
-
- Expect(channel).Should(Receive())
- Expect(channel).ShouldNot(Receive())
- })
- })
-
- Context("for an unbuffered channel", func() {
- It("should always fail", func() {
- channel := make(chan bool)
- close(channel)
-
- Expect(channel).ShouldNot(Receive())
- })
- })
- })
-
- Context("When actual is a send-only channel", func() {
- It("should error", func() {
- channel := make(chan bool)
-
- var writerChannel chan<- bool
- writerChannel = channel
-
- success, err := (&ReceiveMatcher{}).Match(writerChannel)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-
- Context("when acutal is a non-channel", func() {
- It("should error", func() {
- var nilChannel chan bool
-
- success, err := (&ReceiveMatcher{}).Match(nilChannel)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- success, err = (&ReceiveMatcher{}).Match(nil)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
-
- success, err = (&ReceiveMatcher{}).Match(3)
- Expect(success).Should(BeFalse())
- Expect(err).Should(HaveOccurred())
- })
- })
-
- Describe("when used with eventually and a custom matcher", func() {
- It("should return the matcher's error when a failing value is received on the channel, instead of the must receive something failure", func() {
- failures := InterceptGomegaFailures(func() {
- c := make(chan string, 0)
- Eventually(c, 0.01).Should(Receive(Equal("hello")))
- })
- Expect(failures[0]).Should(ContainSubstring("When passed a matcher, ReceiveMatcher's channel *must* receive something."))
-
- failures = InterceptGomegaFailures(func() {
- c := make(chan string, 1)
- c <- "hi"
- Eventually(c, 0.01).Should(Receive(Equal("hello")))
- })
- Expect(failures[0]).Should(ContainSubstring("<string>: hello"))
- })
- })
-
- Describe("Bailing early", func() {
- It("should bail early when passed a closed channel", func() {
- c := make(chan bool)
- close(c)
-
- t := time.Now()
- failures := InterceptGomegaFailures(func() {
- Eventually(c).Should(Receive())
- })
- Expect(time.Since(t)).Should(BeNumerically("<", 500*time.Millisecond))
- Expect(failures).Should(HaveLen(1))
- })
-
- It("should bail early when passed a non-channel", func() {
- t := time.Now()
- failures := InterceptGomegaFailures(func() {
- Eventually(3).Should(Receive())
- })
- Expect(time.Since(t)).Should(BeNumerically("<", 500*time.Millisecond))
- Expect(failures).Should(HaveLen(1))
- })
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/succeed_matcher_test.go b/vendor/github.com/onsi/gomega/matchers/succeed_matcher_test.go
deleted file mode 100644
index e42dd8a6e..000000000
--- a/vendor/github.com/onsi/gomega/matchers/succeed_matcher_test.go
+++ /dev/null
@@ -1,72 +0,0 @@
-package matchers_test
-
-import (
- "errors"
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
- "regexp"
-)
-
-func Erroring() error {
- return errors.New("bam")
-}
-
-func NotErroring() error {
- return nil
-}
-
-type AnyType struct{}
-
-func Invalid() *AnyType {
- return nil
-}
-
-var _ = Describe("Succeed", func() {
- It("should succeed if the function succeeds", func() {
- Expect(NotErroring()).Should(Succeed())
- })
-
- It("should succeed (in the negated) if the function errored", func() {
- Expect(Erroring()).ShouldNot(Succeed())
- })
-
- It("should not if passed a non-error", func() {
- success, err := (&SucceedMatcher{}).Match(Invalid())
- Expect(success).Should(BeFalse())
- Expect(err).Should(MatchError("Expected an error-type. Got:\n <*matchers_test.AnyType | 0x0>: nil"))
- })
-
- It("doesn't support non-error type", func() {
- success, err := (&SucceedMatcher{}).Match(AnyType{})
- Expect(success).Should(BeFalse())
- Expect(err).Should(MatchError("Expected an error-type. Got:\n <matchers_test.AnyType>: {}"))
- })
-
- It("doesn't support non-error pointer type", func() {
- success, err := (&SucceedMatcher{}).Match(&AnyType{})
- Expect(success).Should(BeFalse())
- Expect(err).Should(MatchError(MatchRegexp(`Expected an error-type. Got:\n <*matchers_test.AnyType | 0x[[:xdigit:]]+>: {}`)))
- })
-
- It("should not succeed with pointer types that conform to error interface", func() {
- err := &CustomErr{"ohai"}
- Expect(err).ShouldNot(Succeed())
- })
-
- It("should succeed with nil pointers to types that conform to error interface", func() {
- var err *CustomErr = nil
- Expect(err).Should(Succeed())
- })
-
- It("builds failure message", func() {
- actual := Succeed().FailureMessage(errors.New("oops"))
- actual = regexp.MustCompile(" 0x.*>").ReplaceAllString(actual, " 0x00000000>")
- Expect(actual).To(Equal("Expected success, but got an error:\n <*errors.errorString | 0x00000000>: {s: \"oops\"}\n oops"))
- })
-
- It("builds negated failure message", func() {
- actual := Succeed().NegatedFailureMessage(123)
- Expect(actual).To(Equal("Expected failure, but got no error."))
- })
-})
diff --git a/vendor/github.com/onsi/gomega/matchers/support/goraph/MIT.LICENSE b/vendor/github.com/onsi/gomega/matchers/support/goraph/MIT.LICENSE
deleted file mode 100644
index 8edd8175a..000000000
--- a/vendor/github.com/onsi/gomega/matchers/support/goraph/MIT.LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) 2014 Amit Kumar Gupta
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_01.xml b/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_01.xml
deleted file mode 100644
index 90f0a1b45..000000000
--- a/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_01.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<note>
- <to>Tove</to>
- <from>Jani</from>
- <heading>Reminder</heading>
- <body>Don't forget me this weekend!</body>
-</note> \ No newline at end of file
diff --git a/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_02.xml b/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_02.xml
deleted file mode 100644
index 3863b83c3..000000000
--- a/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_02.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-<note>
- <to>Tove</to>
- <from>Jani</from>
- <heading>Reminder</heading>
- <body>Don't forget me this weekend!</body>
-</note>
-
diff --git a/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_03.xml b/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_03.xml
deleted file mode 100644
index a491c213c..000000000
--- a/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_03.xml
+++ /dev/null
@@ -1 +0,0 @@
-<note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>
diff --git a/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_04.xml b/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_04.xml
deleted file mode 100644
index dcfd3db03..000000000
--- a/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_04.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<note>
- <to>Tove</to>
- <from>John</from>
- <heading>Doe</heading>
- <body>Don't forget me this weekend!</body>
-</note> \ No newline at end of file
diff --git a/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_05.xml b/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_05.xml
deleted file mode 100644
index de15a6a55..000000000
--- a/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_05.xml
+++ /dev/null
@@ -1,211 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<CATALOG>
- <CD>
- <TITLE>Empire Burlesque</TITLE>
- <ARTIST>Bob Dylan</ARTIST>
- <COUNTRY>USA</COUNTRY>
- <COMPANY>Columbia</COMPANY>
- <PRICE>10.90</PRICE>
- <YEAR>1985</YEAR>
- </CD>
- <CD>
- <TITLE>Hide your heart</TITLE>
- <ARTIST>Bonnie Tyler</ARTIST>
- <COUNTRY>UK</COUNTRY>
- <COMPANY>CBS Records</COMPANY>
- <PRICE>9.90</PRICE>
- <YEAR>1988</YEAR>
- </CD>
- <CD>
- <TITLE>Greatest Hits</TITLE>
- <ARTIST>Dolly Parton</ARTIST>
- <COUNTRY>USA</COUNTRY>
- <COMPANY>RCA</COMPANY>
- <PRICE>9.90</PRICE>
- <YEAR>1982</YEAR>
- </CD>
- <CD>
- <TITLE>Still got the blues</TITLE>
- <ARTIST>Gary Moore</ARTIST>
- <COUNTRY>UK</COUNTRY>
- <COMPANY>Virgin records</COMPANY>
- <PRICE>10.20</PRICE>
- <YEAR>1990</YEAR>
- </CD>
- <CD>
- <TITLE>Eros</TITLE>
- <ARTIST>Eros Ramazzotti</ARTIST>
- <COUNTRY>EU</COUNTRY>
- <COMPANY>BMG</COMPANY>
- <PRICE>9.90</PRICE>
- <YEAR>1997</YEAR>
- </CD>
- <CD>
- <TITLE>One night only</TITLE>
- <ARTIST>Bee Gees</ARTIST>
- <COUNTRY>UK</COUNTRY>
- <COMPANY>Polydor</COMPANY>
- <PRICE>10.90</PRICE>
- <YEAR>1998</YEAR>
- </CD>
- <CD>
- <TITLE>Sylvias Mother</TITLE>
- <ARTIST>Dr.Hook</ARTIST>
- <COUNTRY>UK</COUNTRY>
- <COMPANY>CBS</COMPANY>
- <PRICE>8.10</PRICE>
- <YEAR>1973</YEAR>
- </CD>
- <CD>
- <TITLE>Maggie May</TITLE>
- <ARTIST>Rod Stewart</ARTIST>
- <COUNTRY>UK</COUNTRY>
- <COMPANY>Pickwick</COMPANY>
- <PRICE>8.50</PRICE>
- <YEAR>1990</YEAR>
- </CD>
- <CD>
- <TITLE>Romanza</TITLE>
- <ARTIST>Andrea Bocelli</ARTIST>
- <COUNTRY>EU</COUNTRY>
- <COMPANY>Polydor</COMPANY>
- <PRICE>10.80</PRICE>
- <YEAR>1996</YEAR>
- </CD>
- <CD>
- <TITLE>When a man loves a woman</TITLE>
- <ARTIST>Percy Sledge</ARTIST>
- <COUNTRY>USA</COUNTRY>
- <COMPANY>Atlantic</COMPANY>
- <PRICE>8.70</PRICE>
- <YEAR>1987</YEAR>
- </CD>
- <CD>
- <TITLE>Black angel</TITLE>
- <ARTIST>Savage Rose</ARTIST>
- <COUNTRY>EU</COUNTRY>
- <COMPANY>Mega</COMPANY>
- <PRICE>10.90</PRICE>
- <YEAR>1995</YEAR>
- </CD>
- <CD>
- <TITLE>1999 Grammy Nominees</TITLE>
- <ARTIST>Many</ARTIST>
- <COUNTRY>USA</COUNTRY>
- <COMPANY>Grammy</COMPANY>
- <PRICE>10.20</PRICE>
- <YEAR>1999</YEAR>
- </CD>
- <CD>
- <TITLE>For the good times</TITLE>
- <ARTIST>Kenny Rogers</ARTIST>
- <COUNTRY>UK</COUNTRY>
- <COMPANY>Mucik Master</COMPANY>
- <PRICE>8.70</PRICE>
- <YEAR>1995</YEAR>
- </CD>
- <CD>
- <TITLE>Big Willie style</TITLE>
- <ARTIST>Will Smith</ARTIST>
- <COUNTRY>USA</COUNTRY>
- <COMPANY>Columbia</COMPANY>
- <PRICE>9.90</PRICE>
- <YEAR>1997</YEAR>
- </CD>
- <CD>
- <TITLE>Tupelo Honey</TITLE>
- <ARTIST>Van Morrison</ARTIST>
- <COUNTRY>UK</COUNTRY>
- <COMPANY>Polydor</COMPANY>
- <PRICE>8.20</PRICE>
- <YEAR>1971</YEAR>
- </CD>
- <CD>
- <TITLE>Soulsville</TITLE>
- <ARTIST>Jorn Hoel</ARTIST>
- <COUNTRY>Norway</COUNTRY>
- <COMPANY>WEA</COMPANY>
- <PRICE>7.90</PRICE>
- <YEAR>1996</YEAR>
- </CD>
- <CD>
- <TITLE>The very best of</TITLE>
- <ARTIST>Cat Stevens</ARTIST>
- <COUNTRY>UK</COUNTRY>
- <COMPANY>Island</COMPANY>
- <PRICE>8.90</PRICE>
- <YEAR>1990</YEAR>
- </CD>
- <CD>
- <TITLE>Stop</TITLE>
- <ARTIST>Sam Brown</ARTIST>
- <COUNTRY>UK</COUNTRY>
- <COMPANY>A and M</COMPANY>
- <PRICE>8.90</PRICE>
- <YEAR>1988</YEAR>
- </CD>
- <CD>
- <TITLE>Bridge of Spies</TITLE>
- <ARTIST>T'Pau</ARTIST>
- <COUNTRY>UK</COUNTRY>
- <COMPANY>Siren</COMPANY>
- <PRICE>7.90</PRICE>
- <YEAR>1987</YEAR>
- </CD>
- <CD>
- <TITLE>Private Dancer</TITLE>
- <ARTIST>Tina Turner</ARTIST>
- <COUNTRY>UK</COUNTRY>
- <COMPANY>Capitol</COMPANY>
- <PRICE>8.90</PRICE>
- <YEAR>1983</YEAR>
- </CD>
- <CD>
- <TITLE>Midt om natten</TITLE>
- <ARTIST>Kim Larsen</ARTIST>
- <COUNTRY>EU</COUNTRY>
- <COMPANY>Medley</COMPANY>
- <PRICE>7.80</PRICE>
- <YEAR>1983</YEAR>
- </CD>
- <CD>
- <TITLE>Pavarotti Gala Concert</TITLE>
- <ARTIST>Luciano Pavarotti</ARTIST>
- <COUNTRY>UK</COUNTRY>
- <COMPANY>DECCA</COMPANY>
- <PRICE>9.90</PRICE>
- <YEAR>1991</YEAR>
- </CD>
- <CD>
- <TITLE>The dock of the bay</TITLE>
- <ARTIST>Otis Redding</ARTIST>
- <COUNTRY>USA</COUNTRY>
- <COMPANY>Stax Records</COMPANY>
- <PRICE>7.90</PRICE>
- <YEAR>1968</YEAR>
- </CD>
- <CD>
- <TITLE>Picture book</TITLE>
- <ARTIST>Simply Red</ARTIST>
- <COUNTRY>EU</COUNTRY>
- <COMPANY>Elektra</COMPANY>
- <PRICE>7.20</PRICE>
- <YEAR>1985</YEAR>
- </CD>
- <CD>
- <TITLE>Red</TITLE>
- <ARTIST>The Communards</ARTIST>
- <COUNTRY>UK</COUNTRY>
- <COMPANY>London</COMPANY>
- <PRICE>7.80</PRICE>
- <YEAR>1987</YEAR>
- </CD>
- <CD>
- <TITLE>Unchain my heart</TITLE>
- <ARTIST>Joe Cocker</ARTIST>
- <COUNTRY>USA</COUNTRY>
- <COMPANY>EMI</COMPANY>
- <PRICE>8.20</PRICE>
- <YEAR>1987</YEAR>
- </CD>
-</CATALOG>
diff --git a/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_06.xml b/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_06.xml
deleted file mode 100644
index 4ba90fb97..000000000
--- a/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_06.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<root>
- <table>
- <tr>
- <td>Apples</td>
- <td>Bananas</td>
- </tr>
- </table>
- <table>
- <name>African Coffee Table</name>
- <width>80</width>
- <length>120</length>
- </table>
-</root> \ No newline at end of file
diff --git a/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_07.xml b/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_07.xml
deleted file mode 100644
index 34b9e9775..000000000
--- a/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_07.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<root>
- <h:table xmlns:h="http://www.w3.org/TR/html4/">
- <h:tr>
- <h:td>Apples</h:td>
- <h:td>Bananas</h:td>
- </h:tr>
- </h:table>
- <f:table xmlns:f="https://www.w3schools.com/furniture">
- <f:name>African Coffee Table</f:name>
- <f:width>80</f:width>
- <f:length>120</f:length>
- </f:table>
-</root> \ No newline at end of file
diff --git a/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_08.xml b/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_08.xml
deleted file mode 100644
index ccaee4e1a..000000000
--- a/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_08.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<root>
- <h:table xmlns:h="http://www.w3.org/TR/html4/">
- <h:tr>
- <h:td>Apples</h:td>
- <h:td>Oranges</h:td>
- </h:tr>
- </h:table>
- <f:table xmlns:f="https://www.w3schools.com/furniture">
- <f:name>African Coffee Table</f:name>
- <f:width>80</f:width>
- <f:length>120</f:length>
- </f:table>
-</root> \ No newline at end of file
diff --git a/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_09.xml b/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_09.xml
deleted file mode 100644
index 531f84d3f..000000000
--- a/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_09.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<person gender="female">
- <firstname>Foo</firstname>
- <lastname>Bar</lastname>
-</person> \ No newline at end of file
diff --git a/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_10.xml b/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_10.xml
deleted file mode 100644
index b1e1e1fbe..000000000
--- a/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_10.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<person gender="male">
- <firstname>Foo</firstname>
- <lastname>Bar</lastname>
-</person> \ No newline at end of file
diff --git a/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_11.xml b/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_11.xml
deleted file mode 100644
index 3132b0f90..000000000
--- a/vendor/github.com/onsi/gomega/matchers/test_data/xml/sample_11.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
-<note>
- <to>Tove</to>
- <from>Jani</from>
- <heading>Reminder</heading>
- <body>Don't forget me this weekend!</body>
-</note>
diff --git a/vendor/github.com/onsi/gomega/matchers/with_transform_test.go b/vendor/github.com/onsi/gomega/matchers/with_transform_test.go
deleted file mode 100644
index e52bf8e63..000000000
--- a/vendor/github.com/onsi/gomega/matchers/with_transform_test.go
+++ /dev/null
@@ -1,102 +0,0 @@
-package matchers_test
-
-import (
- "errors"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "github.com/onsi/gomega/matchers"
-)
-
-var _ = Describe("WithTransformMatcher", func() {
-
- var plus1 = func(i int) int { return i + 1 }
-
- Context("Panic if transform function invalid", func() {
- panicsWithTransformer := func(transform interface{}) {
- ExpectWithOffset(1, func() { WithTransform(transform, nil) }).To(Panic())
- }
- It("nil", func() {
- panicsWithTransformer(nil)
- })
- Context("Invalid number of args, but correct return value count", func() {
- It("zero", func() {
- panicsWithTransformer(func() int { return 5 })
- })
- It("two", func() {
- panicsWithTransformer(func(i, j int) int { return 5 })
- })
- })
- Context("Invalid number of return values, but correct number of arguments", func() {
- It("zero", func() {
- panicsWithTransformer(func(i int) {})
- })
- It("two", func() {
- panicsWithTransformer(func(i int) (int, int) { return 5, 6 })
- })
- })
- })
-
- It("works with positive cases", func() {
- Expect(1).To(WithTransform(plus1, Equal(2)))
- Expect(1).To(WithTransform(plus1, WithTransform(plus1, Equal(3))))
- Expect(1).To(WithTransform(plus1, And(Equal(2), BeNumerically(">", 1))))
-
- // transform expects custom type
- type S struct {
- A int
- B string
- }
- transformer := func(s S) string { return s.B }
- Expect(S{1, "hi"}).To(WithTransform(transformer, Equal("hi")))
-
- // transform expects interface
- errString := func(e error) string { return e.Error() }
- Expect(errors.New("abc")).To(WithTransform(errString, Equal("abc")))
- })
-
- It("works with negative cases", func() {
- Expect(1).ToNot(WithTransform(plus1, Equal(3)))
- Expect(1).ToNot(WithTransform(plus1, WithTransform(plus1, Equal(2))))
- })
-
- Context("failure messages", func() {
- Context("when match fails", func() {
- It("gives a descriptive message", func() {
- m := WithTransform(plus1, Equal(3))
- Expect(m.Match(1)).To(BeFalse())
- Expect(m.FailureMessage(1)).To(Equal("Expected\n <int>: 2\nto equal\n <int>: 3"))
- })
- })
-
- Context("when match succeeds, but expected it to fail", func() {
- It("gives a descriptive message", func() {
- m := Not(WithTransform(plus1, Equal(3)))
- Expect(m.Match(2)).To(BeFalse())
- Expect(m.FailureMessage(2)).To(Equal("Expected\n <int>: 3\nnot to equal\n <int>: 3"))
- })
- })
-
- Context("actual value is incompatible with transform function's argument type", func() {
- It("gracefully fails if transform cannot be performed", func() {
- m := WithTransform(plus1, Equal(3))
- result, err := m.Match("hi") // give it a string but transform expects int; doesn't panic
- Expect(result).To(BeFalse())
- Expect(err).To(MatchError("Transform function expects 'int' but we have 'string'"))
- })
- })
- })
-
- Context("MatchMayChangeInTheFuture()", func() {
- It("Propagates value from wrapped matcher on the transformed value", func() {
- m := WithTransform(plus1, Or()) // empty Or() always returns false, and indicates it cannot change
- Expect(m.Match(1)).To(BeFalse())
- Expect(m.(*WithTransformMatcher).MatchMayChangeInTheFuture(1)).To(BeFalse()) // empty Or() indicates cannot change
- })
- It("Defaults to true", func() {
- m := WithTransform(plus1, Equal(2)) // Equal does not have this method
- Expect(m.Match(1)).To(BeTrue())
- Expect(m.(*WithTransformMatcher).MatchMayChangeInTheFuture(1)).To(BeTrue()) // defaults to true
- })
- })
-})