-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
run should return nothing or error out; ignorestatus is broken.
- Loading branch information
1 parent
ba9eb0a
commit e412c69
Showing
2 changed files
with
45 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,43 @@ | ||
################################## | ||
# Cross Plaform tests for spawn. # | ||
################################## | ||
|
||
# Assumes the following are available in the | ||
# - GNU coreutils (or equivalent) | ||
# - perl | ||
|
||
#TODO: | ||
# - Windows: | ||
# - Add a test whether coreutils are available and skip tests if not | ||
|
||
#### Examples used in the manual #### | ||
|
||
show(readall(`echo hello | sort`)) | ||
@test readall(`echo hello | sort`) == "hello | sort\n" | ||
@test readall(`echo hello`|`sort`) == "hello\n" | ||
out = readall(`echo hello` & `echo world`) | ||
@test search(out,"world") != (0,0) | ||
@test search(out,"hello") != (0,0) | ||
@test readall((`echo hello` & `echo world`)|`sort`)=="hello\nworld\n" | ||
|
||
## THIS requires visual inspection | ||
@test run(`echo stdio passthrough OK`) | ||
|
||
prefixer(prefix, sleep) = `perl -nle '$|=1; print "'$prefix' ", $_; sleep '$sleep';'` | ||
@test run(`perl -le '$|=1; for(0..2){ print; sleep 1 }'` | prefixer("A",2) & prefixer("B",2)) | ||
|
||
@test run(`perl -le '$|=1; for(0..2){ print; sleep 1 }'` | | ||
prefixer("X",3) & prefixer("Y",3) & prefixer("Z",3) | | ||
prefixer("A",2) & prefixer("B",2)) | ||
|
||
@test_fails run(`false`) | ||
@test run(ignorestatus(`false`)) | ||
@test run(ignorestatus(`false`)|`true`) | ||
@test_fails run(ignorestatus(`false`)|`false`) | ||
@test_fails run(ignorestatus(`false`)&`false`) | ||
@test run(ignorestatus(`false`|`false`)) | ||
@test run(ignorestatus(`false`&`false`)) | ||
################################## | ||
# Cross Plaform tests for spawn. # | ||
################################## | ||
|
||
# Assumes the following are available in the | ||
# - GNU coreutils (or equivalent) | ||
# - perl | ||
|
||
#TODO: | ||
# - Windows: | ||
# - Add a test whether coreutils are available and skip tests if not | ||
|
||
#### Examples used in the manual #### | ||
|
||
@test readall(`echo hello | sort`) == "hello | sort\n" | ||
@test readall(`echo hello`|`sort`) == "hello\n" | ||
|
||
out = readall(`echo hello` & `echo world`) | ||
@test search(out,"world") != (0,0) | ||
@test search(out,"hello") != (0,0) | ||
@test readall((`echo hello` & `echo world`)|`sort`)=="hello\nworld\n" | ||
|
||
if false | ||
@test (run(`echo hello`); true) | ||
|
||
prefixer(prefix, sleep) = `perl -nle '$|=1; print "'$prefix' ", $_; sleep '$sleep';'` | ||
@test success(`perl -le '$|=1; for(0..2){ print; sleep 1 }'` | | ||
prefixer("A",2) & prefixer("B",2)) | ||
@test success(`perl -le '$|=1; for(0..2){ print; sleep 1 }'` | | ||
prefixer("X",3) & prefixer("Y",3) & prefixer("Z",3) | | ||
prefixer("A",2) & prefixer("B",2)) | ||
end | ||
|
||
@test success(`true`) | ||
@test !success(`false`) | ||
if false | ||
@test success(ignorestatus(`false`)) | ||
@test success(ignorestatus(`false`) | `true`) | ||
@test !success(ignorestatus(`false`) | `false`) | ||
@test !success(ignorestatus(`false`) & `false`) | ||
@test success(ignorestatus(`false` | `false`)) | ||
@test success(ignorestatus(`false` & `false`)) | ||
end |