summaryrefslogtreecommitdiff
path: root/subplotlib
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2021-05-19 23:15:53 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2021-05-19 23:15:53 +0100
commit494d8ec00d6561e9b010467674fafaa05d0f93cd (patch)
tree6dc4617180f0b298c3b24c7905e4c90a4b9dfd5b /subplotlib
parentb81da10ff03b4447fdabc140bac2a7f4cb80af91 (diff)
downloadsubplot-494d8ec00d6561e9b010467674fafaa05d0f93cd.tar.gz
subplotlib: chore: Regenerate runcmd.rs test file
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'subplotlib')
-rw-r--r--subplotlib/tests/runcmd.rs96
1 files changed, 96 insertions, 0 deletions
diff --git a/subplotlib/tests/runcmd.rs b/subplotlib/tests/runcmd.rs
index a8514f3..f18f463 100644
--- a/subplotlib/tests/runcmd.rs
+++ b/subplotlib/tests/runcmd.rs
@@ -41,6 +41,58 @@ fn successful_execution() {
// ---------------------------------
+// Successful execution in a sub-directory
+#[test]
+fn successful_execution_in_a_sub_directory() {
+ let mut scenario = Scenario::new(&base64_decode(
+ "U3VjY2Vzc2Z1bCBleGVjdXRpb24gaW4gYSBzdWItZGlyZWN0b3J5",
+ ));
+
+ let step = subplotlib::steplibrary::files::make_directory::Builder::default()
+ .path(
+ // "xyzzy"
+ &base64_decode("eHl6enk="),
+ )
+ .build();
+ scenario.add_step(step, None);
+
+ let step = subplotlib::steplibrary::runcmd::run_in::Builder::default()
+ .dirname(
+ // "xyzzy"
+ &base64_decode("eHl6enk="),
+ )
+ .argv0(
+ // "/bin/pwd"
+ &base64_decode("L2Jpbi9wd2Q="),
+ )
+ .args(
+ // ""
+ &base64_decode(""),
+ )
+ .build();
+ scenario.add_step(step, None);
+
+ let step = subplotlib::steplibrary::runcmd::exit_code_is::Builder::default()
+ .exit(0)
+ .build();
+ scenario.add_step(step, None);
+
+ let step = subplotlib::steplibrary::runcmd::exit_code_is_zero::Builder::default().build();
+ scenario.add_step(step, None);
+
+ let step = subplotlib::steplibrary::runcmd::stdout_contains::Builder::default()
+ .text(
+ // "/xyzzy"
+ &base64_decode("L3h5enp5"),
+ )
+ .build();
+ scenario.add_step(step, None);
+
+ scenario.run().unwrap();
+}
+
+// ---------------------------------
+
// Failed execution
#[test]
fn failed_execution() {
@@ -71,6 +123,50 @@ fn failed_execution() {
// ---------------------------------
+// Failed execution in a sub-directory
+#[test]
+fn failed_execution_in_a_sub_directory() {
+ let mut scenario = Scenario::new(&base64_decode(
+ "RmFpbGVkIGV4ZWN1dGlvbiBpbiBhIHN1Yi1kaXJlY3Rvcnk=",
+ ));
+
+ let step = subplotlib::steplibrary::files::make_directory::Builder::default()
+ .path(
+ // "xyzzy"
+ &base64_decode("eHl6enk="),
+ )
+ .build();
+ scenario.add_step(step, None);
+
+ let step = subplotlib::steplibrary::runcmd::try_to_run_in::Builder::default()
+ .dirname(
+ // "xyzzy"
+ &base64_decode("eHl6enk="),
+ )
+ .argv0(
+ // "/bin/false"
+ &base64_decode("L2Jpbi9mYWxzZQ=="),
+ )
+ .args(
+ // ""
+ &base64_decode(""),
+ )
+ .build();
+ scenario.add_step(step, None);
+
+ let step = subplotlib::steplibrary::runcmd::exit_code_is_not::Builder::default()
+ .exit(0)
+ .build();
+ scenario.add_step(step, None);
+
+ let step = subplotlib::steplibrary::runcmd::exit_code_is_nonzero::Builder::default().build();
+ scenario.add_step(step, None);
+
+ scenario.run().unwrap();
+}
+
+// ---------------------------------
+
// Check stdout is exactly as wanted
#[test]
fn check_stdout_is_exactly_as_wanted() {