initial commit
set up the database with full text search and a simple prompt template engine
This commit is contained in:
38
main_test.go
Normal file
38
main_test.go
Normal file
@ -0,0 +1,38 @@
|
||||
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)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user