From a128eb0961ccf820ff2142897795b48723d842bd Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 21 Oct 2016 20:02:35 +0300 Subject: Make process status optional --- tests/process/driver.cxx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests') 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 (0)); + assert (p.wait ()); // "Exited" successfully. + } + + { + process p (optional (1)); + assert (!p.wait ()); // "Exited" with an error. + } + const char* s ("ABC\nXYZ"); assert (exec (p)); -- cgit v1.1