You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
529 B
24 lines
529 B
2 years ago
|
package engine_test
|
||
|
|
||
|
import (
|
||
|
"bytes"
|
||
|
"context"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/require"
|
||
|
"gitoa.ru/go-4devs/templating/gohtml/engine"
|
||
|
"gitoa.ru/go-4devs/templating/loader"
|
||
|
)
|
||
|
|
||
|
func TestParser(t *testing.T) {
|
||
|
t.Parallel()
|
||
|
|
||
|
ctx := context.Background()
|
||
|
buff := bytes.Buffer{}
|
||
|
|
||
|
tpl, err := engine.Parser(loader.NewSource(t.Name(), `engine:{{.name}}`))
|
||
|
require.NoError(t, err)
|
||
|
require.NoError(t, tpl.Execute(ctx, &buff, map[string]string{"name": "gohtml"}, nil))
|
||
|
require.Equal(t, "engine:gohtml", buff.String())
|
||
|
}
|