summaryrefslogtreecommitdiff
path: root/subplotlib
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2021-10-08 20:58:22 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2021-10-13 19:43:07 +0100
commitbcf9975fa19050e07d6724992a75ebde4b0156c5 (patch)
treeb7d0aab488686df7243ee4d999593a2409c624f7 /subplotlib
parent630c7ffc4605f7c166d4e86d4147f9e3747e8cbd (diff)
downloadsubplot-bcf9975fa19050e07d6724992a75ebde4b0156c5.tar.gz
tests: Fix up use of absolute paths for false/true/echo etc.
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'subplotlib')
-rw-r--r--subplotlib/runcmd.md24
-rw-r--r--subplotlib/tests/runcmd.rs40
2 files changed, 32 insertions, 32 deletions
diff --git a/subplotlib/runcmd.md b/subplotlib/runcmd.md
index d6210fb..50e41f6 100644
--- a/subplotlib/runcmd.md
+++ b/subplotlib/runcmd.md
@@ -22,8 +22,8 @@ they're verified. It uses the steps and functions from the
command, then examine the exit code, standard output (stdout for
short), or standard error output (stderr) of the command.
-The scenarios use the Unix commands `/bin/true` and `/bin/false` to
-generate exit codes, and `/bin/echo` to produce stdout. To generate
+The scenarios use the Unix commands `true` and `false` to
+generate exit codes, and `echo` to produce stdout. To generate
stderr, they use the little helper script below.
```{#err.sh .file .sh .numberLines}
@@ -40,7 +40,7 @@ variations.
## Successful execution
```scenario
-when I run /bin/true
+when I run true
then exit code is 0
and command is successful
```
@@ -49,7 +49,7 @@ and command is successful
```scenario
given a directory xyzzy
-when I run, in xyzzy, /bin/pwd
+when I run, in xyzzy, pwd
then exit code is 0
then command is successful
then stdout contains "/xyzzy"
@@ -58,7 +58,7 @@ then stdout contains "/xyzzy"
## Failed execution
```scenario
-when I try to run /bin/false
+when I try to run false
then exit code is not 0
and command fails
```
@@ -67,7 +67,7 @@ and command fails
```scenario
given a directory xyzzy
-when I try to run, in xyzzy, /bin/false
+when I try to run, in xyzzy, false
then exit code is not 0
and command fails
```
@@ -84,7 +84,7 @@ to the reader what's inside. Also, C-style string escapes are
understood.
```scenario
-when I run /bin/echo hello, world
+when I run echo hello, world
then stdout is exactly "hello, world\n"
```
@@ -102,7 +102,7 @@ Exact string comparisons are not always enough, so we can verify a
sub-string is in output.
```scenario
-when I run /bin/echo hello, world
+when I run echo hello, world
then stdout contains "world\n"
and exit code is 0
```
@@ -122,7 +122,7 @@ regular expression. Note that the regular expression is not delimited
and does not get any C-style string escaped decoded.
```scenario
-when I run /bin/echo hello, world
+when I run echo hello, world
then stdout matches regex world$
```
@@ -142,7 +142,7 @@ have something we want to avoid.
## Check stdout is not exactly something
```scenario
-when I run /bin/echo hi
+when I run echo hi
then stdout isn't exactly "hello, world\n"
```
@@ -157,7 +157,7 @@ then stderr isn't exactly "hello, world\n"
## Check stdout doesn't contain sub-string
```scenario
-when I run /bin/echo hi
+when I run echo hi
then stdout doesn't contain "world"
```
@@ -172,7 +172,7 @@ then stderr doesn't contain "world"
## Check stdout doesn't match regular expression
```scenario
-when I run /bin/echo hi
+when I run echo hi
then stdout doesn't match regex world$
```
diff --git a/subplotlib/tests/runcmd.rs b/subplotlib/tests/runcmd.rs
index f18f463..0c677ba 100644
--- a/subplotlib/tests/runcmd.rs
+++ b/subplotlib/tests/runcmd.rs
@@ -18,8 +18,8 @@ fn successful_execution() {
let step = subplotlib::steplibrary::runcmd::run::Builder::default()
.argv0(
- // "/bin/true"
- &base64_decode("L2Jpbi90cnVl"),
+ // "true"
+ &base64_decode("dHJ1ZQ=="),
)
.args(
// ""
@@ -62,8 +62,8 @@ fn successful_execution_in_a_sub_directory() {
&base64_decode("eHl6enk="),
)
.argv0(
- // "/bin/pwd"
- &base64_decode("L2Jpbi9wd2Q="),
+ // "pwd"
+ &base64_decode("cHdk"),
)
.args(
// ""
@@ -100,8 +100,8 @@ fn failed_execution() {
let step = subplotlib::steplibrary::runcmd::try_to_run::Builder::default()
.argv0(
- // "/bin/false"
- &base64_decode("L2Jpbi9mYWxzZQ=="),
+ // "false"
+ &base64_decode("ZmFsc2U="),
)
.args(
// ""
@@ -144,8 +144,8 @@ fn failed_execution_in_a_sub_directory() {
&base64_decode("eHl6enk="),
)
.argv0(
- // "/bin/false"
- &base64_decode("L2Jpbi9mYWxzZQ=="),
+ // "false"
+ &base64_decode("ZmFsc2U="),
)
.args(
// ""
@@ -176,8 +176,8 @@ fn check_stdout_is_exactly_as_wanted() {
let step = subplotlib::steplibrary::runcmd::run::Builder::default()
.argv0(
- // "/bin/echo"
- &base64_decode("L2Jpbi9lY2hv"),
+ // "echo"
+ &base64_decode("ZWNobw=="),
)
.args(
// " hello, world"
@@ -254,8 +254,8 @@ fn check_stdout_using_sub_string_search() {
let step = subplotlib::steplibrary::runcmd::run::Builder::default()
.argv0(
- // "/bin/echo"
- &base64_decode("L2Jpbi9lY2hv"),
+ // "echo"
+ &base64_decode("ZWNobw=="),
)
.args(
// " hello, world"
@@ -337,8 +337,8 @@ fn check_stdout_using_regular_expressions() {
let step = subplotlib::steplibrary::runcmd::run::Builder::default()
.argv0(
- // "/bin/echo"
- &base64_decode("L2Jpbi9lY2hv"),
+ // "echo"
+ &base64_decode("ZWNobw=="),
)
.args(
// " hello, world"
@@ -415,8 +415,8 @@ fn check_stdout_is_not_exactly_something() {
let step = subplotlib::steplibrary::runcmd::run::Builder::default()
.argv0(
- // "/bin/echo"
- &base64_decode("L2Jpbi9lY2hv"),
+ // "echo"
+ &base64_decode("ZWNobw=="),
)
.args(
// " hi"
@@ -493,8 +493,8 @@ fn check_stdout_doesn_t_contain_sub_string() {
let step = subplotlib::steplibrary::runcmd::run::Builder::default()
.argv0(
- // "/bin/echo"
- &base64_decode("L2Jpbi9lY2hv"),
+ // "echo"
+ &base64_decode("ZWNobw=="),
)
.args(
// " hi"
@@ -571,8 +571,8 @@ fn check_stdout_doesn_t_match_regular_expression() {
let step = subplotlib::steplibrary::runcmd::run::Builder::default()
.argv0(
- // "/bin/echo"
- &base64_decode("L2Jpbi9lY2hv"),
+ // "echo"
+ &base64_decode("ZWNobw=="),
)
.args(
// " hi"