(t *testing.T)
| 2475 | } |
| 2476 | |
| 2477 | func TestErrorCode(t *testing.T) { |
| 2478 | t.Parallel() |
| 2479 | |
| 2480 | const dir = "testdata/error_code" |
| 2481 | tests := []struct { |
| 2482 | name string |
| 2483 | task string |
| 2484 | expected int |
| 2485 | }{ |
| 2486 | { |
| 2487 | name: "direct task", |
| 2488 | task: "direct", |
| 2489 | expected: 42, |
| 2490 | }, { |
| 2491 | name: "indirect task", |
| 2492 | task: "indirect", |
| 2493 | expected: 42, |
| 2494 | }, |
| 2495 | } |
| 2496 | |
| 2497 | for _, test := range tests { |
| 2498 | t.Run(test.name, func(t *testing.T) { |
| 2499 | t.Parallel() |
| 2500 | |
| 2501 | var buff bytes.Buffer |
| 2502 | e := task.NewExecutor( |
| 2503 | task.WithDir(dir), |
| 2504 | task.WithStdout(&buff), |
| 2505 | task.WithStderr(&buff), |
| 2506 | task.WithSilent(true), |
| 2507 | ) |
| 2508 | require.NoError(t, e.Setup()) |
| 2509 | |
| 2510 | err := e.Run(t.Context(), &task.Call{Task: test.task}) |
| 2511 | require.Error(t, err) |
| 2512 | taskRunErr, ok := err.(*errors.TaskRunError) |
| 2513 | assert.True(t, ok, "cannot cast returned error to *task.TaskRunError") |
| 2514 | assert.Equal(t, test.expected, taskRunErr.TaskExitCode(), "unexpected exit code from task") |
| 2515 | }) |
| 2516 | } |
| 2517 | } |
| 2518 | |
| 2519 | func TestEvaluateSymlinksInPaths(t *testing.T) { // nolint:paralleltest // cannot run in parallel |
| 2520 | const dir = "testdata/evaluate_symlinks_in_paths" |
nothing calls this directly
no test coverage detected
searching dependent graphs…