summaryrefslogtreecommitdiff
path: root/template_test.go
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2022-05-29 09:05:36 -0700
committerGitHub <noreply@github.com>2022-05-29 09:05:36 -0700
commit9ae9a6a5182342f775383646058807222947f483 (patch)
tree14914504ad80adb66cdd31c196db42c5a34b46b5 /template_test.go
parent170593638bb7cf10f5ec8309112d775059f40e02 (diff)
parent82ded80fcef1965ab5357a89d201811436b5d8d7 (diff)
Merge pull request #1409 from hairyhenderson/stop-passing-config-in-context
Stop passing the config in the context
Diffstat (limited to 'template_test.go')
-rw-r--r--template_test.go98
1 files changed, 0 insertions, 98 deletions
diff --git a/template_test.go b/template_test.go
index d28ecacd..fc730693 100644
--- a/template_test.go
+++ b/template_test.go
@@ -158,104 +158,6 @@ func TestGatherTemplates(t *testing.T) {
fs.Remove("out")
}
-// func TestProcessTemplates(t *testing.T) {
-// origfs := fs
-// defer func() { fs = origfs }()
-// fs = afero.NewMemMapFs()
-// afero.WriteFile(fs, "foo", []byte("bar"), iohelpers.NormalizeFileMode(0600))
-
-// afero.WriteFile(fs, "in/1", []byte("foo"), iohelpers.NormalizeFileMode(0644))
-// afero.WriteFile(fs, "in/2", []byte("bar"), iohelpers.NormalizeFileMode(0640))
-// afero.WriteFile(fs, "in/3", []byte("baz"), iohelpers.NormalizeFileMode(0644))
-
-// afero.WriteFile(fs, "existing", []byte(""), iohelpers.NormalizeFileMode(0644))
-
-// cfg := &config.Config{
-// Stdout: &bytes.Buffer{},
-// }
-// testdata := []struct {
-// templates []*tplate
-// contents []string
-// modes []os.FileMode
-// targets []io.Writer
-// }{
-// {},
-// {
-// templates: []*tplate{{name: "<arg>", contents: "foo", targetPath: "-", mode: 0644}},
-// contents: []string{"foo"},
-// modes: []os.FileMode{0644},
-// targets: []io.Writer{cfg.Stdout},
-// },
-// {
-// templates: []*tplate{{name: "<arg>", contents: "foo", targetPath: "out", mode: 0644}},
-// contents: []string{"foo"},
-// modes: []os.FileMode{0644},
-// },
-// {
-// templates: []*tplate{{name: "foo", targetPath: "out", mode: 0600}},
-// contents: []string{"bar"},
-// modes: []os.FileMode{0600},
-// },
-// {
-// templates: []*tplate{{name: "foo", targetPath: "out", mode: 0755}},
-// contents: []string{"bar"},
-// modes: []os.FileMode{0755},
-// },
-// {
-// templates: []*tplate{
-// {name: "in/1", targetPath: "out/1", mode: 0644},
-// {name: "in/2", targetPath: "out/2", mode: 0640},
-// {name: "in/3", targetPath: "out/3", mode: 0644},
-// },
-// contents: []string{"foo", "bar", "baz"},
-// modes: []os.FileMode{0644, 0640, 0644},
-// },
-// {
-// templates: []*tplate{
-// {name: "foo", targetPath: "existing", mode: 0755},
-// },
-// contents: []string{"bar"},
-// modes: []os.FileMode{0644},
-// },
-// {
-// templates: []*tplate{
-// {name: "foo", targetPath: "existing", mode: 0755, modeOverride: true},
-// },
-// contents: []string{"bar"},
-// modes: []os.FileMode{0755},
-// },
-// }
-// for i, in := range testdata {
-// in := in
-// t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
-// actual, err := processTemplates(cfg, in.templates)
-// assert.NoError(t, err)
-// assert.Len(t, actual, len(in.templates))
-// for i, a := range actual {
-// current := in.templates[i]
-// assert.Equal(t, in.contents[i], a.contents)
-// assert.Equal(t, current.mode, a.mode)
-// if len(in.targets) > 0 {
-// assert.Equal(t, in.targets[i], a.target)
-// }
-// if current.targetPath != "-" && current.name != "<arg>" {
-// _, err = current.loadContents(nil)
-// assert.NoError(t, err)
-
-// n, err := current.target.Write([]byte("hello world"))
-// assert.NoError(t, err)
-// assert.Equal(t, 11, n)
-
-// info, err := fs.Stat(current.targetPath)
-// assert.NoError(t, err)
-// assert.Equal(t, iohelpers.NormalizeFileMode(in.modes[i]), info.Mode())
-// }
-// }
-// fs.Remove("out")
-// })
-// }
-// }
-
func TestCreateOutFile(t *testing.T) {
origfs := fs
defer func() { fs = origfs }()