mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
Remove nsenter packages from vendor
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
70d49b4e47
commit
d4a67c05f3
10
vendor/github.com/onsi/ginkgo/config/config.go
generated
vendored
10
vendor/github.com/onsi/ginkgo/config/config.go
generated
vendored
@ -20,7 +20,7 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
const VERSION = "1.8.0"
|
||||
const VERSION = "1.10.1"
|
||||
|
||||
type GinkgoConfigType struct {
|
||||
RandomSeed int64
|
||||
@ -52,13 +52,14 @@ type DefaultReporterConfigType struct {
|
||||
Succinct bool
|
||||
Verbose bool
|
||||
FullTrace bool
|
||||
ReportPassed bool
|
||||
}
|
||||
|
||||
var DefaultReporterConfig = DefaultReporterConfigType{}
|
||||
|
||||
func processPrefix(prefix string) string {
|
||||
if prefix != "" {
|
||||
prefix = prefix + "."
|
||||
prefix += "."
|
||||
}
|
||||
return prefix
|
||||
}
|
||||
@ -98,6 +99,7 @@ func Flags(flagSet *flag.FlagSet, prefix string, includeParallelFlags bool) {
|
||||
flagSet.BoolVar(&(DefaultReporterConfig.Verbose), prefix+"v", false, "If set, default reporter print out all specs as they begin.")
|
||||
flagSet.BoolVar(&(DefaultReporterConfig.Succinct), prefix+"succinct", false, "If set, default reporter prints out a very succinct report")
|
||||
flagSet.BoolVar(&(DefaultReporterConfig.FullTrace), prefix+"trace", false, "If set, default reporter prints out the full stack trace when a failure occurs")
|
||||
flagSet.BoolVar(&(DefaultReporterConfig.ReportPassed), prefix+"reportPassed", false, "If set, default reporter prints out captured output of passed tests.")
|
||||
}
|
||||
|
||||
func BuildFlagArgs(prefix string, ginkgo GinkgoConfigType, reporter DefaultReporterConfigType) []string {
|
||||
@ -196,5 +198,9 @@ func BuildFlagArgs(prefix string, ginkgo GinkgoConfigType, reporter DefaultRepor
|
||||
result = append(result, fmt.Sprintf("--%strace", prefix))
|
||||
}
|
||||
|
||||
if reporter.ReportPassed {
|
||||
result = append(result, fmt.Sprintf("--%sreportPassed", prefix))
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
4
vendor/github.com/onsi/ginkgo/ginkgo_dsl.go
generated
vendored
4
vendor/github.com/onsi/ginkgo/ginkgo_dsl.go
generated
vendored
@ -283,7 +283,7 @@ func GinkgoRecover() {
|
||||
//BeforeEach, AfterEach, JustBeforeEach, It, and Measurement blocks.
|
||||
//
|
||||
//In addition you can nest Describe, Context and When blocks. Describe, Context and When blocks are functionally
|
||||
//equivalent. The difference is purely semantic -- you typical Describe the behavior of an object
|
||||
//equivalent. The difference is purely semantic -- you typically Describe the behavior of an object
|
||||
//or method and, within that Describe, outline a number of Contexts and Whens.
|
||||
func Describe(text string, body func()) bool {
|
||||
globalSuite.PushContainerNode(text, body, types.FlagTypeNone, codelocation.New(1))
|
||||
@ -499,7 +499,7 @@ func AfterSuite(body interface{}, timeout ...float64) bool {
|
||||
//until that node is done before running.
|
||||
//
|
||||
//SynchronizedBeforeSuite accomplishes this by taking *two* function arguments. The first is only run on parallel node #1. The second is
|
||||
//run on all nodes, but *only* after the first function completes succesfully. Ginkgo also makes it possible to send data from the first function (on Node 1)
|
||||
//run on all nodes, but *only* after the first function completes successfully. Ginkgo also makes it possible to send data from the first function (on Node 1)
|
||||
//to the second function (on all the other nodes).
|
||||
//
|
||||
//The functions have the following signatures. The first function (which only runs on node 1) has the signature:
|
||||
|
20
vendor/github.com/onsi/ginkgo/internal/codelocation/code_location.go
generated
vendored
20
vendor/github.com/onsi/ginkgo/internal/codelocation/code_location.go
generated
vendored
@ -11,19 +11,35 @@ import (
|
||||
|
||||
func New(skip int) types.CodeLocation {
|
||||
_, file, line, _ := runtime.Caller(skip + 1)
|
||||
stackTrace := PruneStack(string(debug.Stack()), skip)
|
||||
stackTrace := PruneStack(string(debug.Stack()), skip+1)
|
||||
return types.CodeLocation{FileName: file, LineNumber: line, FullStackTrace: stackTrace}
|
||||
}
|
||||
|
||||
// PruneStack removes references to functions that are internal to Ginkgo
|
||||
// and the Go runtime from a stack string and a certain number of stack entries
|
||||
// at the beginning of the stack. The stack string has the format
|
||||
// as returned by runtime/debug.Stack. The leading goroutine information is
|
||||
// optional and always removed if present. Beware that runtime/debug.Stack
|
||||
// adds itself as first entry, so typically skip must be >= 1 to remove that
|
||||
// entry.
|
||||
func PruneStack(fullStackTrace string, skip int) string {
|
||||
stack := strings.Split(fullStackTrace, "\n")
|
||||
// Ensure that the even entries are the method names and the
|
||||
// the odd entries the source code information.
|
||||
if len(stack) > 0 && strings.HasPrefix(stack[0], "goroutine ") {
|
||||
// Ignore "goroutine 29 [running]:" line.
|
||||
stack = stack[1:]
|
||||
}
|
||||
// The "+1" is for skipping over the initial entry, which is
|
||||
// runtime/debug.Stack() itself.
|
||||
if len(stack) > 2*(skip+1) {
|
||||
stack = stack[2*(skip+1):]
|
||||
}
|
||||
prunedStack := []string{}
|
||||
re := regexp.MustCompile(`\/ginkgo\/|\/pkg\/testing\/|\/pkg\/runtime\/`)
|
||||
for i := 0; i < len(stack)/2; i++ {
|
||||
if !re.Match([]byte(stack[i*2])) {
|
||||
// We filter out based on the source code file name.
|
||||
if !re.Match([]byte(stack[i*2+1])) {
|
||||
prunedStack = append(prunedStack, stack[i*2])
|
||||
prunedStack = append(prunedStack, stack[i*2+1])
|
||||
}
|
||||
|
2
vendor/github.com/onsi/ginkgo/internal/leafnodes/benchmarker.go
generated
vendored
2
vendor/github.com/onsi/ginkgo/internal/leafnodes/benchmarker.go
generated
vendored
@ -17,7 +17,7 @@ type benchmarker struct {
|
||||
|
||||
func newBenchmarker() *benchmarker {
|
||||
return &benchmarker{
|
||||
measurements: make(map[string]*types.SpecMeasurement, 0),
|
||||
measurements: make(map[string]*types.SpecMeasurement),
|
||||
}
|
||||
}
|
||||
|
||||
|
12
vendor/github.com/onsi/ginkgo/internal/remote/aggregator.go
generated
vendored
12
vendor/github.com/onsi/ginkgo/internal/remote/aggregator.go
generated
vendored
@ -54,11 +54,11 @@ func NewAggregator(nodeCount int, result chan bool, config config.DefaultReporte
|
||||
config: config,
|
||||
stenographer: stenographer,
|
||||
|
||||
suiteBeginnings: make(chan configAndSuite, 0),
|
||||
beforeSuites: make(chan *types.SetupSummary, 0),
|
||||
afterSuites: make(chan *types.SetupSummary, 0),
|
||||
specCompletions: make(chan *types.SpecSummary, 0),
|
||||
suiteEndings: make(chan *types.SuiteSummary, 0),
|
||||
suiteBeginnings: make(chan configAndSuite),
|
||||
beforeSuites: make(chan *types.SetupSummary),
|
||||
afterSuites: make(chan *types.SetupSummary),
|
||||
specCompletions: make(chan *types.SpecSummary),
|
||||
suiteEndings: make(chan *types.SuiteSummary),
|
||||
}
|
||||
|
||||
go aggregator.mux()
|
||||
@ -227,7 +227,7 @@ func (aggregator *Aggregator) registerSuiteEnding(suite *types.SuiteSummary) (fi
|
||||
aggregatedSuiteSummary.SuiteSucceeded = true
|
||||
|
||||
for _, suiteSummary := range aggregator.aggregatedSuiteEndings {
|
||||
if suiteSummary.SuiteSucceeded == false {
|
||||
if !suiteSummary.SuiteSucceeded {
|
||||
aggregatedSuiteSummary.SuiteSucceeded = false
|
||||
}
|
||||
|
||||
|
2
vendor/github.com/onsi/ginkgo/internal/remote/server.go
generated
vendored
2
vendor/github.com/onsi/ginkgo/internal/remote/server.go
generated
vendored
@ -213,7 +213,7 @@ func (server *Server) handleCounter(writer http.ResponseWriter, request *http.Re
|
||||
c := spec_iterator.Counter{}
|
||||
server.lock.Lock()
|
||||
c.Index = server.counter
|
||||
server.counter = server.counter + 1
|
||||
server.counter++
|
||||
server.lock.Unlock()
|
||||
|
||||
json.NewEncoder(writer).Encode(c)
|
||||
|
10
vendor/github.com/onsi/ginkgo/internal/spec/spec.go
generated
vendored
10
vendor/github.com/onsi/ginkgo/internal/spec/spec.go
generated
vendored
@ -107,11 +107,11 @@ func (spec *Spec) Summary(suiteID string) *types.SpecSummary {
|
||||
NumberOfSamples: spec.subject.Samples(),
|
||||
ComponentTexts: componentTexts,
|
||||
ComponentCodeLocations: componentCodeLocations,
|
||||
State: spec.getState(),
|
||||
RunTime: runTime,
|
||||
Failure: spec.failure,
|
||||
Measurements: spec.measurementsReport(),
|
||||
SuiteID: suiteID,
|
||||
State: spec.getState(),
|
||||
RunTime: runTime,
|
||||
Failure: spec.failure,
|
||||
Measurements: spec.measurementsReport(),
|
||||
SuiteID: suiteID,
|
||||
}
|
||||
}
|
||||
|
||||
|
4
vendor/github.com/onsi/ginkgo/internal/spec/specs.go
generated
vendored
4
vendor/github.com/onsi/ginkgo/internal/spec/specs.go
generated
vendored
@ -107,11 +107,11 @@ func (e *Specs) applyRegExpFocusAndSkip(description string, focusString string,
|
||||
toMatch := e.toMatch(description, i)
|
||||
|
||||
if focusFilter != nil {
|
||||
matchesFocus = focusFilter.Match([]byte(toMatch))
|
||||
matchesFocus = focusFilter.Match(toMatch)
|
||||
}
|
||||
|
||||
if skipFilter != nil {
|
||||
matchesSkip = skipFilter.Match([]byte(toMatch))
|
||||
matchesSkip = skipFilter.Match(toMatch)
|
||||
}
|
||||
|
||||
if !matchesFocus || matchesSkip {
|
||||
|
2
vendor/github.com/onsi/ginkgo/internal/specrunner/spec_runner.go
generated
vendored
2
vendor/github.com/onsi/ginkgo/internal/specrunner/spec_runner.go
generated
vendored
@ -300,7 +300,7 @@ func (runner *SpecRunner) reportSpecWillRun(summary *types.SpecSummary) {
|
||||
}
|
||||
|
||||
func (runner *SpecRunner) reportSpecDidComplete(summary *types.SpecSummary, failed bool) {
|
||||
if failed && len(summary.CapturedOutput) == 0 {
|
||||
if len(summary.CapturedOutput) == 0 {
|
||||
summary.CapturedOutput = string(runner.writer.Bytes())
|
||||
}
|
||||
for i := len(runner.reporters) - 1; i >= 1; i-- {
|
||||
|
3
vendor/github.com/onsi/ginkgo/reporters/default_reporter.go
generated
vendored
3
vendor/github.com/onsi/ginkgo/reporters/default_reporter.go
generated
vendored
@ -62,6 +62,9 @@ func (reporter *DefaultReporter) SpecDidComplete(specSummary *types.SpecSummary)
|
||||
reporter.stenographer.AnnounceSuccesfulSlowSpec(specSummary, reporter.config.Succinct)
|
||||
} else {
|
||||
reporter.stenographer.AnnounceSuccesfulSpec(specSummary)
|
||||
if reporter.config.ReportPassed {
|
||||
reporter.stenographer.AnnounceCapturedOutput(specSummary.CapturedOutput)
|
||||
}
|
||||
}
|
||||
case types.SpecStatePending:
|
||||
reporter.stenographer.AnnouncePendingSpec(specSummary, reporter.config.NoisyPendings && !reporter.config.Succinct)
|
||||
|
25
vendor/github.com/onsi/ginkgo/reporters/junit_reporter.go
generated
vendored
25
vendor/github.com/onsi/ginkgo/reporters/junit_reporter.go
generated
vendored
@ -32,12 +32,17 @@ type JUnitTestSuite struct {
|
||||
type JUnitTestCase struct {
|
||||
Name string `xml:"name,attr"`
|
||||
ClassName string `xml:"classname,attr"`
|
||||
PassedMessage *JUnitPassedMessage `xml:"passed,omitempty"`
|
||||
FailureMessage *JUnitFailureMessage `xml:"failure,omitempty"`
|
||||
Skipped *JUnitSkipped `xml:"skipped,omitempty"`
|
||||
Time float64 `xml:"time,attr"`
|
||||
SystemOut string `xml:"system-out,omitempty"`
|
||||
}
|
||||
|
||||
type JUnitPassedMessage struct {
|
||||
Message string `xml:",chardata"`
|
||||
}
|
||||
|
||||
type JUnitFailureMessage struct {
|
||||
Type string `xml:"type,attr"`
|
||||
Message string `xml:",chardata"`
|
||||
@ -48,9 +53,10 @@ type JUnitSkipped struct {
|
||||
}
|
||||
|
||||
type JUnitReporter struct {
|
||||
suite JUnitTestSuite
|
||||
filename string
|
||||
testSuiteName string
|
||||
suite JUnitTestSuite
|
||||
filename string
|
||||
testSuiteName string
|
||||
ReporterConfig config.DefaultReporterConfigType
|
||||
}
|
||||
|
||||
//NewJUnitReporter creates a new JUnit XML reporter. The XML will be stored in the passed in filename.
|
||||
@ -60,12 +66,13 @@ func NewJUnitReporter(filename string) *JUnitReporter {
|
||||
}
|
||||
}
|
||||
|
||||
func (reporter *JUnitReporter) SpecSuiteWillBegin(config config.GinkgoConfigType, summary *types.SuiteSummary) {
|
||||
func (reporter *JUnitReporter) SpecSuiteWillBegin(ginkgoConfig config.GinkgoConfigType, summary *types.SuiteSummary) {
|
||||
reporter.suite = JUnitTestSuite{
|
||||
Name: summary.SuiteDescription,
|
||||
TestCases: []JUnitTestCase{},
|
||||
}
|
||||
reporter.testSuiteName = summary.SuiteDescription
|
||||
reporter.ReporterConfig = config.DefaultReporterConfig
|
||||
}
|
||||
|
||||
func (reporter *JUnitReporter) SpecWillRun(specSummary *types.SpecSummary) {
|
||||
@ -105,11 +112,21 @@ func (reporter *JUnitReporter) SpecDidComplete(specSummary *types.SpecSummary) {
|
||||
Name: strings.Join(specSummary.ComponentTexts[1:], " "),
|
||||
ClassName: reporter.testSuiteName,
|
||||
}
|
||||
if reporter.ReporterConfig.ReportPassed && specSummary.State == types.SpecStatePassed {
|
||||
testCase.PassedMessage = &JUnitPassedMessage{
|
||||
Message: specSummary.CapturedOutput,
|
||||
}
|
||||
}
|
||||
if specSummary.State == types.SpecStateFailed || specSummary.State == types.SpecStateTimedOut || specSummary.State == types.SpecStatePanicked {
|
||||
testCase.FailureMessage = &JUnitFailureMessage{
|
||||
Type: reporter.failureTypeForState(specSummary.State),
|
||||
Message: failureMessage(specSummary.Failure),
|
||||
}
|
||||
if specSummary.State == types.SpecStatePanicked {
|
||||
testCase.FailureMessage.Message += fmt.Sprintf("\n\nPanic: %s\n\nFull stack:\n%s",
|
||||
specSummary.Failure.ForwardedPanic,
|
||||
specSummary.Failure.Location.FullStackTrace)
|
||||
}
|
||||
testCase.SystemOut = specSummary.CapturedOutput
|
||||
}
|
||||
if specSummary.State == types.SpecStateSkipped || specSummary.State == types.SpecStatePending {
|
||||
|
9
vendor/github.com/onsi/ginkgo/reporters/teamcity_reporter.go
generated
vendored
9
vendor/github.com/onsi/ginkgo/reporters/teamcity_reporter.go
generated
vendored
@ -22,8 +22,9 @@ const (
|
||||
)
|
||||
|
||||
type TeamCityReporter struct {
|
||||
writer io.Writer
|
||||
testSuiteName string
|
||||
writer io.Writer
|
||||
testSuiteName string
|
||||
ReporterConfig config.DefaultReporterConfigType
|
||||
}
|
||||
|
||||
func NewTeamCityReporter(writer io.Writer) *TeamCityReporter {
|
||||
@ -65,6 +66,10 @@ func (reporter *TeamCityReporter) SpecWillRun(specSummary *types.SpecSummary) {
|
||||
func (reporter *TeamCityReporter) SpecDidComplete(specSummary *types.SpecSummary) {
|
||||
testName := escape(strings.Join(specSummary.ComponentTexts[1:], " "))
|
||||
|
||||
if reporter.ReporterConfig.ReportPassed && specSummary.State == types.SpecStatePassed {
|
||||
details := escape(specSummary.CapturedOutput)
|
||||
fmt.Fprintf(reporter.writer, "%s[testPassed name='%s' details='%s']", messageId, testName, details)
|
||||
}
|
||||
if specSummary.State == types.SpecStateFailed || specSummary.State == types.SpecStateTimedOut || specSummary.State == types.SpecStatePanicked {
|
||||
message := escape(specSummary.Failure.ComponentCodeLocation.String())
|
||||
details := escape(specSummary.Failure.Message)
|
||||
|
2
vendor/github.com/onsi/ginkgo/types/types.go
generated
vendored
2
vendor/github.com/onsi/ginkgo/types/types.go
generated
vendored
@ -17,7 +17,7 @@ each node does not deterministically know how many specs it will end up running.
|
||||
|
||||
Unfortunately making such a change would break backward compatibility.
|
||||
|
||||
Until Ginkgo 2.0 comes out we will continue to reuse this struct but populate unkown fields
|
||||
Until Ginkgo 2.0 comes out we will continue to reuse this struct but populate unknown fields
|
||||
with -1.
|
||||
*/
|
||||
type SuiteSummary struct {
|
||||
|
37
vendor/github.com/onsi/gomega/format/format.go
generated
vendored
37
vendor/github.com/onsi/gomega/format/format.go
generated
vendored
@ -1,6 +1,9 @@
|
||||
/*
|
||||
Gomega's format package pretty-prints objects. It explores input objects recursively and generates formatted, indented output with type information.
|
||||
*/
|
||||
|
||||
// untested sections: 4
|
||||
|
||||
package format
|
||||
|
||||
import (
|
||||
@ -33,7 +36,15 @@ var PrintContextObjects = false
|
||||
// TruncatedDiff choose if we should display a truncated pretty diff or not
|
||||
var TruncatedDiff = true
|
||||
|
||||
// Ctx interface defined here to keep backwards compatability with go < 1.7
|
||||
// TruncateThreshold (default 50) specifies the maximum length string to print in string comparison assertion error
|
||||
// messages.
|
||||
var TruncateThreshold uint = 50
|
||||
|
||||
// CharactersAroundMismatchToInclude (default 5) specifies how many contextual characters should be printed before and
|
||||
// after the first diff location in a truncated string assertion error message.
|
||||
var CharactersAroundMismatchToInclude uint = 5
|
||||
|
||||
// Ctx interface defined here to keep backwards compatibility with go < 1.7
|
||||
// It matches the context.Context interface
|
||||
type Ctx interface {
|
||||
Deadline() (deadline time.Time, ok bool)
|
||||
@ -58,7 +69,7 @@ Generates a formatted matcher success/failure message of the form:
|
||||
<message>
|
||||
<pretty printed expected>
|
||||
|
||||
If expected is omited, then the message looks like:
|
||||
If expected is omitted, then the message looks like:
|
||||
|
||||
Expected
|
||||
<pretty printed actual>
|
||||
@ -85,7 +96,7 @@ to equal |
|
||||
*/
|
||||
|
||||
func MessageWithDiff(actual, message, expected string) string {
|
||||
if TruncatedDiff && len(actual) >= truncateThreshold && len(expected) >= truncateThreshold {
|
||||
if TruncatedDiff && len(actual) >= int(TruncateThreshold) && len(expected) >= int(TruncateThreshold) {
|
||||
diffPoint := findFirstMismatch(actual, expected)
|
||||
formattedActual := truncateAndFormat(actual, diffPoint)
|
||||
formattedExpected := truncateAndFormat(expected, diffPoint)
|
||||
@ -97,14 +108,23 @@ func MessageWithDiff(actual, message, expected string) string {
|
||||
padding := strings.Repeat(" ", spaceFromMessageToActual+spacesBeforeFormattedMismatch) + "|"
|
||||
return Message(formattedActual, message+padding, formattedExpected)
|
||||
}
|
||||
|
||||
actual = escapedWithGoSyntax(actual)
|
||||
expected = escapedWithGoSyntax(expected)
|
||||
|
||||
return Message(actual, message, expected)
|
||||
}
|
||||
|
||||
func escapedWithGoSyntax(str string) string {
|
||||
withQuotes := fmt.Sprintf("%q", str)
|
||||
return withQuotes[1 : len(withQuotes)-1]
|
||||
}
|
||||
|
||||
func truncateAndFormat(str string, index int) string {
|
||||
leftPadding := `...`
|
||||
rightPadding := `...`
|
||||
|
||||
start := index - charactersAroundMismatchToInclude
|
||||
start := index - int(CharactersAroundMismatchToInclude)
|
||||
if start < 0 {
|
||||
start = 0
|
||||
leftPadding = ""
|
||||
@ -112,7 +132,7 @@ func truncateAndFormat(str string, index int) string {
|
||||
|
||||
// slice index must include the mis-matched character
|
||||
lengthOfMismatchedCharacter := 1
|
||||
end := index + charactersAroundMismatchToInclude + lengthOfMismatchedCharacter
|
||||
end := index + int(CharactersAroundMismatchToInclude) + lengthOfMismatchedCharacter
|
||||
if end > len(str) {
|
||||
end = len(str)
|
||||
rightPadding = ""
|
||||
@ -141,11 +161,6 @@ func findFirstMismatch(a, b string) int {
|
||||
return 0
|
||||
}
|
||||
|
||||
const (
|
||||
truncateThreshold = 50
|
||||
charactersAroundMismatchToInclude = 5
|
||||
)
|
||||
|
||||
/*
|
||||
Pretty prints the passed in object at the passed in indentation level.
|
||||
|
||||
@ -288,7 +303,7 @@ func formatString(object interface{}, indentation uint) string {
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s", result)
|
||||
return result
|
||||
} else {
|
||||
return fmt.Sprintf("%q", object)
|
||||
}
|
||||
|
10
vendor/github.com/onsi/gomega/gomega_dsl.go
generated
vendored
10
vendor/github.com/onsi/gomega/gomega_dsl.go
generated
vendored
@ -24,7 +24,7 @@ import (
|
||||
"github.com/onsi/gomega/types"
|
||||
)
|
||||
|
||||
const GOMEGA_VERSION = "1.5.0"
|
||||
const GOMEGA_VERSION = "1.7.0"
|
||||
|
||||
const nilFailHandlerPanic = `You are trying to make an assertion, but Gomega's fail handler is nil.
|
||||
If you're using Ginkgo then you probably forgot to put your assertion in an It().
|
||||
@ -155,7 +155,7 @@ func Expect(actual interface{}, extra ...interface{}) Assertion {
|
||||
// ExpectWithOffset(1, "foo").To(Equal("foo"))
|
||||
//
|
||||
// Unlike `Expect` and `Ω`, `ExpectWithOffset` takes an additional integer argument
|
||||
// this is used to modify the call-stack offset when computing line numbers.
|
||||
// that is used to modify the call-stack offset when computing line numbers.
|
||||
//
|
||||
// This is most useful in helper functions that make assertions. If you want Gomega's
|
||||
// error message to refer to the calling line in the test (as opposed to the line in the helper function)
|
||||
@ -242,7 +242,7 @@ func EventuallyWithOffset(offset int, actual interface{}, intervals ...interface
|
||||
// assert that all other values are nil/zero.
|
||||
// This allows you to pass Consistently a function that returns a value and an error - a common pattern in Go.
|
||||
//
|
||||
// Consistently is useful in cases where you want to assert that something *does not happen* over a period of tiem.
|
||||
// Consistently is useful in cases where you want to assert that something *does not happen* over a period of time.
|
||||
// For example, you want to assert that a goroutine does *not* send data down a channel. In this case, you could:
|
||||
//
|
||||
// Consistently(channel).ShouldNot(Receive())
|
||||
@ -280,7 +280,7 @@ func SetDefaultEventuallyPollingInterval(t time.Duration) {
|
||||
defaultEventuallyPollingInterval = t
|
||||
}
|
||||
|
||||
// SetDefaultConsistentlyDuration sets the default duration for Consistently. Consistently will verify that your condition is satsified for this long.
|
||||
// SetDefaultConsistentlyDuration sets the default duration for Consistently. Consistently will verify that your condition is satisfied for this long.
|
||||
func SetDefaultConsistentlyDuration(t time.Duration) {
|
||||
defaultConsistentlyDuration = t
|
||||
}
|
||||
@ -320,7 +320,7 @@ type GomegaAsyncAssertion = AsyncAssertion
|
||||
// All methods take a variadic optionalDescription argument. This is passed on to fmt.Sprintf()
|
||||
// and is used to annotate failure messages.
|
||||
//
|
||||
// All methods return a bool that is true if hte assertion passed and false if it failed.
|
||||
// All methods return a bool that is true if the assertion passed and false if it failed.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
|
2
vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion.go
generated
vendored
2
vendor/github.com/onsi/gomega/internal/asyncassertion/async_assertion.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 2
|
||||
|
||||
package asyncassertion
|
||||
|
||||
import (
|
||||
|
16
vendor/github.com/onsi/gomega/matchers.go
generated
vendored
16
vendor/github.com/onsi/gomega/matchers.go
generated
vendored
@ -269,6 +269,22 @@ func ContainElement(element interface{}) types.GomegaMatcher {
|
||||
}
|
||||
}
|
||||
|
||||
//BeElementOf succeeds if actual is contained in the passed in elements.
|
||||
//BeElementOf() always uses Equal() to perform the match.
|
||||
//When the passed in elements are comprised of a single element that is either an Array or Slice, BeElementOf() behaves
|
||||
//as the reverse of ContainElement() that operates with Equal() to perform the match.
|
||||
// Expect(2).Should(BeElementOf([]int{1, 2}))
|
||||
// Expect(2).Should(BeElementOf([2]int{1, 2}))
|
||||
//Otherwise, BeElementOf() provides a syntactic sugar for Or(Equal(_), Equal(_), ...):
|
||||
// Expect(2).Should(BeElementOf(1, 2))
|
||||
//
|
||||
//Actual must be typed.
|
||||
func BeElementOf(elements ...interface{}) types.GomegaMatcher {
|
||||
return &matchers.BeElementOfMatcher{
|
||||
Elements: elements,
|
||||
}
|
||||
}
|
||||
|
||||
//ConsistOf succeeds if actual contains precisely the elements passed into the matcher. The ordering of the elements does not matter.
|
||||
//By default ConsistOf() uses Equal() to match the elements, however custom matchers can be passed in instead. Here are some examples:
|
||||
//
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/assignable_to_type_of_matcher.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 2
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/be_a_directory.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/be_a_directory.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 5
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 5
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 3
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/be_closed_matcher.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 2
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
|
57
vendor/github.com/onsi/gomega/matchers/be_element_of_matcher.go
generated
vendored
Normal file
57
vendor/github.com/onsi/gomega/matchers/be_element_of_matcher.go
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
// untested sections: 1
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/onsi/gomega/format"
|
||||
)
|
||||
|
||||
type BeElementOfMatcher struct {
|
||||
Elements []interface{}
|
||||
}
|
||||
|
||||
func (matcher *BeElementOfMatcher) Match(actual interface{}) (success bool, err error) {
|
||||
if reflect.TypeOf(actual) == nil {
|
||||
return false, fmt.Errorf("BeElement matcher expects actual to be typed")
|
||||
}
|
||||
|
||||
length := len(matcher.Elements)
|
||||
valueAt := func(i int) interface{} {
|
||||
return matcher.Elements[i]
|
||||
}
|
||||
// Special handling of a single element of type Array or Slice
|
||||
if length == 1 && isArrayOrSlice(valueAt(0)) {
|
||||
element := valueAt(0)
|
||||
value := reflect.ValueOf(element)
|
||||
length = value.Len()
|
||||
valueAt = func(i int) interface{} {
|
||||
return value.Index(i).Interface()
|
||||
}
|
||||
}
|
||||
|
||||
var lastError error
|
||||
for i := 0; i < length; i++ {
|
||||
matcher := &EqualMatcher{Expected: valueAt(i)}
|
||||
success, err := matcher.Match(actual)
|
||||
if err != nil {
|
||||
lastError = err
|
||||
continue
|
||||
}
|
||||
if success {
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
|
||||
return false, lastError
|
||||
}
|
||||
|
||||
func (matcher *BeElementOfMatcher) FailureMessage(actual interface{}) (message string) {
|
||||
return format.Message(actual, "to be an element of", matcher.Elements)
|
||||
}
|
||||
|
||||
func (matcher *BeElementOfMatcher) NegatedFailureMessage(actual interface{}) (message string) {
|
||||
return format.Message(actual, "not to be an element of", matcher.Elements)
|
||||
}
|
2
vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/be_empty_matcher.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 2
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/be_equivalent_to_matcher.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 2
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/be_false_matcher.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/be_false_matcher.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 2
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/be_identical_to.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/be_identical_to.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 2
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/be_nil_matcher.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/be_nil_matcher.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 2
|
||||
|
||||
package matchers
|
||||
|
||||
import "github.com/onsi/gomega/format"
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/be_numerically_matcher.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 4
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/be_sent_matcher.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/be_sent_matcher.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 3
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/be_temporally_matcher.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/be_temporally_matcher.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 3
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/be_true_matcher.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/be_true_matcher.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 2
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/consist_of.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/consist_of.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 3
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
|
22
vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go
generated
vendored
22
vendor/github.com/onsi/gomega/matchers/contain_element_matcher.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 2
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
@ -22,19 +24,21 @@ func (matcher *ContainElementMatcher) Match(actual interface{}) (success bool, e
|
||||
}
|
||||
|
||||
value := reflect.ValueOf(actual)
|
||||
var keys []reflect.Value
|
||||
var valueAt func(int) interface{}
|
||||
if isMap(actual) {
|
||||
keys = value.MapKeys()
|
||||
keys := value.MapKeys()
|
||||
valueAt = func(i int) interface{} {
|
||||
return value.MapIndex(keys[i]).Interface()
|
||||
}
|
||||
} else {
|
||||
valueAt = func(i int) interface{} {
|
||||
return value.Index(i).Interface()
|
||||
}
|
||||
}
|
||||
|
||||
var lastError error
|
||||
for i := 0; i < value.Len(); i++ {
|
||||
var success bool
|
||||
var err error
|
||||
if isMap(actual) {
|
||||
success, err = elemMatcher.Match(value.MapIndex(keys[i]).Interface())
|
||||
} else {
|
||||
success, err = elemMatcher.Match(value.Index(i).Interface())
|
||||
}
|
||||
success, err := elemMatcher.Match(valueAt(i))
|
||||
if err != nil {
|
||||
lastError = err
|
||||
continue
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/contain_substring_matcher.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/contain_substring_matcher.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 2
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/have_cap_matcher.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/have_cap_matcher.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 2
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/have_key_matcher.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/have_key_matcher.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 6
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections:10
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/have_occurred_matcher.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 2
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/receive_matcher.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/receive_matcher.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 3
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/semi_structured_data_support.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/semi_structured_data_support.go
generated
vendored
@ -1,3 +1,5 @@
|
||||
// untested sections: 5
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
|
@ -1,6 +1,5 @@
|
||||
package bipartitegraph
|
||||
|
||||
import "errors"
|
||||
import "fmt"
|
||||
|
||||
import . "github.com/onsi/gomega/matchers/support/goraph/node"
|
||||
@ -28,7 +27,7 @@ func NewBipartiteGraph(leftValues, rightValues []interface{}, neighbours func(in
|
||||
for j, rightValue := range rightValues {
|
||||
neighbours, err := neighbours(leftValue, rightValue)
|
||||
if err != nil {
|
||||
return nil, errors.New(fmt.Sprintf("error determining adjacency for %v and %v: %s", leftValue, rightValue, err.Error()))
|
||||
return nil, fmt.Errorf("error determining adjacency for %v and %v: %s", leftValue, rightValue, err.Error())
|
||||
}
|
||||
|
||||
if neighbours {
|
||||
|
3
vendor/github.com/onsi/gomega/matchers/type_support.go
generated
vendored
3
vendor/github.com/onsi/gomega/matchers/type_support.go
generated
vendored
@ -6,6 +6,9 @@ See the docs for Gomega for documentation on the matchers
|
||||
|
||||
http://onsi.github.io/gomega/
|
||||
*/
|
||||
|
||||
// untested sections: 11
|
||||
|
||||
package matchers
|
||||
|
||||
import (
|
||||
|
Reference in New Issue
Block a user