edit: pipe tests assume the availability of certain programs (echo, /bin/sh, etc.)
I use rc for a shell, and the Pipe tests fail like this, because they're using sh-specific syntax:
edit_test.go:514: ed.Do("$|echo -n stderr 1>&2\n", pr)=exit status 1, want <nil>
I'd suggest changing the shell to /bin/sh for the test (although that will still fail under windows)
This is a known problem. I'm surprised that I didn't have an issue already open for it. Thanks for opening one.
There are really two problems here:
- The tests assume a particular set of programs are available.
- We always use -c to pass commands to $SHELL, and that's not valid on Windows. I'm going to re-devote this to the first since that was the original intent.
There are various ways that we can fix the tests. For example, we can create programs that do what we want and include them in the distribution. That seems heavy-weight. It needs some thought.
sed also behaves differently on OSX:
--- FAIL: TestEditPipe (0.07s)
edit_test.go:2248: [.|sed 's/世界/World/'
]: "empty replaces" got "{.}Hello World\n{.}", want "{.}Hello World{.}"
--- FAIL: TestEditPipeFromString (0.06s)
edit_test.go:2248: [.|sed 's/世界/World/'
]: "empty replaces" got "{.}Hello World\n{.}", want "{.}Hello World{.}"
--- FAIL: TestPipeDefaultShell (0.09s)
edit_test.go:2251: print stderr: printed "-n stderr\n", want "stderr"
edit_test.go:2248: [0,$|echo -n Hello 世界
]: "empty inserts" got "{.}-n Hello 世界\n{.}", want "{.}Hello 世界{.}"
edit_test.go:2248: [.|sed 's/世界/World/'
]: "empty replaces" got "{.}Hello World\n{.}", want "{.}Hello World{.}"
That is BSD sed and Plan 9 sed behavior. Maybe just toss a \n into the input here and expect it in the output; it doesn't look important to these tests to not have a newline. (At least until a proper fix is made.)
That may be a workaround for the moment, but the underlying problem still exists. What I'd really like is to have some programs distributed with T to run for these tests. Then we will have total control.