1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 19:47:34 +00:00

Everywhere: Rename {Deprecated => Byte}String

This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -122,7 +122,7 @@ TEST_CASE(regex_lexer)
TEST_CASE(parser_error_parens)
{
DeprecatedString pattern = "test()test";
ByteString pattern = "test()test";
Lexer l(pattern);
PosixExtendedParser p(l);
p.parse();
@ -132,7 +132,7 @@ TEST_CASE(parser_error_parens)
TEST_CASE(parser_error_special_characters_used_at_wrong_place)
{
DeprecatedString pattern;
ByteString pattern;
Vector<char, 5> chars = { '*', '+', '?', '{' };
StringBuilder b;
@ -143,7 +143,7 @@ TEST_CASE(parser_error_special_characters_used_at_wrong_place)
// First in ere
b.clear();
b.append(ch);
pattern = b.to_deprecated_string();
pattern = b.to_byte_string();
l.set_source(pattern);
p.parse();
EXPECT(p.has_error());
@ -153,7 +153,7 @@ TEST_CASE(parser_error_special_characters_used_at_wrong_place)
b.clear();
b.append("a|"sv);
b.append(ch);
pattern = b.to_deprecated_string();
pattern = b.to_byte_string();
l.set_source(pattern);
p.parse();
EXPECT(p.has_error());
@ -163,7 +163,7 @@ TEST_CASE(parser_error_special_characters_used_at_wrong_place)
b.clear();
b.append('^');
b.append(ch);
pattern = b.to_deprecated_string();
pattern = b.to_byte_string();
l.set_source(pattern);
p.parse();
EXPECT(p.has_error());
@ -173,7 +173,7 @@ TEST_CASE(parser_error_special_characters_used_at_wrong_place)
b.clear();
b.append('$');
b.append(ch);
pattern = b.to_deprecated_string();
pattern = b.to_byte_string();
l.set_source(pattern);
p.parse();
EXPECT(p.has_error());
@ -184,7 +184,7 @@ TEST_CASE(parser_error_special_characters_used_at_wrong_place)
b.append('(');
b.append(ch);
b.append(')');
pattern = b.to_deprecated_string();
pattern = b.to_byte_string();
l.set_source(pattern);
p.parse();
EXPECT(p.has_error());
@ -267,7 +267,7 @@ TEST_CASE(catch_all_newline)
Regex<PosixExtended> re("^.*$", PosixFlags::Multiline | PosixFlags::StringCopyMatches);
RegexResult result;
auto lambda = [&result, &re]() {
DeprecatedString aaa = "Hello World\nTest\n1234\n";
ByteString aaa = "Hello World\nTest\n1234\n";
result = match(aaa, re);
EXPECT_EQ(result.success, true);
};
@ -283,11 +283,11 @@ TEST_CASE(catch_all_newline_view)
Regex<PosixExtended> re("^.*$", PosixFlags::Multiline);
RegexResult result;
DeprecatedString aaa = "Hello World\nTest\n1234\n";
ByteString aaa = "Hello World\nTest\n1234\n";
result = match(aaa, re);
EXPECT_EQ(result.success, true);
EXPECT_EQ(result.count, 3u);
DeprecatedString str = "Hello World";
ByteString str = "Hello World";
EXPECT_EQ(result.matches.at(0).view, str.view());
EXPECT_EQ(result.matches.at(1).view, "Test");
EXPECT_EQ(result.matches.at(2).view, "1234");
@ -313,7 +313,7 @@ TEST_CASE(catch_all_newline_2)
TEST_CASE(match_all_character_class)
{
Regex<PosixExtended> re("[[:alpha:]]");
DeprecatedString str = "[Window]\nOpacity=255\nAudibleBeep=0\n";
ByteString str = "[Window]\nOpacity=255\nAudibleBeep=0\n";
RegexResult result = match(str, re, PosixFlags::Global | PosixFlags::StringCopyMatches);
EXPECT_EQ(result.success, true);
@ -326,7 +326,7 @@ TEST_CASE(match_all_character_class)
TEST_CASE(match_character_class_with_assertion)
{
Regex<PosixExtended> re("[[:alpha:]]+$");
DeprecatedString str = "abcdef";
ByteString str = "abcdef";
RegexResult result = match(str, re);
EXPECT_EQ(result.success, true);
@ -372,13 +372,13 @@ TEST_CASE(ini_file_entries)
regex_dbg.print_bytecode(re);
}
DeprecatedString haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n";
ByteString haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n";
EXPECT_EQ(re.search(haystack.view(), result, PosixFlags::Multiline), true);
EXPECT_EQ(result.count, 3u);
if constexpr (REGEX_DEBUG) {
for (auto& v : result.matches)
fprintf(stderr, "%s\n", v.view.to_deprecated_string().characters());
fprintf(stderr, "%s\n", v.view.to_byte_string().characters());
}
EXPECT_EQ(result.matches.at(0).view, "[Window]");
@ -400,7 +400,7 @@ TEST_CASE(ini_file_entries2)
Regex<PosixExtended> re("[[:alpha:]]*=([[:digit:]]*)");
RegexResult result;
DeprecatedString haystack = "ViewMode=Icon";
ByteString haystack = "ViewMode=Icon";
EXPECT_EQ(re.match(haystack.view(), result), false);
EXPECT_EQ(result.count, 0u);
@ -421,7 +421,7 @@ TEST_CASE(named_capture_group)
regex_dbg.print_bytecode(re);
}
DeprecatedString haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n";
ByteString haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n";
EXPECT_EQ(re.search(haystack, result, PosixFlags::Multiline), true);
EXPECT_EQ(result.count, 2u);
EXPECT_EQ(result.matches.at(0).view, "Opacity=255");
@ -444,7 +444,7 @@ TEST_CASE(ecma262_named_capture_group_with_dollar_sign)
regex_dbg.print_bytecode(re);
}
DeprecatedString haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n";
ByteString haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n";
EXPECT_EQ(re.search(haystack, result, ECMAScriptFlags::Multiline), true);
EXPECT_EQ(result.count, 2u);
EXPECT_EQ(result.matches.at(0).view, "Opacity=255");
@ -467,7 +467,7 @@ TEST_CASE(a_star)
regex_dbg.print_bytecode(re);
}
DeprecatedString haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n";
ByteString haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n";
EXPECT_EQ(re.search(haystack.view(), result, PosixFlags::Multiline), true);
EXPECT_EQ(result.count, 32u);
if (result.count == 32u) {
@ -500,7 +500,7 @@ TEST_CASE(posix_extended_nested_capture_group)
EXPECT_EQ(result.capture_group_matches[0][2].view, "llo"sv);
}
auto parse_test_case_long_disjunction_chain = DeprecatedString::repeated("a|"sv, 100000);
auto parse_test_case_long_disjunction_chain = ByteString::repeated("a|"sv, 100000);
TEST_CASE(ECMA262_parse)
{
@ -730,7 +730,7 @@ TEST_CASE(ECMA262_unicode_match)
StringBuilder builder;
for (u32 code_point : space_and_line_terminator_code_points)
builder.append_code_point(code_point);
auto space_and_line_terminators = builder.to_deprecated_string();
auto space_and_line_terminators = builder.to_byte_string();
struct _test {
StringView pattern;
@ -969,7 +969,7 @@ TEST_CASE(case_insensitive_match)
TEST_CASE(extremely_long_fork_chain)
{
Regex<ECMA262> re("(?:aa)*");
auto result = re.match(DeprecatedString::repeated('a', 1000));
auto result = re.match(ByteString::repeated('a', 1000));
EXPECT_EQ(result.success, true);
}
@ -988,7 +988,7 @@ TEST_CASE(theoretically_infinite_loop)
}
}
static auto g_lots_of_a_s = DeprecatedString::repeated('a', 10'000'000);
static auto g_lots_of_a_s = ByteString::repeated('a', 10'000'000);
BENCHMARK_CASE(fork_performance)
{
@ -1137,7 +1137,7 @@ TEST_CASE(single_match_flag)
auto result = re.match("ABC"sv);
EXPECT_EQ(result.success, true);
EXPECT_EQ(result.matches.size(), 1u);
EXPECT_EQ(result.matches.first().view.to_deprecated_string(), "A"sv);
EXPECT_EQ(result.matches.first().view.to_byte_string(), "A"sv);
}
}
@ -1149,7 +1149,7 @@ TEST_CASE(empty_string_wildcard_match)
auto result = re.match(""sv);
EXPECT_EQ(result.success, true);
EXPECT_EQ(result.matches.size(), 1u);
EXPECT_EQ(result.matches.first().view.to_deprecated_string(), ""sv);
EXPECT_EQ(result.matches.first().view.to_byte_string(), ""sv);
}
}
@ -1162,7 +1162,7 @@ TEST_CASE(inversion_state_in_char_class)
auto result = re.match("hello"sv);
EXPECT_EQ(result.success, true);
EXPECT_EQ(result.matches.size(), 1u);
EXPECT_EQ(result.matches.first().view.to_deprecated_string(), "h"sv);
EXPECT_EQ(result.matches.first().view.to_byte_string(), "h"sv);
}
{
Regex<ECMA262> re("^(?:([^\\s!\"#%-,\\./;->@\\[-\\^`\\{-~]+(?=([=~}\\s/.)|]))))"sv, ECMAScriptFlags::Global);
@ -1170,8 +1170,8 @@ TEST_CASE(inversion_state_in_char_class)
auto result = re.match("slideNumbers}}"sv);
EXPECT_EQ(result.success, true);
EXPECT_EQ(result.matches.size(), 1u);
EXPECT_EQ(result.matches.first().view.to_deprecated_string(), "slideNumbers"sv);
EXPECT_EQ(result.capture_group_matches.first()[0].view.to_deprecated_string(), "slideNumbers"sv);
EXPECT_EQ(result.capture_group_matches.first()[1].view.to_deprecated_string(), "}"sv);
EXPECT_EQ(result.matches.first().view.to_byte_string(), "slideNumbers"sv);
EXPECT_EQ(result.capture_group_matches.first()[0].view.to_byte_string(), "slideNumbers"sv);
EXPECT_EQ(result.capture_group_matches.first()[1].view.to_byte_string(), "}"sv);
}
}

View file

@ -13,7 +13,7 @@
TEST_CASE(catch_all)
{
DeprecatedString pattern = "^.*$";
ByteString pattern = "^.*$";
regex_t regex;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
@ -24,7 +24,7 @@ TEST_CASE(catch_all)
TEST_CASE(simple_start)
{
DeprecatedString pattern = "^hello friends";
ByteString pattern = "^hello friends";
regex_t regex;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
@ -37,7 +37,7 @@ TEST_CASE(simple_start)
TEST_CASE(simple_end)
{
DeprecatedString pattern = ".*hello\\.\\.\\. there$";
ByteString pattern = ".*hello\\.\\.\\. there$";
regex_t regex;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
@ -51,7 +51,7 @@ TEST_CASE(simple_end)
TEST_CASE(simple_period)
{
DeprecatedString pattern = "hello.";
ByteString pattern = "hello.";
regex_t regex;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
@ -65,7 +65,7 @@ TEST_CASE(simple_period)
TEST_CASE(simple_period_end)
{
DeprecatedString pattern = "hello.$";
ByteString pattern = "hello.$";
regex_t regex;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED | REG_NOSUB), REG_NOERR);
@ -79,7 +79,7 @@ TEST_CASE(simple_period_end)
TEST_CASE(simple_escaped)
{
DeprecatedString pattern = "hello\\.";
ByteString pattern = "hello\\.";
regex_t regex;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
@ -91,7 +91,7 @@ TEST_CASE(simple_escaped)
TEST_CASE(simple_period2_end)
{
DeprecatedString pattern = ".*hi... there$";
ByteString pattern = ".*hi... there$";
regex_t regex;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
@ -106,7 +106,7 @@ TEST_CASE(simple_period2_end)
TEST_CASE(simple_plus)
{
DeprecatedString pattern = "a+";
ByteString pattern = "a+";
regex_t regex;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED | REG_NOSUB), REG_NOERR);
@ -120,7 +120,7 @@ TEST_CASE(simple_plus)
TEST_CASE(simple_questionmark)
{
DeprecatedString pattern = "da?d";
ByteString pattern = "da?d";
regex_t regex;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
@ -137,7 +137,7 @@ TEST_CASE(simple_questionmark)
TEST_CASE(simple_questionmark_matchall)
{
DeprecatedString pattern = "da?d";
ByteString pattern = "da?d";
regex_t regex;
static constexpr int num_matches { 5 };
regmatch_t matches[num_matches];
@ -170,12 +170,12 @@ TEST_CASE(simple_questionmark_matchall)
TEST_CASE(character_class)
{
DeprecatedString pattern = "[[:alpha:]]";
ByteString pattern = "[[:alpha:]]";
regex_t regex;
static constexpr int num_matches { 5 };
regmatch_t matches[num_matches];
DeprecatedString haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n";
ByteString haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n";
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
EXPECT_EQ(regexec(&regex, haystack.characters(), num_matches, matches, 0), REG_NOMATCH);
EXPECT_EQ(matches[0].rm_cnt, 0);
@ -189,12 +189,12 @@ TEST_CASE(character_class)
TEST_CASE(character_class2)
{
DeprecatedString pattern = "[[:alpha:]]*=([[:digit:]]*)|\\[(.*)\\]";
ByteString pattern = "[[:alpha:]]*=([[:digit:]]*)|\\[(.*)\\]";
regex_t regex;
static constexpr int num_matches { 9 };
regmatch_t matches[num_matches];
DeprecatedString haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n";
ByteString haystack = "[Window]\nOpacity=255\nAudibleBeep=0\n";
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED | REG_NEWLINE), REG_NOERR);
EXPECT_EQ(regexec(&regex, haystack.characters(), num_matches, matches, 0), REG_NOERR);
@ -204,7 +204,7 @@ TEST_CASE(character_class2)
fprintf(stderr, "Matches[%i].rm_so: %li, .rm_eo: %li .rm_cnt: %li: ", i, matches[i].rm_so, matches[i].rm_eo, matches[i].rm_cnt);
fprintf(stderr, "haystack length: %lu\n", haystack.length());
if (matches[i].rm_so != -1)
fprintf(stderr, "%s\n", haystack.substring_view(matches[i].rm_so, matches[i].rm_eo - matches[i].rm_so).to_deprecated_string().characters());
fprintf(stderr, "%s\n", haystack.substring_view(matches[i].rm_so, matches[i].rm_eo - matches[i].rm_so).to_byte_string().characters());
}
#endif
@ -235,7 +235,7 @@ TEST_CASE(character_class2)
TEST_CASE(escaped_char_questionmark)
{
DeprecatedString pattern = "This\\.?And\\.?That";
ByteString pattern = "This\\.?And\\.?That";
regex_t regex;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
@ -249,7 +249,7 @@ TEST_CASE(escaped_char_questionmark)
TEST_CASE(char_qualifier_asterisk)
{
DeprecatedString pattern = "regex*";
ByteString pattern = "regex*";
regex_t regex;
static constexpr int num_matches { 5 };
regmatch_t matches[num_matches];
@ -263,7 +263,7 @@ TEST_CASE(char_qualifier_asterisk)
TEST_CASE(char_utf8)
{
DeprecatedString pattern = "😀";
ByteString pattern = "😀";
regex_t regex;
static constexpr int num_matches { 5 };
regmatch_t matches[num_matches];
@ -277,7 +277,7 @@ TEST_CASE(char_utf8)
TEST_CASE(parens)
{
DeprecatedString pattern = "test(hello)test";
ByteString pattern = "test(hello)test";
regex_t regex;
static constexpr int num_matches { 5 };
regmatch_t matches[num_matches];
@ -297,7 +297,7 @@ TEST_CASE(parens)
TEST_CASE(parser_error_parens)
{
DeprecatedString pattern = "test()test";
ByteString pattern = "test()test";
regex_t regex;
static constexpr int num_matches { 5 };
regmatch_t matches[num_matches];
@ -310,7 +310,7 @@ TEST_CASE(parser_error_parens)
TEST_CASE(parser_error_special_characters_used_at_wrong_place)
{
DeprecatedString pattern;
ByteString pattern;
regex_t regex;
static constexpr int num_matches { 5 };
regmatch_t matches[num_matches];
@ -325,7 +325,7 @@ TEST_CASE(parser_error_special_characters_used_at_wrong_place)
// First in ere
b.clear();
b.append(ch);
pattern = b.to_deprecated_string();
pattern = b.to_byte_string();
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), error_code_to_check);
EXPECT_EQ(regexec(&regex, "test", num_matches, matches, 0), error_code_to_check);
regfree(&regex);
@ -334,7 +334,7 @@ TEST_CASE(parser_error_special_characters_used_at_wrong_place)
b.clear();
b.append("a|"sv);
b.append(ch);
pattern = b.to_deprecated_string();
pattern = b.to_byte_string();
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), error_code_to_check);
EXPECT_EQ(regexec(&regex, "test", num_matches, matches, 0), error_code_to_check);
regfree(&regex);
@ -343,7 +343,7 @@ TEST_CASE(parser_error_special_characters_used_at_wrong_place)
b.clear();
b.append('^');
b.append(ch);
pattern = b.to_deprecated_string();
pattern = b.to_byte_string();
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), error_code_to_check);
EXPECT_EQ(regexec(&regex, "test", num_matches, matches, 0), error_code_to_check);
regfree(&regex);
@ -352,7 +352,7 @@ TEST_CASE(parser_error_special_characters_used_at_wrong_place)
b.clear();
b.append('$');
b.append(ch);
pattern = b.to_deprecated_string();
pattern = b.to_byte_string();
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), error_code_to_check);
EXPECT_EQ(regexec(&regex, "test", num_matches, matches, 0), error_code_to_check);
regfree(&regex);
@ -362,7 +362,7 @@ TEST_CASE(parser_error_special_characters_used_at_wrong_place)
b.append('(');
b.append(ch);
b.append(')');
pattern = b.to_deprecated_string();
pattern = b.to_byte_string();
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), error_code_to_check);
EXPECT_EQ(regexec(&regex, "test", num_matches, matches, 0), error_code_to_check);
regfree(&regex);
@ -371,7 +371,7 @@ TEST_CASE(parser_error_special_characters_used_at_wrong_place)
TEST_CASE(parser_error_vertical_line_used_at_wrong_place)
{
DeprecatedString pattern;
ByteString pattern;
regex_t regex;
static constexpr int num_matches { 5 };
regmatch_t matches[num_matches];
@ -403,7 +403,7 @@ TEST_CASE(parser_error_vertical_line_used_at_wrong_place)
TEST_CASE(parens_qualifier_questionmark)
{
DeprecatedString pattern = "test(hello)?test";
ByteString pattern = "test(hello)?test";
regex_t regex;
static constexpr int num_matches { 5 };
regmatch_t matches[num_matches];
@ -433,7 +433,7 @@ TEST_CASE(parens_qualifier_questionmark)
TEST_CASE(parens_qualifier_asterisk)
{
DeprecatedString pattern = "test(hello)*test";
ByteString pattern = "test(hello)*test";
regex_t regex;
static constexpr int num_matches { 6 };
regmatch_t matches[num_matches];
@ -479,7 +479,7 @@ TEST_CASE(parens_qualifier_asterisk)
TEST_CASE(parens_qualifier_asterisk_2)
{
DeprecatedString pattern = "test(.*)test";
ByteString pattern = "test(.*)test";
regex_t regex;
static constexpr int num_matches { 6 };
regmatch_t matches[num_matches];
@ -523,7 +523,7 @@ TEST_CASE(parens_qualifier_asterisk_2)
TEST_CASE(mulit_parens_qualifier_too_less_result_values)
{
DeprecatedString pattern = "test(a)?(b)?(c)?test";
ByteString pattern = "test(a)?(b)?(c)?test";
regex_t regex;
static constexpr int num_matches { 4 };
regmatch_t matches[num_matches];
@ -587,7 +587,7 @@ TEST_CASE(mulit_parens_qualifier_too_less_result_values)
TEST_CASE(multi_parens_qualifier_questionmark)
{
DeprecatedString pattern = "test(a)?(b)?(c)?test";
ByteString pattern = "test(a)?(b)?(c)?test";
regex_t regex;
static constexpr int num_matches { 8 };
regmatch_t matches[num_matches];
@ -651,7 +651,7 @@ TEST_CASE(multi_parens_qualifier_questionmark)
TEST_CASE(simple_alternative)
{
DeprecatedString pattern = "test|hello|friends";
ByteString pattern = "test|hello|friends";
regex_t regex;
static constexpr int num_matches { 1 };
regmatch_t matches[num_matches];
@ -678,7 +678,7 @@ TEST_CASE(simple_alternative)
TEST_CASE(alternative_match_groups)
{
DeprecatedString pattern = "test(a)?(b)?|hello ?(dear|my)? friends";
ByteString pattern = "test(a)?(b)?|hello ?(dear|my)? friends";
regex_t regex;
static constexpr int num_matches { 8 };
regmatch_t matches[num_matches];
@ -784,7 +784,7 @@ TEST_CASE(alternative_match_groups)
TEST_CASE(parens_qualifier_exact)
{
DeprecatedString pattern = "(hello){3}";
ByteString pattern = "(hello){3}";
regex_t regex;
static constexpr int num_matches { 5 };
regmatch_t matches[num_matches];
@ -831,7 +831,7 @@ TEST_CASE(parens_qualifier_exact)
TEST_CASE(parens_qualifier_minimum)
{
DeprecatedString pattern = "(hello){3,}";
ByteString pattern = "(hello){3,}";
regex_t regex;
static constexpr int num_matches { 5 };
regmatch_t matches[num_matches];
@ -889,7 +889,7 @@ TEST_CASE(parens_qualifier_minimum)
TEST_CASE(parens_qualifier_maximum)
{
DeprecatedString pattern = "(hello){2,3}";
ByteString pattern = "(hello){2,3}";
regex_t regex;
static constexpr int num_matches { 5 };
regmatch_t matches[num_matches];
@ -946,7 +946,7 @@ TEST_CASE(parens_qualifier_maximum)
TEST_CASE(char_qualifier_min_max)
{
DeprecatedString pattern = "c{3,30}";
ByteString pattern = "c{3,30}";
regex_t regex;
static constexpr int num_matches { 5 };
regmatch_t matches[num_matches];
@ -966,7 +966,7 @@ TEST_CASE(char_qualifier_min_max)
TEST_CASE(simple_bracket_chars)
{
DeprecatedString pattern = "[abc]";
ByteString pattern = "[abc]";
regex_t regex;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
@ -980,7 +980,7 @@ TEST_CASE(simple_bracket_chars)
TEST_CASE(simple_bracket_chars_inverse)
{
DeprecatedString pattern = "[^abc]";
ByteString pattern = "[^abc]";
regex_t regex;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
@ -994,7 +994,7 @@ TEST_CASE(simple_bracket_chars_inverse)
TEST_CASE(simple_bracket_chars_range)
{
DeprecatedString pattern = "[a-d]";
ByteString pattern = "[a-d]";
regex_t regex;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
@ -1008,7 +1008,7 @@ TEST_CASE(simple_bracket_chars_range)
TEST_CASE(simple_bracket_chars_range_inverse)
{
DeprecatedString pattern = "[^a-df-z]";
ByteString pattern = "[^a-df-z]";
regex_t regex;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
@ -1024,7 +1024,7 @@ TEST_CASE(simple_bracket_chars_range_inverse)
TEST_CASE(bracket_character_class_uuid)
{
DeprecatedString pattern = "^([[:xdigit:]]{8})-([[:xdigit:]]{4})-([[:xdigit:]]{4})-([[:xdigit:]]{4})-([[:xdigit:]]{12})$";
ByteString pattern = "^([[:xdigit:]]{8})-([[:xdigit:]]{4})-([[:xdigit:]]{4})-([[:xdigit:]]{4})-([[:xdigit:]]{12})$";
regex_t regex;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
@ -1036,7 +1036,7 @@ TEST_CASE(bracket_character_class_uuid)
TEST_CASE(simple_bracket_character_class_inverse)
{
DeprecatedString pattern = "[^[:digit:]]";
ByteString pattern = "[^[:digit:]]";
regex_t regex;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
@ -1050,7 +1050,7 @@ TEST_CASE(simple_bracket_character_class_inverse)
TEST_CASE(email_address)
{
DeprecatedString pattern = "^[A-Z0-9a-z._%+-]{1,64}@(?:[A-Za-z0-9-]{1,63}\\.){1,125}[A-Za-z]{2,63}$";
ByteString pattern = "^[A-Z0-9a-z._%+-]{1,64}@(?:[A-Za-z0-9-]{1,63}\\.){1,125}[A-Za-z]{2,63}$";
regex_t regex;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_NOERR);
@ -1062,7 +1062,7 @@ TEST_CASE(email_address)
TEST_CASE(error_message)
{
DeprecatedString pattern = "^[A-Z0-9[a-z._%+-]{1,64}@[A-Za-z0-9-]{1,63}\\.{1,125}[A-Za-z]{2,63}$";
ByteString pattern = "^[A-Z0-9[a-z._%+-]{1,64}@[A-Za-z0-9-]{1,63}\\.{1,125}[A-Za-z]{2,63}$";
regex_t regex;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED), REG_EBRACK);
@ -1070,7 +1070,7 @@ TEST_CASE(error_message)
char buf[1024];
size_t buflen = 1024;
auto len = regerror(0, &regex, buf, buflen);
DeprecatedString 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.";
ByteString 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) {
EXPECT_EQ(buf[i], expected[i]);
}
@ -1080,7 +1080,7 @@ TEST_CASE(error_message)
TEST_CASE(simple_ignorecase)
{
DeprecatedString pattern = "^hello friends";
ByteString pattern = "^hello friends";
regex_t regex;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED | REG_NOSUB | REG_ICASE), REG_NOERR);
@ -1098,8 +1098,8 @@ TEST_CASE(simple_ignorecase)
TEST_CASE(simple_notbol_noteol)
{
DeprecatedString pattern = "^hello friends$";
DeprecatedString pattern2 = "hello friends";
ByteString pattern = "^hello friends$";
ByteString pattern2 = "hello friends";
regex_t regex, regex2;
EXPECT_EQ(regcomp(&regex, pattern.characters(), REG_EXTENDED | REG_NOSUB | REG_ICASE), REG_NOERR);