From c4292d57e2e67dfcdac9004f8edb229976f6669a Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 13 Sep 2019 13:33:02 +0300 Subject: Add builtins support to command running API --- tests/command/driver.cxx | 7 +++++-- tests/command/testscript | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/command/driver.cxx b/tests/command/driver.cxx index 39d38aa..ef07962 100644 --- a/tests/command/driver.cxx +++ b/tests/command/driver.cxx @@ -9,7 +9,8 @@ #include #include #include -#include // invalid_argument +#include // invalid_argument +#include #endif // Other includes. @@ -245,7 +246,9 @@ main (int argc, const char* argv[]) cerr << e << endl; return 1; } - catch (const process_error& e) + // Also handles process_error exception (derived from system_error). + // + catch (const system_error& e) { cerr << e << endl; return 1; diff --git a/tests/command/testscript b/tests/command/testscript index bffe621..db9bb5c 100644 --- a/tests/command/testscript +++ b/tests/command/testscript @@ -153,3 +153,35 @@ end : $* "'$0' -C -S 10" 2>/~'%.+ exited with code 10%' == 10 } + +: builtin +: +{ + : no-cwd + : + { + $* 'touch a' &a; + test -f a + } + + : cwd + : + { + mkdir a; + $* -d a 'touch b' &a/b; + test -f a/b + } + + : redirect + : + { + $* 'echo abc >a' &a; + cat a >'abc' + } + + : callback + : + { + $* -p 'echo abc >a' >'echo abc >a' &a + } +} -- cgit v1.1