From 4a49a497eb39fbdedefc518c6d61c9a426641506 Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Sat, 6 Apr 2024 14:39:01 -0700 Subject: [PATCH] Fix REPL test parser nits Follow-up to https://gerrit.lix.systems/c/lix/+/546 Change-Id: Ie603f01e5520329bf879e061cea9e3fba45213fd --- .../repl_characterization/repl_characterization.cc | 5 ----- tests/functional/repl_characterization/test-session.cc | 4 ++-- tests/functional/repl_characterization/test-session.hh | 2 +- .../unit/libutil-support/tests/cli-literate-parser.cc | 10 ++++------ 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/tests/functional/repl_characterization/repl_characterization.cc b/tests/functional/repl_characterization/repl_characterization.cc index ae4d4030f..eb90f349d 100644 --- a/tests/functional/repl_characterization/repl_characterization.cc +++ b/tests/functional/repl_characterization/repl_characterization.cc @@ -123,11 +123,6 @@ public: { runReplTestPath(nameBase, {}); } - - void runDebuggerTest(const std::string_view & nameBase) - { - runReplTestPath(nameBase, {"--debugger"}); - } }; TEST_F(ReplSessionTest, round_trip) diff --git a/tests/functional/repl_characterization/test-session.cc b/tests/functional/repl_characterization/test-session.cc index 52179a372..c3eb45b85 100644 --- a/tests/functional/repl_characterization/test-session.cc +++ b/tests/functional/repl_characterization/test-session.cc @@ -121,7 +121,7 @@ bool TestSession::readOutThen(ReadOutThenCallback cb) bool TestSession::waitForPrompt() { - bool notEof = readOutThen([&](std::span s) -> ReadOutThenCallbackResult { + bool notEof = readOutThen([&](std::span s) -> ReadOutThenCallbackResult { bool foundPrompt = false; for (auto ch : s) { @@ -147,7 +147,7 @@ bool TestSession::waitForPrompt() void TestSession::wait() { - readOutThen([&](std::span s) { + readOutThen([&](std::span s) { for (auto ch : s) { eater.feed(ch, [&](char c) { outputParser.feed(c); diff --git a/tests/functional/repl_characterization/test-session.hh b/tests/functional/repl_characterization/test-session.hh index 2552542fb..9961849fc 100644 --- a/tests/functional/repl_characterization/test-session.hh +++ b/tests/functional/repl_characterization/test-session.hh @@ -76,7 +76,7 @@ private: void wait(); enum class ReadOutThenCallbackResult { Stop, Continue }; - using ReadOutThenCallback = std::function)>; + using ReadOutThenCallback = std::function)>; /** Reads some chunks of output, calling the callback provided for each * chunk and stopping if it returns Stop. * diff --git a/tests/unit/libutil-support/tests/cli-literate-parser.cc b/tests/unit/libutil-support/tests/cli-literate-parser.cc index 023f86cd7..822f5e276 100644 --- a/tests/unit/libutil-support/tests/cli-literate-parser.cc +++ b/tests/unit/libutil-support/tests/cli-literate-parser.cc @@ -35,7 +35,7 @@ struct Parser : input(input) , rest(this->input) , prompt(config.prompt) - , indentString(std::string(config.indent, ' ')) + , indentString(config.indent, ' ') , lastWasOutput(false) , syntax{} { @@ -260,12 +260,11 @@ struct Parser std::vector newSyntax; auto shouldStart = true; - for (auto it = syntax.begin(); it != syntax.end(); ++it) { - Node node = std::move(*it); + for (auto & node : syntax) { std::visit( overloaded{ [&](Args & e) { - auto split = shell_split(std::string(e.text)); + auto split = shell_split(e.text); args.insert(args.end(), split.begin(), split.end()); }, [&](ShouldStart & e) { shouldStart = e.shouldStart; }, @@ -293,8 +292,7 @@ auto tidySyntax(View syntax) -> std::vector auto lastWasCommand = true; std::vector newSyntax; - for (auto it = syntax.begin(); it != syntax.end(); ++it) { - Node node = *it; + for (auto & node : syntax) { // Only compare `Command` and `Output` nodes. if (std::visit([&](auto && e) { return !e.shouldCompare(); }, node)) { continue;