diff options
author | Rebecca Turner <rbt@sent.as> | 2024-03-28 16:26:42 -0700 |
---|---|---|
committer | rebecca “wiggles” turner <rbt@sent.as> | 2024-04-03 16:25:54 +0000 |
commit | 84018e126405caed68097b52392bee648bf1b17e (patch) | |
tree | a4e7ad04bcf27c988c9b91f3c2ecec9aca03d476 /tests/functional/repl_characterization | |
parent | ea10fe7ab0df085b51189adabdb079fc4442c6be (diff) |
Make `repl_characterization.cc` constants `string_view`s
Change-Id: I96455ee365799ae87d9ab433cf102c691616a45e
Diffstat (limited to 'tests/functional/repl_characterization')
-rw-r--r-- | tests/functional/repl_characterization/repl_characterization.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/functional/repl_characterization/repl_characterization.cc b/tests/functional/repl_characterization/repl_characterization.cc index d46f09553..68a66b2f3 100644 --- a/tests/functional/repl_characterization/repl_characterization.cc +++ b/tests/functional/repl_characterization/repl_characterization.cc @@ -16,10 +16,10 @@ using namespace std::string_literals; namespace nix { -static constexpr const char * REPL_PROMPT = "nix-repl> "; +static constexpr const std::string_view REPL_PROMPT = "nix-repl> "; // ASCII ENQ character -static constexpr const char * AUTOMATION_PROMPT = "\x05"; +static constexpr const std::string_view AUTOMATION_PROMPT = "\x05"; static std::string_view trimOutLog(std::string_view outLog) { @@ -42,7 +42,7 @@ public: void runReplTest(std::string_view const & content, std::vector<std::string> extraArgs = {}) const { - auto syntax = CLILiterateParser::parse(REPL_PROMPT, content); + auto syntax = CLILiterateParser::parse(std::string(REPL_PROMPT), content); // FIXME: why does this need two --quiets // show-trace is on by default due to test configuration, but is not a standard @@ -52,7 +52,7 @@ public: auto nixBin = canonPath(getEnvNonEmpty("NIX_BIN_DIR").value_or(NIX_BIN_DIR)); auto process = RunningProcess::start(nixBin + "/nix", args); - auto session = TestSession{AUTOMATION_PROMPT, std::move(process)}; + auto session = TestSession{std::string(AUTOMATION_PROMPT), std::move(process)}; for (auto & bit : syntax) { if (bit.kind != CLILiterateParser::NodeKind::COMMAND) { @@ -72,7 +72,7 @@ public: auto replacedOutLog = boost::algorithm::replace_all_copy(session.outLog, unitTestData, "TEST_DATA"); auto cleanedOutLog = trimOutLog(replacedOutLog); - auto parsedOutLog = CLILiterateParser::parse(AUTOMATION_PROMPT, cleanedOutLog, 0); + auto parsedOutLog = CLILiterateParser::parse(std::string(AUTOMATION_PROMPT), cleanedOutLog, 0); parsedOutLog = CLILiterateParser::tidyOutputForComparison(std::move(parsedOutLog)); syntax = CLILiterateParser::tidyOutputForComparison(std::move(syntax)); @@ -85,7 +85,7 @@ TEST_F(ReplSessionTest, parses) { writeTest("basic.ast", [this]() { const std::string content = readFile(goldenMaster("basic.test")); - auto parser = CLILiterateParser{REPL_PROMPT}; + auto parser = CLILiterateParser{std::string(REPL_PROMPT)}; parser.feed(content); std::ostringstream out{}; @@ -97,7 +97,7 @@ TEST_F(ReplSessionTest, parses) writeTest("basic_tidied.ast", [this]() { const std::string content = readFile(goldenMaster("basic.test")); - auto syntax = CLILiterateParser::parse(REPL_PROMPT, content); + auto syntax = CLILiterateParser::parse(std::string(REPL_PROMPT), content); syntax = CLILiterateParser::tidyOutputForComparison(std::move(syntax)); |