summaryrefslogtreecommitdiff
path: root/internal/testutil/fixtures_test.go
blob: 4f6b3651bce2bd41a81696160a9247a4079286fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package testutil

import (
	"strings"
	"testing"
)

func TestFixtures_ZeroCovTargets(t *testing.T) {
	if MarkdownCodeFence() == "" {
		t.Fatal("MarkdownCodeFence empty")
	}
	if MalformedJSON() == "" {
		t.Fatal("MalformedJSON empty")
	}
}

func TestMultilineDocBlock(t *testing.T) {
	got := MultilineDocBlock()
	if !strings.Contains(got, "\n") {
		t.Fatal("expected multi-line string")
	}
	if !strings.HasPrefix(got, "//") {
		t.Fatal("expected comment prefix")
	}
	if !strings.Contains(got, "sum") {
		t.Fatal("expected documentation about sum")
	}
}

func TestMultilineChatReply(t *testing.T) {
	got := MultilineChatReply()
	if !strings.Contains(got, "\n") {
		t.Fatal("expected multi-line string")
	}
	if !strings.Contains(got, "Hello") {
		t.Fatal("expected greeting in reply")
	}
}

func TestMultilineFunctionSuggestion(t *testing.T) {
	got := MultilineFunctionSuggestion()
	if !strings.Contains(got, "\n") {
		t.Fatal("expected multi-line string")
	}
	if !strings.Contains(got, "context.Context") {
		t.Fatal("expected context parameter")
	}
	if !strings.Contains(got, "return") {
		t.Fatal("expected return statement")
	}
}