forked from lix-project/lix
Merge "Make repl_characterization.cc
constants string_view
s" into main
This commit is contained in:
commit
83d720b730
1 changed files with 7 additions and 7 deletions
|
@ -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));
|
||||
|
||||
|
|
Loading…
Reference in a new issue