learnlytics-go/templ/generator/test-switch/render_test.go

25 lines
405 B
Go
Raw Permalink Normal View History

2025-03-20 12:35:13 +01:00
package testswitch
import (
"context"
"strings"
"testing"
"github.com/google/go-cmp/cmp"
)
var input = "a"
const expected = `it was 'a'`
func TestRender(t *testing.T) {
w := new(strings.Builder)
err := render(input).Render(context.Background(), w)
if err != nil {
t.Errorf("failed to render: %v", err)
}
if diff := cmp.Diff(expected, w.String()); diff != "" {
t.Error(diff)
}
}