(t *testing.T)
| 281 | } |
| 282 | |
| 283 | func TestExecutableJar(t *testing.T) { |
| 284 | execManifest := []byte("Main-Class: com.example.Main") |
| 285 | plainManifest := []byte("Color: blue") |
| 286 | testCases := []struct { |
| 287 | name string |
| 288 | buildable string |
| 289 | jars map[string][]byte // map[rel_path]manifest_content |
| 290 | want string |
| 291 | wantErr bool |
| 292 | }{ |
| 293 | { |
| 294 | name: "no_jars", |
| 295 | wantErr: true, |
| 296 | }, |
| 297 | { |
| 298 | name: "one_exec_jar_target", |
| 299 | jars: map[string][]byte{ |
| 300 | "target/exec.jar": execManifest, |
| 301 | }, |
| 302 | want: "target/exec.jar", |
| 303 | }, |
| 304 | { |
| 305 | name: "one_exec_jar_build_libs", |
| 306 | jars: map[string][]byte{ |
| 307 | "build/libs/exec.jar": execManifest, |
| 308 | }, |
| 309 | want: "build/libs/exec.jar", |
| 310 | }, |
| 311 | { |
| 312 | name: "two_exec_jar_target", |
| 313 | jars: map[string][]byte{ |
| 314 | "target/exec1.jar": execManifest, |
| 315 | "target/exec2.jar": execManifest, |
| 316 | }, |
| 317 | wantErr: true, |
| 318 | }, |
| 319 | { |
| 320 | name: "buildable_jar_in_buildable_target", |
| 321 | buildable: "app", |
| 322 | jars: map[string][]byte{ |
| 323 | "app/target/exec.jar": execManifest, |
| 324 | }, |
| 325 | want: "app/target/exec.jar", |
| 326 | }, |
| 327 | { |
| 328 | name: "buildable_jar_in_buildable", |
| 329 | buildable: "app", |
| 330 | jars: map[string][]byte{ |
| 331 | "app/exec.jar": execManifest, |
| 332 | }, |
| 333 | want: "app/exec.jar", |
| 334 | }, |
| 335 | { |
| 336 | name: "buildable_jar_in_target", |
| 337 | buildable: "app", |
| 338 | jars: map[string][]byte{ |
| 339 | "target/exec.jar": execManifest, |
| 340 | }, |
nothing calls this directly
no test coverage detected