first commit
This commit is contained in:
23
test/templateBuilder_test.go
Normal file
23
test/templateBuilder_test.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
templatebuilder "gitea.tecamino.com/paadi/template-builder.git"
|
||||
)
|
||||
|
||||
type Inventory struct {
|
||||
Material string
|
||||
Count uint
|
||||
}
|
||||
|
||||
func TestTemplateBuilder(t *testing.T) {
|
||||
|
||||
sweaters := Inventory{"wool", 17}
|
||||
t.Log("start test")
|
||||
tmplBuilder := templatebuilder.NewTemplateBuilder()
|
||||
err := tmplBuilder.Generate("test.tmpl", "test.txt", sweaters)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
2
test/test.tmpl
Normal file
2
test/test.tmpl
Normal file
@@ -0,0 +1,2 @@
|
||||
Material: {{.Material}}
|
||||
Count: {{.Count}}
|
||||
2
test/test.txt
Normal file
2
test/test.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
Material: wool
|
||||
Count: 17
|
||||
Reference in New Issue
Block a user