From 882583f64e517ab232edb6bbb7433631c655c9da Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 7 Nov 2019 11:12:43 +0200 Subject: Initial work on path_name use for `-` to stdin/stdout translation --- libbuild2/test/script/lexer+description-line.test.testscript | 2 +- libbuild2/test/script/lexer+variable.test.testscript | 2 +- libbuild2/test/script/lexer.hxx | 10 +++++----- libbuild2/test/script/lexer.test.cxx | 3 ++- libbuild2/test/script/parser.cxx | 8 ++++---- libbuild2/test/script/runner.cxx | 8 ++++---- 6 files changed, 17 insertions(+), 16 deletions(-) (limited to 'libbuild2/test') diff --git a/libbuild2/test/script/lexer+description-line.test.testscript b/libbuild2/test/script/lexer+description-line.test.testscript index bb5948a..3fa51bd 100644 --- a/libbuild2/test/script/lexer+description-line.test.testscript +++ b/libbuild2/test/script/lexer+description-line.test.testscript @@ -29,5 +29,5 @@ EOO $* <:"foo" >>EOO 2>>EOE != 0 'foo' EOO -stdin:1:4: error: expected newline at the end of description line +:1:4: error: expected newline at the end of description line EOE diff --git a/libbuild2/test/script/lexer+variable.test.testscript b/libbuild2/test/script/lexer+variable.test.testscript index 64b2bee..7c0807a 100644 --- a/libbuild2/test/script/lexer+variable.test.testscript +++ b/libbuild2/test/script/lexer+variable.test.testscript @@ -65,6 +65,6 @@ test.arguments = variable : multi-digit : $* <"10" 2>>EOE != 0 - stdin:1:1: error: multi-digit special variable name + :1:1: error: multi-digit special variable name EOE } diff --git a/libbuild2/test/script/lexer.hxx b/libbuild2/test/script/lexer.hxx index d96e91b..4083161 100644 --- a/libbuild2/test/script/lexer.hxx +++ b/libbuild2/test/script/lexer.hxx @@ -45,15 +45,15 @@ namespace build2 using base_lexer = build2::lexer; using base_mode = build2::lexer_mode; + // Note that neither the name nor escape arguments are copied. + // lexer (istream& is, const path& name, lexer_mode m, const char* escapes = nullptr) - : base_lexer (is, - name, - 1 /* line */, - nullptr /* escapes */, - false /* set_mode */) + : base_lexer (is, name, 1 /* line */, + nullptr /* escapes */, + false /* set_mode */) { mode (m, '\0', escapes); } diff --git a/libbuild2/test/script/lexer.test.cxx b/libbuild2/test/script/lexer.test.cxx index 5a421b8..fc26acc 100644 --- a/libbuild2/test/script/lexer.test.cxx +++ b/libbuild2/test/script/lexer.test.cxx @@ -53,7 +53,8 @@ namespace build2 m == lexer_mode::description_line || m == lexer_mode::variable); - lexer l (cin, path ("stdin"), u ? lexer_mode::command_line : m); + path in (""); // @@ PATH_NAME TODO + lexer l (cin, in, u ? lexer_mode::command_line : m); if (u) l.mode (m); diff --git a/libbuild2/test/script/parser.cxx b/libbuild2/test/script/parser.cxx index bc06ce8..d5e437b 100644 --- a/libbuild2/test/script/parser.cxx +++ b/libbuild2/test/script/parser.cxx @@ -2302,9 +2302,9 @@ namespace build2 // cmd $args # cmd x="foo bar" // - path name (""); istringstream is (s); - lexer lex (is, name, + path in (""); // @@ PATH_NAME TODO + lexer lex (is, in, lexer_mode::command_expansion, "\'\"\\"); @@ -2315,7 +2315,7 @@ namespace build2 // fail(t). Rather we should do fail(l). // token t (lex.next ()); - location l (build2::get_location (t, name)); + location l (build2::get_location (t, in)); t.separated = true; string w; @@ -2324,7 +2324,7 @@ namespace build2 for (; t.type != type::eos; t = lex.next ()) { type tt (t.type); - l = build2::get_location (t, name); + l = build2::get_location (t, in); // Re-lexing double-quotes will recognize $, ( inside as // tokens so we have to reverse them back. Since we don't diff --git a/libbuild2/test/script/runner.cxx b/libbuild2/test/script/runner.cxx index 520be43..e56dc41 100644 --- a/libbuild2/test/script/runner.cxx +++ b/libbuild2/test/script/runner.cxx @@ -167,7 +167,7 @@ namespace build2 } catch (const io_error& e) { - fail (ll) << "unable to write " << p << ": " << e; + fail (ll) << "unable to write to " << p << ": " << e; } } @@ -339,7 +339,7 @@ namespace build2 } catch (const io_error& e) { - fail (ll) << "unable to write " << ep << ": " << e; + fail (ll) << "unable to write to " << ep << ": " << e; } // Diff utility prints the differences to stdout. But for the @@ -1134,7 +1134,7 @@ namespace build2 value (move (ns)), *ats, token_type::assign, - path ("")); + path ("")); // @@ PATH_NAME TODO } } catch (const io_error& e) @@ -1536,7 +1536,7 @@ namespace build2 } catch (const io_error& e) { - fail (ll) << "unable to write " << p << ": " << e; + fail (ll) << "unable to write to " << p << ": " << e; } return fd; -- cgit v1.1