diff options
| author | Zealic <zealic@gmail.com> | 2019-02-03 01:01:36 +0800 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2019-02-02 12:01:36 -0500 |
| commit | d1873444c90e68b5e8ba7492fb83abd36d7ab0ea (patch) | |
| tree | 49fee8234e7793aa8ecd82dd0f8248988f7a9cf8 /template_test.go | |
| parent | 462c8fde7cd829d80ccfb379c015dd7c463adc68 (diff) | |
Add .gomplateignore support (#225)
* Add .gomplateignore support
* + Added xignore dependency.
* Fix gometalinter problem : gocyclo and unconvert
* Use xignore to support .gomplateignore.
* Adding intgegration tests for .gomplateignore
* Use AfterPatterns to replace default exclude option implement.
* * Fix lint issue.
* * Fix unittest issue.
* * Clean test files.
* Update docs/content/usage.md
Co-Authored-By: zealic <zealic@gmail.com>
* Use minor range version for xignore.
* Unexport .gomplateignore const.
Diffstat (limited to 'template_test.go')
| -rw-r--r-- | template_test.go | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/template_test.go b/template_test.go index fb71ecea..24436589 100644 --- a/template_test.go +++ b/template_test.go @@ -60,36 +60,6 @@ func TestOpenOutFile(t *testing.T) { assert.Equal(t, Stdout, f) } -func TestInList(t *testing.T) { - list := []string{} - assert.False(t, inList(list, "")) - - list = nil - assert.False(t, inList(list, "")) - - list = []string{"foo", "baz", "qux"} - assert.False(t, inList(list, "bar")) - - list = []string{"foo", "bar", "baz"} - assert.True(t, inList(list, "bar")) -} - -func TestExecuteCombinedGlob(t *testing.T) { - origfs := fs - defer func() { fs = origfs }() - fs = afero.NewMemMapFs() - _ = fs.MkdirAll("/tmp/one", 0777) - _ = fs.MkdirAll("/tmp/two", 0777) - _ = fs.MkdirAll("/tmp/three", 0777) - afero.WriteFile(fs, "/tmp/one/a", []byte("file a"), 0644) - afero.WriteFile(fs, "/tmp/two/b", []byte("file b"), 0644) - afero.WriteFile(fs, "/tmp/three/c", []byte("file c"), 0644) - - excludes, err := executeCombinedGlob([]string{"/tmp/o*/*", "/*/*/b"}) - assert.NoError(t, err) - assert.Equal(t, []string{"/tmp/one/a", "/tmp/two/b"}, excludes) -} - func TestWalkDir(t *testing.T) { origfs := fs defer func() { fs = origfs }() @@ -104,7 +74,7 @@ func TestWalkDir(t *testing.T) { afero.WriteFile(fs, "/indir/one/bar", []byte("bar"), 0644) afero.WriteFile(fs, "/indir/two/baz", []byte("baz"), 0644) - templates, err := walkDir("/indir", "/outdir", []string{"/*/two"}, 0, false) + templates, err := walkDir("/indir", "/outdir", []string{"*/two"}, 0, false) assert.NoError(t, err) assert.Equal(t, 2, len(templates)) |
