summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-02-03 22:21:24 +0100
committerGitHub <noreply@github.com>2022-02-03 22:21:24 +0100
commitf8f19b313d62b707467c54d245b9c3e0ad53f34f (patch)
tree975f9c64fe51c3809c7c3b2eb0cd46d3563d2bd2 /tests
parent025e778020dde6dcee89f5ae1e2a63ccddc24340 (diff)
parentadbe948bda202209b55249198e1837324e703ddb (diff)
Merge pull request #57562 from AnilBK/string-add-contains
String: Add contains().
Diffstat (limited to 'tests')
-rw-r--r--tests/core/string/test_string.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/core/string/test_string.h b/tests/core/string/test_string.h
index 0446f749cf..bf78298450 100644
--- a/tests/core/string/test_string.h
+++ b/tests/core/string/test_string.h
@@ -245,6 +245,19 @@ TEST_CASE("[String] Testing for empty string") {
CHECK(String("").is_empty());
}
+TEST_CASE("[String] Contains") {
+ String s = "C:\\Godot\\project\\string_test.tscn";
+ CHECK(s.contains(":\\"));
+ CHECK(s.contains("Godot"));
+ CHECK(s.contains(String("project\\string_test")));
+ CHECK(s.contains(String("\\string_test.tscn")));
+
+ CHECK(!s.contains("://"));
+ CHECK(!s.contains("Godoh"));
+ CHECK(!s.contains(String("project\\string test")));
+ CHECK(!s.contains(String("\\char_test.tscn")));
+}
+
TEST_CASE("[String] Test chr") {
CHECK(String::chr('H') == "H");
CHECK(String::chr(0x3012)[0] == 0x3012);