feat: updated engine version to 4.4-rc1
This commit is contained in:
parent
ee00efde1f
commit
21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions
|
|
@ -80,32 +80,32 @@ TEST_CASE("[RegEx] Searching") {
|
|||
REQUIRE(re.is_valid());
|
||||
|
||||
Ref<RegExMatch> match = re.search(s);
|
||||
REQUIRE(match != nullptr);
|
||||
REQUIRE(match.is_valid());
|
||||
CHECK(match->get_string(0) == "ea");
|
||||
|
||||
match = re.search(s, 1, 2);
|
||||
REQUIRE(match != nullptr);
|
||||
REQUIRE(match.is_valid());
|
||||
CHECK(match->get_string(0) == "e");
|
||||
match = re.search(s, 2, 4);
|
||||
REQUIRE(match != nullptr);
|
||||
REQUIRE(match.is_valid());
|
||||
CHECK(match->get_string(0) == "a");
|
||||
match = re.search(s, 3, 5);
|
||||
CHECK(match == nullptr);
|
||||
CHECK(match.is_null());
|
||||
match = re.search(s, 6, 2);
|
||||
CHECK(match == nullptr);
|
||||
CHECK(match.is_null());
|
||||
|
||||
const Array all_results = re.search_all(s);
|
||||
CHECK(all_results.size() == 2);
|
||||
match = all_results[0];
|
||||
REQUIRE(match != nullptr);
|
||||
REQUIRE(match.is_valid());
|
||||
CHECK(match->get_string(0) == "ea");
|
||||
match = all_results[1];
|
||||
REQUIRE(match != nullptr);
|
||||
REQUIRE(match.is_valid());
|
||||
CHECK(match->get_string(0) == "i");
|
||||
|
||||
CHECK(re.compile(numerics) == OK);
|
||||
CHECK(re.is_valid());
|
||||
CHECK(re.search(s) == nullptr);
|
||||
CHECK(re.search(s).is_null());
|
||||
CHECK(re.search_all(s).size() == 0);
|
||||
}
|
||||
|
||||
|
|
@ -145,6 +145,15 @@ TEST_CASE("[RegEx] Substitution") {
|
|||
CHECK(re5.sub(s5, "cc", true, 0, 2) == "ccccaa");
|
||||
CHECK(re5.sub(s5, "cc", true, 1, 3) == "acccca");
|
||||
CHECK(re5.sub(s5, "", true, 0, 2) == "aa");
|
||||
|
||||
const String s6 = "property get_property set_property";
|
||||
|
||||
RegEx re6("(get_|set_)?property");
|
||||
REQUIRE(re6.is_valid());
|
||||
CHECK(re6.sub(s6, "$1new_property", true) == "new_property get_new_property set_new_property");
|
||||
ERR_PRINT_OFF;
|
||||
CHECK(re6.sub(s6, "$5new_property", true) == "new_property new_property new_property");
|
||||
ERR_PRINT_ON;
|
||||
}
|
||||
|
||||
TEST_CASE("[RegEx] Substitution with empty input and/or replacement") {
|
||||
|
|
@ -168,7 +177,7 @@ TEST_CASE("[RegEx] Uninitialized use") {
|
|||
|
||||
RegEx re;
|
||||
ERR_PRINT_OFF;
|
||||
CHECK(re.search(s) == nullptr);
|
||||
CHECK(re.search(s).is_null());
|
||||
CHECK(re.search_all(s).size() == 0);
|
||||
CHECK(re.sub(s, "") == "");
|
||||
CHECK(re.get_group_count() == 0);
|
||||
|
|
@ -237,10 +246,10 @@ TEST_CASE("[RegEx] Invalid end position") {
|
|||
const Array all_results = re.search_all(s, 0, 10);
|
||||
CHECK(all_results.size() == 2);
|
||||
match = all_results[0];
|
||||
REQUIRE(match != nullptr);
|
||||
REQUIRE(match.is_valid());
|
||||
CHECK(match->get_string(0) == String("o"));
|
||||
match = all_results[1];
|
||||
REQUIRE(match != nullptr);
|
||||
REQUIRE(match.is_valid());
|
||||
CHECK(match->get_string(0) == String("o"));
|
||||
|
||||
CHECK(re.sub(s, "", true, 0, 10) == "Gdt");
|
||||
|
|
@ -251,7 +260,7 @@ TEST_CASE("[RegEx] Get match string list") {
|
|||
|
||||
RegEx re("(Go)(dot)");
|
||||
Ref<RegExMatch> match = re.search(s);
|
||||
REQUIRE(match != nullptr);
|
||||
REQUIRE(match.is_valid());
|
||||
PackedStringArray result;
|
||||
result.append("Godot");
|
||||
result.append("Go");
|
||||
|
|
@ -265,14 +274,14 @@ TEST_CASE("[RegEx] Match start and end positions") {
|
|||
RegEx re1("pattern");
|
||||
REQUIRE(re1.is_valid());
|
||||
Ref<RegExMatch> match = re1.search(s);
|
||||
REQUIRE(match != nullptr);
|
||||
REQUIRE(match.is_valid());
|
||||
CHECK(match->get_start(0) == 6);
|
||||
CHECK(match->get_end(0) == 13);
|
||||
|
||||
RegEx re2("(?<vowel>[aeiou])");
|
||||
REQUIRE(re2.is_valid());
|
||||
match = re2.search(s);
|
||||
REQUIRE(match != nullptr);
|
||||
REQUIRE(match.is_valid());
|
||||
CHECK(match->get_start("vowel") == 2);
|
||||
CHECK(match->get_end("vowel") == 3);
|
||||
}
|
||||
|
|
@ -307,7 +316,7 @@ TEST_CASE("[RegEx] Simple lookahead") {
|
|||
RegEx re("o(?=t)");
|
||||
REQUIRE(re.is_valid());
|
||||
Ref<RegExMatch> match = re.search(s);
|
||||
REQUIRE(match != nullptr);
|
||||
REQUIRE(match.is_valid());
|
||||
CHECK(match->get_start(0) == 3);
|
||||
CHECK(match->get_end(0) == 4);
|
||||
}
|
||||
|
|
@ -325,12 +334,12 @@ TEST_CASE("[RegEx] Lookahead groups empty matches") {
|
|||
CHECK(all_results.size() == 2);
|
||||
|
||||
match = all_results[0];
|
||||
REQUIRE(match != nullptr);
|
||||
REQUIRE(match.is_valid());
|
||||
CHECK(match->get_string(0) == String(""));
|
||||
CHECK(match->get_string(1) == String("12"));
|
||||
|
||||
match = all_results[1];
|
||||
REQUIRE(match != nullptr);
|
||||
REQUIRE(match.is_valid());
|
||||
CHECK(match->get_string(0) == String(""));
|
||||
CHECK(match->get_string(1) == String("2"));
|
||||
}
|
||||
|
|
@ -341,7 +350,7 @@ TEST_CASE("[RegEx] Simple lookbehind") {
|
|||
RegEx re("(?<=d)o");
|
||||
REQUIRE(re.is_valid());
|
||||
Ref<RegExMatch> match = re.search(s);
|
||||
REQUIRE(match != nullptr);
|
||||
REQUIRE(match.is_valid());
|
||||
CHECK(match->get_start(0) == 3);
|
||||
CHECK(match->get_end(0) == 4);
|
||||
}
|
||||
|
|
@ -355,22 +364,22 @@ TEST_CASE("[RegEx] Simple lookbehind search all") {
|
|||
CHECK(all_results.size() == 4);
|
||||
|
||||
Ref<RegExMatch> match = all_results[0];
|
||||
REQUIRE(match != nullptr);
|
||||
REQUIRE(match.is_valid());
|
||||
CHECK(match->get_start(0) == 1);
|
||||
CHECK(match->get_end(0) == 2);
|
||||
|
||||
match = all_results[1];
|
||||
REQUIRE(match != nullptr);
|
||||
REQUIRE(match.is_valid());
|
||||
CHECK(match->get_start(0) == 3);
|
||||
CHECK(match->get_end(0) == 4);
|
||||
|
||||
match = all_results[2];
|
||||
REQUIRE(match != nullptr);
|
||||
REQUIRE(match.is_valid());
|
||||
CHECK(match->get_start(0) == 7);
|
||||
CHECK(match->get_end(0) == 8);
|
||||
|
||||
match = all_results[3];
|
||||
REQUIRE(match != nullptr);
|
||||
REQUIRE(match.is_valid());
|
||||
CHECK(match->get_start(0) == 9);
|
||||
CHECK(match->get_end(0) == 10);
|
||||
}
|
||||
|
|
@ -386,7 +395,7 @@ TEST_CASE("[RegEx] Lookbehind groups empty matches") {
|
|||
CHECK(all_results.size() == 3);
|
||||
|
||||
match = all_results[0];
|
||||
REQUIRE(match != nullptr);
|
||||
REQUIRE(match.is_valid());
|
||||
CHECK(match->get_start(0) == 2);
|
||||
CHECK(match->get_end(0) == 2);
|
||||
CHECK(match->get_start(1) == 1);
|
||||
|
|
@ -395,7 +404,7 @@ TEST_CASE("[RegEx] Lookbehind groups empty matches") {
|
|||
CHECK(match->get_string(1) == String("b"));
|
||||
|
||||
match = all_results[1];
|
||||
REQUIRE(match != nullptr);
|
||||
REQUIRE(match.is_valid());
|
||||
CHECK(match->get_start(0) == 6);
|
||||
CHECK(match->get_end(0) == 6);
|
||||
CHECK(match->get_start(1) == 5);
|
||||
|
|
@ -404,7 +413,7 @@ TEST_CASE("[RegEx] Lookbehind groups empty matches") {
|
|||
CHECK(match->get_string(1) == String("b"));
|
||||
|
||||
match = all_results[2];
|
||||
REQUIRE(match != nullptr);
|
||||
REQUIRE(match.is_valid());
|
||||
CHECK(match->get_start(0) == 8);
|
||||
CHECK(match->get_end(0) == 8);
|
||||
CHECK(match->get_start(1) == 7);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue