set up the database with full text search and a simple prompt template engine
39 lines
741 B
Go
39 lines
741 B
Go
package main
|
|
|
|
import "testing"
|
|
|
|
func Test_BuildPrompt(t *testing.T) {
|
|
type args struct {
|
|
name string
|
|
in interface{}
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want string
|
|
wantErr bool
|
|
}{
|
|
{
|
|
name: "BuildPrompt test",
|
|
args: args{
|
|
name: "test.tmpl",
|
|
in: struct{ Name string }{Name: "test"},
|
|
},
|
|
want: "This is a test test",
|
|
wantErr: false,
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
got, err := BuildPrompt(tt.args.name, tt.args.in)
|
|
if (err != nil) != tt.wantErr {
|
|
t.Errorf("BuildPrompt() error = %v, wantErr %v", err, tt.wantErr)
|
|
return
|
|
}
|
|
if got != tt.want {
|
|
t.Errorf("BuildPrompt() got = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|