summaryrefslogtreecommitdiff
path: root/tests/core/string/test_string.h
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2022-05-17 13:58:51 +0200
committerGitHub <noreply@github.com>2022-05-17 13:58:51 +0200
commit1d5e6627667f6963d9b29f85fa71c9d4240c07e7 (patch)
tree62af7ac456cb8c7fc84544c361d07bb3e9f77d56 /tests/core/string/test_string.h
parent350682593067b310843fe069a676fbc62f5978a9 (diff)
parent3094e739f541e571fea65e3a7a14adb7ee9711b0 (diff)
Merge pull request #60708 from timothyqiu/drop-onready
Diffstat (limited to 'tests/core/string/test_string.h')
-rw-r--r--tests/core/string/test_string.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/core/string/test_string.h b/tests/core/string/test_string.h
index 58372a0ed6..0b191d2d94 100644
--- a/tests/core/string/test_string.h
+++ b/tests/core/string/test_string.h
@@ -1447,6 +1447,20 @@ TEST_CASE("[String] validate_node_name") {
CHECK(name_with_invalid_chars.validate_node_name() == "Name with invalid characters removed!");
}
+TEST_CASE("[String] validate_identifier") {
+ String empty_string;
+ CHECK(empty_string.validate_identifier() == "_");
+
+ String numeric_only = "12345";
+ CHECK(numeric_only.validate_identifier() == "_2345");
+
+ String name_with_spaces = "Name with spaces";
+ CHECK(name_with_spaces.validate_identifier() == "Name_with_spaces");
+
+ String name_with_invalid_chars = String::utf8("Invalid characters:@*#&世界");
+ CHECK(name_with_invalid_chars.validate_identifier() == "Invalid_characters_______");
+}
+
TEST_CASE("[String] Variant indexed get") {
Variant s = String("abcd");
bool valid = false;