diff --git a/table_dsl.go b/table_dsl.go index 0db0e7180..e459f88d5 100644 --- a/table_dsl.go +++ b/table_dsl.go @@ -135,6 +135,10 @@ func generateTable(description string, args ...interface{}) { return "Entry: " + strings.Join(out, ", ") } + if len(args) == 1 { + exitIfErr(types.GinkgoErrors.MissingParametersForTableFunction(cl)) + } + for i, arg := range args { switch t := reflect.TypeOf(arg); { case t == nil: diff --git a/types/errors.go b/types/errors.go index 6806d6afc..b45e4283a 100644 --- a/types/errors.go +++ b/types/errors.go @@ -380,6 +380,15 @@ func (g ginkgoErrors) InvalidEntryDescription(cl CodeLocation) error { } } +func (g ginkgoErrors) MissingParametersForTableFunction(cl CodeLocation) error { + return GinkgoError{ + Heading: fmt.Sprintf("No parameters have been passed to the Table Function"), + Message: fmt.Sprintf("The Table Function expected at least 1 parameter"), + CodeLocation: cl, + DocLink: "table-specs", + } +} + func (g ginkgoErrors) IncorrectParameterTypeForTable(i int, name string, cl CodeLocation) error { return GinkgoError{ Heading: "DescribeTable passed incorrect parameter type",