github.com/hairyhenderson/gomplate/v3@v3.11.7/config_test.go (about) 1 package gomplate 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func TestConfigString(t *testing.T) { 10 c := &Config{} 11 12 expected := `input: - 13 output: -` 14 assert.Equal(t, expected, c.String()) 15 16 c = &Config{ 17 LDelim: "L", 18 RDelim: "R", 19 Input: "foo", 20 OutputFiles: []string{"-"}, 21 Templates: []string{"foo=foo.t", "bar=bar.t"}, 22 } 23 expected = `input: <arg> 24 output: - 25 left_delim: L 26 right_delim: R 27 templates: foo=foo.t, bar=bar.t` 28 29 assert.Equal(t, expected, c.String()) 30 31 c = &Config{ 32 InputDir: "in/", 33 OutputDir: "out/", 34 } 35 expected = `input: in/ 36 output: out/` 37 38 assert.Equal(t, expected, c.String()) 39 40 c = &Config{ 41 InputDir: "in/", 42 OutputMap: "{{ .in }}", 43 } 44 expected = `input: in/ 45 output: {{ .in }}` 46 47 assert.Equal(t, expected, c.String()) 48 }