From b61e9e2ba8e625a598427cc2990806b69d104a18 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 25 Oct 2016 16:47:00 +0300 Subject: Add support of file redirects to testscript parser --- build2/test/script/script | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) (limited to 'build2/test/script/script') diff --git a/build2/test/script/script b/build2/test/script/script index 2d74b16..79ada8e 100644 --- a/build2/test/script/script +++ b/build2/test/script/script @@ -43,15 +43,44 @@ namespace build2 none, pass, null, - here_string, // Value is the string. - here_document // Value is the document. + here_string, + here_document, + file }; struct redirect { - redirect_type type = redirect_type::none; - string value; // Note: includes trailing newline, if required. - string here_end; // Only for here-documents. + redirect_type type; + + struct doc_type + { + string doc; // Note: includes trailing newline, if required. + string end; + }; + + struct file_type + { + using path_type = build2::path; + path_type path; + bool append = false; + }; + + union + { + string str; // Note: includes trailing newline, if required. + doc_type doc; + file_type file; + }; + + explicit + redirect (redirect_type = redirect_type::none); + + redirect (redirect&&); + redirect (const redirect&); + redirect& operator= (redirect&&); + redirect& operator= (const redirect&); + + ~redirect (); }; enum class exit_comparison {eq, ne}; -- cgit v1.1