(t *testing.T)
| 1848 | } |
| 1849 | |
| 1850 | func TestWithEnv_SetsGivenVariablesForSubsequentExec(t *testing.T) { |
| 1851 | t.Parallel() |
| 1852 | env := []string{"ENV1=test1", "ENV2=test2"} |
| 1853 | got, err := script.NewPipe().WithEnv(env).Exec("sh -c 'echo ENV1=$ENV1 ENV2=$ENV2'").String() |
| 1854 | if err != nil { |
| 1855 | t.Fatal(err) |
| 1856 | } |
| 1857 | want := "ENV1=test1 ENV2=test2\n" |
| 1858 | if got != want { |
| 1859 | t.Errorf("want %q, got %q", want, got) |
| 1860 | } |
| 1861 | } |
| 1862 | |
| 1863 | func TestErrorReturnsErrorSetByPreviousPipeStage(t *testing.T) { |
| 1864 | t.Parallel() |