diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2022-10-03 21:23:22 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2022-10-13 13:08:02 +0300 |
commit | f59d82eb8fda3ddcf790556c6c3615e40ae8b15b (patch) | |
tree | 74cd2d3415259c6cb3e116a01eef215f6b39861f /libbuild2/test/script/parser.test.cxx | |
parent | f0959bca1b44e62c1745027fed42a5973f44cdb4 (diff) |
Add support for 'for' loop second (... | for x) and third (for x <...) forms in script
Diffstat (limited to 'libbuild2/test/script/parser.test.cxx')
-rw-r--r-- | libbuild2/test/script/parser.test.cxx | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/libbuild2/test/script/parser.test.cxx b/libbuild2/test/script/parser.test.cxx index ab0aee9..7339346 100644 --- a/libbuild2/test/script/parser.test.cxx +++ b/libbuild2/test/script/parser.test.cxx @@ -100,11 +100,32 @@ namespace build2 } virtual void - run (scope&, + run (scope& env, const command_expr& e, command_type t, const iteration_index* ii, size_t i, - const location&) override + const function<command_function>& cf, + const location& ll) override { + // If the functions is specified, then just execute it with an empty + // stdin so it can perform the housekeeping (stop replaying tokens, + // increment line index, etc). + // + if (cf != nullptr) + { + assert (e.size () == 1 && !e[0].pipe.empty ()); + + const command& c (e[0].pipe.back ()); + + // Must be enforced by the caller. + // + assert (!c.out && !c.err && !c.exit); + + cf (env, c.arguments, + fdopen_null (), false /* pipe */, + nullopt /* deadline */, c, + ll); + } + const char* s (nullptr); switch (t) |