mirror of
https://github.com/uselessd/alcove.git
synced 2026-04-15 09:15:19 +00:00
test: use a match for stderr
The stderr test on linux can return either <<"nonexistent: not found\n">> or: <<"sh: ">> Probably the shell is using 2 writes to produce the error message, which may or may not be buffered into one read. Use a pattern match to avoid the test failing. Add a separate test for freebsd (untested).
This commit is contained in:
@@ -271,10 +271,17 @@ stdout({_, Port, Child}) ->
|
||||
?_assertEqual(<<"0123456789\n">>, Stdout)
|
||||
].
|
||||
|
||||
stderr({_, Port, Child}) ->
|
||||
stderr({{unix,linux}, Port, Child}) ->
|
||||
Reply = alcove:stdin(Port, [Child], "nonexistent 0123456789\n"),
|
||||
Stderr = alcove:stderr(Port, [Child], 5000),
|
||||
[
|
||||
?_assertEqual(true, Reply),
|
||||
?_assertEqual(<<"sh: nonexistent: not found\n">>, Stderr)
|
||||
?_assertMatch(<<"sh: ", _/binary>>, Stderr)
|
||||
];
|
||||
stderr({{unix,freebsd}, Port, Child}) ->
|
||||
Reply = alcove:stdin(Port, [Child], "nonexistent 0123456789\n"),
|
||||
Stderr = alcove:stderr(Port, [Child], 5000),
|
||||
[
|
||||
?_assertEqual(true, Reply),
|
||||
?_assertEqual(<<"nonexistent: not found\n">>, Stderr)
|
||||
].
|
||||
|
||||
Reference in New Issue
Block a user