Skip to content

Commit

Permalink
all: make remaining tests pass on Wine
Browse files Browse the repository at this point in the history
sed, cat, and diff may not be installed. Rewrite two tests to not use
the first two, and skip the third if diff is not installed.
  • Loading branch information
mvdan committed Feb 17, 2019
1 parent 9aa7c7f commit 4c51437
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/gosh/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ var interactiveTests = [][]string{
{
"echo foo |\n",
"> ",
"cat\n",
"read var; echo $var\n",
"foo\n",
},
{
Expand Down
4 changes: 4 additions & 0 deletions cmd/shfmt/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"bytes"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"regexp"
"strings"
Expand Down Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions shell/source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
},
}
Expand Down

0 comments on commit 4c51437

Please sign in to comment.