mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
LibRegex: Remove trailing newline from error_string()
This commit is contained in:
parent
ca8e5b0791
commit
7615649fdf
2 changed files with 2 additions and 2 deletions
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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, ®ex, buf, buflen);
|
auto len = regerror(0, ®ex, 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]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue