images_test.go 290 B

123456789101112131415161718192021
  1. package server
  2. import (
  3. "testing"
  4. )
  5. func TestModelPrompt(t *testing.T) {
  6. m := Model{
  7. Template: "a{{ .Prompt }}b",
  8. }
  9. s, err := m.Prompt(PromptVars{
  10. Prompt: "<h1>",
  11. })
  12. if err != nil {
  13. t.Fatal(err)
  14. }
  15. want := "a<h1>b"
  16. if s != want {
  17. t.Errorf("got %q, want %q", s, want)
  18. }
  19. }