testgen

package
v0.0.0-...-88bbb11 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TestTmpl = template.Must(template.New("gen_test.go").Funcs(template.FuncMap{
	"createCS": func(ss []string) string {
		var res = make([]byte, 0, 100)
		for _, s := range ss {
			res = append(res, s...)
			res = append(res, ',')
		}
		return string(res)
	}}).Parse(`
	// Code generated by ccffer; DO NOT EDIT.
{{$pkg := .PkgName}}
package {{$pkg}}_test
import (
	"testing"
	"{{.PkgPath}}"
)
{{range $gf := .GenFuncs}}func Test{{$gf.FName}}(t *testing.T) {
	{{range $app := $gf.Apps}}{{$pkg}}.{{$gf.FName}} {{if lt 0 (len $app.TypeInstances)}} [ {{ createCS $app.TypeInstances}}] {{end}} ({{createCS $app.Args}})
	{{end}}
}
{{end}}`))

Functions

func FormatAndImport

func FormatAndImport(src []byte) (string, error)

func GenTests

func GenTests(td *model.TemplData) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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