aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zip2zip/zip2zip_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/zip2zip/zip2zip_test.go')
-rw-r--r--cmd/zip2zip/zip2zip_test.go30
1 files changed, 28 insertions, 2 deletions
diff --git a/cmd/zip2zip/zip2zip_test.go b/cmd/zip2zip/zip2zip_test.go
index e032fe69..ae164944 100644
--- a/cmd/zip2zip/zip2zip_test.go
+++ b/cmd/zip2zip/zip2zip_test.go
@@ -31,6 +31,7 @@ var testCases = []struct {
sortJava bool
args []string
excludes []string
+ includes []string
uncompresses []string
outputFiles []string
@@ -228,7 +229,7 @@ var testCases = []struct {
},
},
{
- name: "excludes with include",
+ name: "excludes with args",
inputFiles: []string{
"a/a",
@@ -242,6 +243,31 @@ var testCases = []struct {
},
},
{
+ name: "excludes over args",
+
+ inputFiles: []string{
+ "a/a",
+ "a/b",
+ },
+ args: []string{"a/a"},
+ excludes: []string{"a/*"},
+
+ outputFiles: nil,
+ },
+ {
+ name: "excludes with includes",
+
+ inputFiles: []string{
+ "a/a",
+ "a/b",
+ },
+ args: nil,
+ excludes: []string{"a/*"},
+ includes: []string{"a/b"},
+
+ outputFiles: []string{"a/b"},
+ },
+ {
name: "excludes with glob",
inputFiles: []string{
@@ -358,7 +384,7 @@ func TestZip2Zip(t *testing.T) {
outputWriter := zip.NewWriter(outputBuf)
err = zip2zip(inputReader, outputWriter, testCase.sortGlobs, testCase.sortJava, false,
- testCase.args, testCase.excludes, testCase.uncompresses)
+ testCase.args, testCase.excludes, testCase.includes, testCase.uncompresses)
if errorString(testCase.err) != errorString(err) {
t.Fatalf("Unexpected error:\n got: %q\nwant: %q", errorString(err), errorString(testCase.err))
}