@@ -117,49 +117,16 @@ func TestReadConfByName(t *testing.T) {
117
117
}
118
118
119
119
func TestConfPreprocess (t * testing.T ) {
120
- tests := []struct {
121
- name string
122
- space bool
123
- suffix string
124
- }{
125
- {
126
- name : "no spaces" ,
127
- space : false ,
128
- suffix : "/_testdata/toml/tmp/main\" " ,
129
- },
130
- {
131
- name : "with spaces" ,
132
- space : true ,
133
- suffix : "/_testdata/toml/tmp space/main\" " ,
134
- },
120
+ t .Setenv (airWd , "_testdata/toml" )
121
+ df := defaultConfig ()
122
+ err := df .preprocess ()
123
+ if err != nil {
124
+ t .Fatalf ("preprocess error %v" , err )
135
125
}
136
-
137
- for _ , tt := range tests {
138
-
139
- oWD , err := os .Getwd ()
140
- if err != nil {
141
- t .Fatalf ("failed to get currWD: %v" , err )
142
- }
143
-
144
- t .Setenv (airWd , "_testdata/toml" )
145
- df := defaultConfig ()
146
- if tt .space {
147
- df .Build .Bin = "./tmp space/main"
148
- }
149
- err = df .preprocess ()
150
- if err != nil {
151
- t .Fatalf ("%s: preprocess error %v" , tt .name , err )
152
- }
153
-
154
- binPath := df .Build .Bin
155
- if ! strings .HasSuffix (binPath , tt .suffix ) {
156
- t .Fatalf ("%s: bin path is %s, but not have suffix %s." , tt .name , binPath , tt .suffix )
157
- }
158
-
159
- err = os .Chdir (oWD )
160
- if err != nil {
161
- t .Fatalf ("failed to change back to original WD: %v" , err )
162
- }
126
+ suffix := "/_testdata/toml/tmp/main"
127
+ binPath := df .Build .Bin
128
+ if ! strings .HasSuffix (binPath , suffix ) {
129
+ t .Fatalf ("bin path is %s, but not have suffix %s." , binPath , suffix )
163
130
}
164
131
}
165
132
0 commit comments