podman
1package internal
2
3import (
4"fmt"
5
6"github.com/onsi/gomega/types"
7)
8
9// vetOptionalDescription vets the optional description args: if it finds any
10// Gomega matcher at the beginning it panics. This allows for rendering Gomega
11// matchers as part of an optional Description, as long as they're not in the
12// first slot.
13func vetOptionalDescription(assertion string, optionalDescription ...interface{}) {
14if len(optionalDescription) == 0 {
15return
16}
17if _, isGomegaMatcher := optionalDescription[0].(types.GomegaMatcher); isGomegaMatcher {
18panic(fmt.Sprintf("%s has a GomegaMatcher as the first element of optionalDescription.\n\t"+
19"Do you mean to use And/Or/SatisfyAll/SatisfyAny to combine multiple matchers?",
20assertion))
21}
22}
23