...

Source file src/github.com/onsi/gomega/internal/vetoptdesc.go

Documentation: github.com/onsi/gomega/internal

     1  package internal
     2  
     3  import (
     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.
    13  func vetOptionalDescription(assertion string, optionalDescription ...interface{}) {
    14  	if len(optionalDescription) == 0 {
    15  		return
    16  	}
    17  	if _, isGomegaMatcher := optionalDescription[0].(types.GomegaMatcher); isGomegaMatcher {
    18  		panic(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?",
    20  			assertion))
    21  	}
    22  }
    23  

View as plain text