(t *testing.T)
| 302 | } |
| 303 | |
| 304 | func TestGetScriptCommand(t *testing.T) { |
| 305 | testCases := []struct { |
| 306 | name string |
| 307 | files map[string]string |
| 308 | want []string |
| 309 | wantErr bool |
| 310 | }{ |
| 311 | { |
| 312 | name: "poetry_single_script_found", |
| 313 | files: map[string]string{ |
| 314 | "pyproject.toml": ` |
| 315 | [tool.poetry.scripts] |
| 316 | start_app = "my_app.main:run" |
| 317 | `, |
| 318 | }, |
| 319 | want: []string{"start_app"}, |
| 320 | wantErr: false, |
| 321 | }, |
| 322 | { |
| 323 | name: "poetry_multiple_scripts_returns_start", |
| 324 | files: map[string]string{ |
| 325 | "pyproject.toml": ` |
| 326 | [tool.poetry.scripts] |
| 327 | dev = "my_app.dev:run" |
| 328 | start = "my_app.main:run" |
| 329 | lint = "my_app.lint:run" |
| 330 | `, |
| 331 | }, |
| 332 | want: []string{"start"}, |
| 333 | wantErr: false, |
| 334 | }, |
| 335 | { |
| 336 | name: "poetry_multiple_scripts_no_start_returns_nil", |
| 337 | files: map[string]string{ |
| 338 | "pyproject.toml": ` |
| 339 | [tool.poetry.scripts] |
| 340 | dev = "my_app.dev:run" |
| 341 | lint = "my_app.lint:run" |
| 342 | `, |
| 343 | }, |
| 344 | want: nil, |
| 345 | wantErr: false, |
| 346 | }, |
| 347 | { |
| 348 | name: "project_single_script_found", |
| 349 | files: map[string]string{ |
| 350 | "pyproject.toml": ` |
| 351 | [project.scripts] |
| 352 | start_now = "my_app.main:run" |
| 353 | `, |
| 354 | }, |
| 355 | want: []string{"start_now"}, |
| 356 | wantErr: false, |
| 357 | }, |
| 358 | { |
| 359 | name: "project_multiple_scripts_returns_start", |
| 360 | files: map[string]string{ |
| 361 | "pyproject.toml": ` |
nothing calls this directly
no test coverage detected