aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-10-21 20:02:35 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-10-24 11:27:19 +0300
commita128eb0961ccf820ff2142897795b48723d842bd (patch)
tree291351ef0ed9f428b3f5c8a1bf22483d3350bc15 /tests
parent070d99ca6d714e8789e67e2e797a1bf16ba35528 (diff)
Make process status optional
Diffstat (limited to 'tests')
-rw-r--r--tests/process/driver.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/process/driver.cxx b/tests/process/driver.cxx
index 0aa9177..d59b1a7 100644
--- a/tests/process/driver.cxx
+++ b/tests/process/driver.cxx
@@ -255,6 +255,26 @@ main (int argc, const char* argv[])
return 0;
}
+ // Test processes created as "already terminated".
+ //
+ {
+ process p;
+ assert (!p.wait ()); // "Terminated" abnormally.
+ }
+
+ {
+ // Note that if to create as just process(0) then the
+ // process(const char* args[], int=0, int=1, int=2) ctor is being called.
+ //
+ process p (optional<process::status_type> (0));
+ assert (p.wait ()); // "Exited" successfully.
+ }
+
+ {
+ process p (optional<process::status_type> (1));
+ assert (!p.wait ()); // "Exited" with an error.
+ }
+
const char* s ("ABC\nXYZ");
assert (exec (p));