Documentation ¶
Index ¶
- Variables
- func LoadTests[D any](fs embed.FS, path string) (tests []D, err error)
- func MustLoadTests[T any](fs embed.FS, path string) (tests []T)
- func RequireRun[T testing.TB, D TestData](t T, fs embed.FS, runner func(t T, data D))
- func RequireRunWithAddons[T testing.TB, D TestData](t T, fs embed.FS, addons []Addon, runner func(t T, data D))
- func Run[T testing.TB, D TestData](t T, fs embed.FS, runner func(t T, data D)) error
- func RunWithAddons[T testing.TB, D TestData](t T, fs embed.FS, addons []Addon, runner func(t T, data D)) error
- type Addon
- type Empty
- type In
- type Out
- type Test
- type TestData
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrFileConflictName - filename conflict with test data. ErrFileConflictName = errors.New("filename conflict with test data") // ErrFileNotFound - must be at least one test. ErrFileNotFound = errors.New("file not found") // ErrNotFoundTestData - not found test data. ErrNotFoundTestData = errors.New("not found test data") // ErrParsing - json parsing error. ErrParsing = errors.New("json parsing error") // ErrNotSupportingImplementation - not supporting implementation. ErrNotSupportingImplementation = errors.New("not supporting implementation") )
Parse errors.
Functions ¶
func MustLoadTests ¶
MustLoadTests - must parser test data_assistant from JSON by path.
func RequireRun ¶
RequireRun - .
func RequireRunWithAddons ¶
func RequireRunWithAddons[T testing.TB, D TestData](t T, fs embed.FS, addons []Addon, runner func(t T, data D))
RequireRunWithAddons - .
Types ¶
type Addon ¶
Addon - interface for addon matching. The addon allows you to enable add-ons that will finish their work along with test processing.
type In ¶
type In[A any] struct { // Args - can use a query model/structure with a struct (if multiple results are required). Args A `json:"args"` }
In - unified in test format.
type Out ¶
type Out[R any, E error] struct { // Result - can use a query model/structure with a struct (if multiple results are required). Result R `json:"result"` // Error - returned error. // * Note: for the base case use the standard error interface. Error E `json:"error"` }
Out - for the case when a function returns only two values: the result itself and an error, it is best to use this composition.
func (*Out[R, E]) UnmarshalJSON ¶
UnmarshalJSON - implementation json unmarshal interface.
type Test ¶
type Test[I, O any] struct { // Title - allows you to set a short title that can be easily found when needed. Title string `json:"title"` // Description - allows you to add an extended description for the test (improves the readability of tests). Description string `json:"description"` // Arguments - can use a query model/structure with a struct (if multiple arguments are required). // * Note: use kit.In, kit.Empty as a base solution. // * Can be replaced with any custom solution. In I `json:"in"` // Results - expected results. // * Note: use kit.Out as a base solutions. // * Can be replaced with any custom solution. Out O `json:"out"` }
Test - unified test format.
Click to show internal directories.
Click to hide internal directories.