aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrebecca “wiggles” turner <rbt@sent.as>2024-04-04 23:08:09 +0000
committerGerrit Code Review <gerrit@lix>2024-04-04 23:08:09 +0000
commit83d720b7304f6479f48dca8f3062e966f359e9b4 (patch)
treeb17c4bf0804780be02aefeb07d7da2cd0ff0bca2
parent9166babbaf5882ad2cfe1c7c9b30de1c153d70a8 (diff)
parent84018e126405caed68097b52392bee648bf1b17e (diff)
Merge "Make `repl_characterization.cc` constants `string_view`s" into main
-rw-r--r--tests/functional/repl_characterization/repl_characterization.cc14
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));