(t *testing.T)
| 1825 | } |
| 1826 | |
| 1827 | func TestWhenDirAttributeAndDirExistsItRunsInThatDir(t *testing.T) { |
| 1828 | t.Parallel() |
| 1829 | |
| 1830 | const expected = "exists" |
| 1831 | const dir = "testdata/dir/explicit_exists" |
| 1832 | var out bytes.Buffer |
| 1833 | e := task.NewExecutor( |
| 1834 | task.WithDir(dir), |
| 1835 | task.WithStdout(&out), |
| 1836 | task.WithStderr(&out), |
| 1837 | ) |
| 1838 | |
| 1839 | require.NoError(t, e.Setup()) |
| 1840 | require.NoError(t, e.Run(t.Context(), &task.Call{Task: "whereami"})) |
| 1841 | |
| 1842 | // Normalize path separators for cross-platform compatibility (Windows uses backslashes) |
| 1843 | normalized := normalizePathSeparators(out.String()) |
| 1844 | got := strings.TrimSuffix(filepath.Base(normalized), "\n") |
| 1845 | assert.Equal(t, expected, got, "Mismatch in the working directory") |
| 1846 | } |
| 1847 | |
| 1848 | func TestWhenDirAttributeItCreatesMissingAndRunsInThatDir(t *testing.T) { |
| 1849 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…