aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorRebecca Turner <rbt@sent.as>2024-04-06 14:39:01 -0700
committerRebecca Turner <rbt@sent.as>2024-04-08 11:14:34 -0700
commit4a49a497eb39fbdedefc518c6d61c9a426641506 (patch)
tree97dd11da007d679836388515301896b54af4de0c /tests/unit
parentb3233405381b50c7f7eb87d7962b25a06d16be44 (diff)
Fix REPL test parser nits
Follow-up to https://gerrit.lix.systems/c/lix/+/546 Change-Id: Ie603f01e5520329bf879e061cea9e3fba45213fd
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/libutil-support/tests/cli-literate-parser.cc10
1 files changed, 4 insertions, 6 deletions
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<Node> 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<Node>
auto lastWasCommand = true;
std::vector<Node> 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;