LibRegex: Remove trailing newline from error_string()

This commit is contained in:
Linus Groh 2020-11-28 15:09:36 +00:00 committed by Andreas Kling
parent ca8e5b0791
commit 7615649fdf
2 changed files with 2 additions and 2 deletions

View file

@ -67,7 +67,7 @@ String Regex<Parser>::error_string(Optional<String> message) const
for (size_t i = 0; i < parser_result.error_token.position(); ++i) for (size_t i = 0; i < parser_result.error_token.position(); ++i)
eb.append(" "); eb.append(" ");
eb.appendf("^---- %s\n", message.value_or(get_error_string(parser_result.error)).characters()); eb.appendf("^---- %s", message.value_or(get_error_string(parser_result.error)).characters());
return eb.build(); return eb.build();
} }

View file

@ -1079,7 +1079,7 @@ TEST_CASE(error_message)
char buf[1024]; char buf[1024];
size_t buflen = 1024; size_t buflen = 1024;
auto len = regerror(0, &regex, buf, buflen); auto len = regerror(0, &regex, buf, buflen);
String expected = "Error during parsing of regular expression:\n ^[A-Z0-9[a-z._%+-]{1,64}@[A-Za-z0-9-]{1,63}\\.{1,125}[A-Za-z]{2,63}$\n ^---- [ ] imbalance.\n"; String expected = "Error during parsing of regular expression:\n ^[A-Z0-9[a-z._%+-]{1,64}@[A-Za-z0-9-]{1,63}\\.{1,125}[A-Za-z]{2,63}$\n ^---- [ ] imbalance.";
for (size_t i = 0; i < len; ++i) { for (size_t i = 0; i < len; ++i) {
EXPECT_EQ(buf[i], expected[i]); EXPECT_EQ(buf[i], expected[i]);
} }