diff --git a/cmd/gosh/main_test.go b/cmd/gosh/main_test.go index 66f1db166..d151df424 100644 --- a/cmd/gosh/main_test.go +++ b/cmd/gosh/main_test.go @@ -81,7 +81,7 @@ var interactiveTests = [][]string{ { "echo foo |\n", "> ", - "cat\n", + "read var; echo $var\n", "foo\n", }, { diff --git a/cmd/shfmt/main_test.go b/cmd/shfmt/main_test.go index 108b05e8c..4d76ac04b 100644 --- a/cmd/shfmt/main_test.go +++ b/cmd/shfmt/main_test.go @@ -8,6 +8,7 @@ import ( "bytes" "io/ioutil" "os" + "os/exec" "path/filepath" "regexp" "strings" @@ -49,6 +50,9 @@ func TestStdin(t *testing.T) { }) t.Run("Diff", func(t *testing.T) { + if _, err := exec.LookPath("diff"); err != nil { + t.Skip("skipping as the diff tool is not available") + } *diff = true defer func() { *diff = false }() in = strings.NewReader(" foo\nbar\n\n") diff --git a/shell/source_test.go b/shell/source_test.go index befb1aeec..cc4ae7e91 100644 --- a/shell/source_test.go +++ b/shell/source_test.go @@ -37,9 +37,9 @@ var mapTests = []struct { }, }, { - "a=$(echo foo | sed 's/o/a/g')", + "a=$(echo foo && echo bar)", map[string]expand.Variable{ - "a": {Kind: expand.String, Str: "faa"}, + "a": {Kind: expand.String, Str: "foo\nbar"}, }, }, }