generator

package
v0.0.0-...-f5fd88d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package generator contains templates and generating logic for suites

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body []string

Body represents a body of the method

func (Body) BashString

func (b Body) BashString(withExit, retry bool) string

BashString returns the body as a bash script for the suite

func (Body) String

func (b Body) String() string

String returns the body as part of the method

type Dependencies

type Dependencies []Dependency

Dependencies represent an array of Dependency

func (Dependencies) FieldsString

func (d Dependencies) FieldsString() string

FieldsString returns a string that contains a declaration of suite dependencies as fields

func (Dependencies) SetupString

func (d Dependencies) SetupString() string

SetupString returns a string that contains a declaration of suite dependencies as part of setup function

func (Dependencies) String

func (d Dependencies) String() string

String returns a string that contains a declaration of suite dependencies as part of import

type Dependency

type Dependency string

Dependency represents test dependency

func (Dependency) Name

func (d Dependency) Name() string

Name returns pkg name

func (Dependency) Pkg

func (d Dependency) Pkg() string

Pkg returns a string that can be imported

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator can generate suites from the slice of linker.LinedExample

func New

func New(conf config.Config) *Generator

New creates new Generator instance

func (*Generator) Generate

func (g *Generator) Generate(examples ...*linker.LinkedExample) []*Suite

Generate generates suites based on passed examples

type Suite

type Suite struct {
	Dir      string
	Location string
	Dependency
	Cleanup     Body
	Run         Body
	Tests       []*Test
	Children    []*Suite
	Parents     []*Suite
	Deps        Dependencies
	DepsToSetup Dependencies
}

Suite represents a template for generating a testify suite.Suite

func (*Suite) BashString

func (s *Suite) BashString(retry bool) string

BashString generates bash script for the suite

func (*Suite) String

func (s *Suite) String() string

String returns a string that contains generated testify.Suite

type Test

type Test struct {
	Dir     string
	Name    string
	Cleanup Body
	Run     Body
}

Test is a template for a test for a suite

func (*Test) BashString

func (t *Test) BashString(retry bool) string

BashString generates a bash script for the test

func (*Test) String

func (t *Test) String() string

String returns string as a test for the suite

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL