Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add custom template #187

Open
neocortexplus opened this issue Dec 14, 2023 · 0 comments
Open

add custom template #187

neocortexplus opened this issue Dec 14, 2023 · 0 comments

Comments

@neocortexplus
Copy link

neocortexplus commented Dec 14, 2023

hello hope you doing well,

i want to create a custom template so simple template to return the output result in addition of the pass faill tests result ,

i create a simple_template.go and put it in the directory templates but when i run i got some weird messages , i didn't find any place to find a tutorial to help me to create my template,


 {{ define "Test" }}
func Test_{{ .Name }}(t *testing.T) {
    type args struct {
        {{- range .Fields }}
        {{ .Name }} {{ .Type }}
        {{- end }}
    }
    tests := []struct {
        name string
        args args
        want {{ .ResultType }}
    }{
        // TODO: Add test cases here.
    }
    for _, tt := range tests {
        t.Run(tt.name, func(t *testing.T) {
            got := {{ .Name }}({{ range $index, $element := .Fields }}{{ if $index }}, {{ end }}tt.args.{{ $element.Name }}{{ end }})
            if got != tt.want {
                t.Errorf("{{ .Name }}() got = %v, want %v", got, tt.want)
            }
        })
    }
}
{{ end }}

root@07598207c071:/home# ls templates/
templates.go
root@07598207c071:/home# gotests -w -only combineIntegerArrays -template_dir /home/templates/ .
output.Process: render.Header: template: no template "header" associated with template "render"

is there any solution to apply .
thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant