summaryrefslogtreecommitdiff
path: root/config_test.go
blob: 0ddefc3e84dba6291e6f708aaba02639c7cc2688 (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
package gomplate

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestConfigString(t *testing.T) {
	c := &Config{}

	expected := `input: -
output: -`
	assert.Equal(t, expected, c.String())

	c = &Config{
		LDelim:      "L",
		RDelim:      "R",
		Input:       "foo",
		OutputFiles: []string{"-"},
		Templates:   []string{"foo=foo.t", "bar=bar.t"},
	}
	expected = `input: <arg>
output: -
left_delim: L
right_delim: R
templates: foo=foo.t, bar=bar.t`

	assert.Equal(t, expected, c.String())

	c = &Config{
		InputDir:  "in/",
		OutputDir: "out/",
	}
	expected = `input: in/
output: out/`

	assert.Equal(t, expected, c.String())

	c = &Config{
		InputDir:  "in/",
		OutputMap: "{{ .in }}",
	}
	expected = `input: in/
output: {{ .in }}`

	assert.Equal(t, expected, c.String())
}