File: template_test.go

package info (click to toggle)
golang-github-francoispqt-gojay 1.2.13-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 1,456 kB
  • sloc: makefile: 86
file content (19 lines) | stat: -rw-r--r-- 390 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package codegen

import (
	"github.com/stretchr/testify/assert"
	"testing"
)

func Test_ExpandTemplate(t *testing.T) {
	var dictionary = map[int]string{
		1: `type {{.TypeName}} {{.SourceTypeName}}`,
	}
	expaded, err := expandTemplate("test", dictionary, 1, struct {
		TypeName       string
		SourceTypeName string
	}{"A", "B"})

	assert.Nil(t, err)
	assert.Equal(t, "type A B", expaded)
}