@@ -14,7 +14,7 @@ import (
14
14
)
15
15
16
16
func TestPrepareSearchDownloadDeleteCommands (t * testing.T ) {
17
- tests := []struct {
17
+ testRuns := []struct {
18
18
name string
19
19
args []string
20
20
flags []string
@@ -27,12 +27,12 @@ func TestPrepareSearchDownloadDeleteCommands(t *testing.T) {
27
27
{"withPattern" , []string {"TestPattern" }, []string {}, "TestPattern" , "" , "" , false },
28
28
{"withBuild" , []string {}, []string {"build=buildName/buildNumber" }, "" , "buildName/buildNumber" , "" , false },
29
29
{"withBundle" , []string {}, []string {"bundle=bundleName/bundleVersion" }, "" , "" , "bundleName/bundleVersion" , false },
30
- {"withSpec" , []string {}, []string {"spec=" + getSpecPath (t , tests .SearchAllRepo1 )}, "${REPO1}/*" , "" , "" , false },
31
- {"withSpecAndPattern" , []string {"TestPattern" }, []string {"spec=" + getSpecPath (t , tests .SearchAllRepo1 )}, "" , "" , "" , true },
30
+ {"withSpec" , []string {}, []string {"spec=" + getSpecPath (tests .SearchAllRepo1 )}, "${REPO1}/*" , "" , "" , false },
31
+ {"withSpecAndPattern" , []string {"TestPattern" }, []string {"spec=" + getSpecPath (tests .SearchAllRepo1 )}, "" , "" , "" , true },
32
32
{"withBuildAndPattern" , []string {"TestPattern" }, []string {"build=buildName/buildNumber" }, "TestPattern" , "buildName/buildNumber" , "" , false },
33
33
}
34
34
35
- for _ , test := range tests {
35
+ for _ , test := range testRuns {
36
36
t .Run (test .name , func (t * testing.T ) {
37
37
context , buffer := createContext (test .flags , test .args )
38
38
funcArray := []func (c * cli.Context ) (* spec.SpecFiles , error ){
@@ -47,7 +47,7 @@ func TestPrepareSearchDownloadDeleteCommands(t *testing.T) {
47
47
}
48
48
49
49
func TestPrepareCopyMoveCommand (t * testing.T ) {
50
- tests := []struct {
50
+ testRuns := []struct {
51
51
name string
52
52
args []string
53
53
flags []string
@@ -59,13 +59,13 @@ func TestPrepareCopyMoveCommand(t *testing.T) {
59
59
}{
60
60
{"withoutArguments" , []string {}, []string {}, "" , "" , "" , "" , true },
61
61
{"withPatternAndTarget" , []string {"TestPattern" , "TestTarget" }, []string {}, "TestPattern" , "TestTarget" , "" , "" , false },
62
- {"withSpec" , []string {}, []string {"spec=" + getSpecPath (t , tests .CopyItemsSpec )}, "${REPO1}/*/" , "${REPO2}/" , "" , "" , false },
63
- {"withSpecAndPattern" , []string {"TestPattern" }, []string {"spec=" + getSpecPath (t , tests .CopyItemsSpec )}, "" , "" , "" , "" , true },
62
+ {"withSpec" , []string {}, []string {"spec=" + getSpecPath (tests .CopyItemsSpec )}, "${REPO1}/*/" , "${REPO2}/" , "" , "" , false },
63
+ {"withSpecAndPattern" , []string {"TestPattern" }, []string {"spec=" + getSpecPath (tests .CopyItemsSpec )}, "" , "" , "" , "" , true },
64
64
{"withPatternTargetAndBuild" , []string {"TestPattern" , "TestTarget" }, []string {"build=buildName/buildNumber" }, "TestPattern" , "" , "buildName/buildNumber" , "" , false },
65
65
{"withPatternTargetAndBundle" , []string {"TestPattern" , "TestTarget" }, []string {"bundle=bundleName/bundleVersion" }, "TestPattern" , "" , "" , "bundleName/bundleVersion" , false },
66
66
}
67
67
68
- for _ , test := range tests {
68
+ for _ , test := range testRuns {
69
69
t .Run (test .name , func (t * testing.T ) {
70
70
context , buffer := createContext (test .flags , test .args )
71
71
specFiles , err := prepareCopyMoveCommand (context )
@@ -75,7 +75,7 @@ func TestPrepareCopyMoveCommand(t *testing.T) {
75
75
}
76
76
77
77
func TestPreparePropsCmd (t * testing.T ) {
78
- tests := []struct {
78
+ testRuns := []struct {
79
79
name string
80
80
args []string
81
81
flags []string
@@ -89,12 +89,12 @@ func TestPreparePropsCmd(t *testing.T) {
89
89
{"withPattern" , []string {"TestPattern" , "key1=val1" }, []string {}, "key1=val1" , "TestPattern" , "" , "" , false },
90
90
{"withBuild" , []string {"key1=val1" }, []string {"build=buildName/buildNumber" }, "key1=val1" , "*" , "buildName/buildNumber" , "" , false },
91
91
{"withBundle" , []string {"key1=val1" }, []string {"bundle=bundleName/bundleVersion" }, "key1=val1" , "*" , "" , "bundleName/bundleVersion" , false },
92
- {"withSpec" , []string {"key1=val1" }, []string {"spec=" + getSpecPath (t , tests .SetDeletePropsSpec )}, "key1=val1" , "${REPO1}/" , "" , "" , false },
93
- {"withSpecAndPattern" , []string {"TestPattern" , "key1=val1" }, []string {"spec=" + getSpecPath (t , tests .SetDeletePropsSpec )}, "key1=val1" , "" , "" , "" , true },
92
+ {"withSpec" , []string {"key1=val1" }, []string {"spec=" + getSpecPath (tests .SetDeletePropsSpec )}, "key1=val1" , "${REPO1}/" , "" , "" , false },
93
+ {"withSpecAndPattern" , []string {"TestPattern" , "key1=val1" }, []string {"spec=" + getSpecPath (tests .SetDeletePropsSpec )}, "key1=val1" , "" , "" , "" , true },
94
94
{"withPatternAndBuild" , []string {"TestPattern" , "key1=val1" }, []string {"build=buildName/buildNumber" }, "key1=val1" , "TestPattern" , "buildName/buildNumber" , "" , false },
95
95
}
96
96
97
- for _ , test := range tests {
97
+ for _ , test := range testRuns {
98
98
t .Run (test .name , func (t * testing.T ) {
99
99
context , buffer := createContext (test .flags , test .args )
100
100
propsCommand , err := preparePropsCmd (context )
@@ -126,7 +126,7 @@ func createContext(testFlags, testArgs []string) (*cli.Context, *bytes.Buffer) {
126
126
return cli .NewContext (app , flagSet , nil ), & bytes.Buffer {}
127
127
}
128
128
129
- func getSpecPath (t * testing. T , spec string ) string {
129
+ func getSpecPath (spec string ) string {
130
130
return filepath .Join (".." , "testdata" , "filespecs" , spec )
131
131
}
132
132
0 commit comments