diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-10-19 08:15:51 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-11-04 09:26:29 +0200 |
commit | 8e91d7935932066d17cf6dfb24705c5a62aa42f6 (patch) | |
tree | 8b1fa0e5edaa420151197ce5f5d1112e587cc508 /build2/test/script | |
parent | f6cc4a1f8c33f569e37220b21ea9457ebdc69b67 (diff) |
Minor testscript fixes/changes
Diffstat (limited to 'build2/test/script')
-rw-r--r-- | build2/test/script/parser.cxx | 15 | ||||
-rw-r--r-- | build2/test/script/runner.cxx | 4 | ||||
-rw-r--r-- | build2/test/script/script | 5 |
3 files changed, 12 insertions, 12 deletions
diff --git a/build2/test/script/parser.cxx b/build2/test/script/parser.cxx index b670956..e515532 100644 --- a/build2/test/script/parser.cxx +++ b/build2/test/script/parser.cxx @@ -181,10 +181,13 @@ namespace build2 // auto add_word = [&ts, &p, &hd, this] (string&& w, const location& l) { - auto add_heredoc = [&w, &hd] (redirect& r) + auto add_here_end = [&w, &hd, &l, this] (redirect& r) { + if (w.empty ()) + fail (l) << "empty here-document end marker"; + hd.push_back (r); - r.end_marker = move (w); + r.here_end = move (w); }; switch (p) @@ -205,11 +208,11 @@ namespace build2 } break; } - case pending::in_document: add_heredoc (ts.in); break; + case pending::in_document: add_here_end (ts.in); break; case pending::in_string: ts.in.value = move (w); break; - case pending::out_document: add_heredoc (ts.out); break; + case pending::out_document: add_here_end (ts.out); break; case pending::out_string: ts.out.value = move (w); break; - case pending::err_document: add_heredoc (ts.err); break; + case pending::err_document: add_here_end (ts.err); break; case pending::err_string: ts.err.value = move (w); break; } @@ -544,7 +547,7 @@ namespace build2 mode (lexer_mode::here_line); next (t, tt); - r.value = parse_here_document (t, tt, r.end_marker); + r.value = parse_here_document (t, tt, r.here_end); expire_mode (); } diff --git a/build2/test/script/runner.cxx b/build2/test/script/runner.cxx index c4778bf..25383cf 100644 --- a/build2/test/script/runner.cxx +++ b/build2/test/script/runner.cxx @@ -40,7 +40,7 @@ namespace build2 case redirect_type::here_document: { o << prefix[n - 1]; // Add another '>' or '<'. - print_string (r.end_marker); + print_string (r.here_end); break; } default: assert (false); @@ -51,7 +51,7 @@ namespace build2 { // Here-document value always ends with a newline. // - o << endl << r.value << r.end_marker; + o << endl << r.value << r.here_end; }; print_string (t.program.string ()); diff --git a/build2/test/script/script b/build2/test/script/script index 8f918fc..590013a 100644 --- a/build2/test/script/script +++ b/build2/test/script/script @@ -32,10 +32,7 @@ namespace build2 { redirect_type type = redirect_type::none; string value; - - // Meaningul for here-documents only. Used for diagnostics. - // - string end_marker; + string here_end; // Only for here-documents. }; struct command |