summaryrefslogtreecommitdiffstats
path: root/main/tests/test_string.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main/tests/test_string.cpp')
-rw-r--r--main/tests/test_string.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/main/tests/test_string.cpp b/main/tests/test_string.cpp
index ddc36e807c..b4aeb4d215 100644
--- a/main/tests/test_string.cpp
+++ b/main/tests/test_string.cpp
@@ -942,6 +942,33 @@ bool test_30() {
OS::get_singleton()->print("Capitalize %ls: %ls, %s\n", input.c_str(), output.c_str(), success ? "OK" : "FAIL");
return state;
+}
+
+bool test_31() {
+ bool state = true;
+ bool success;
+
+ String a = "";
+ success = a[0] == 0;
+ OS::get_singleton()->print("Is 0 String[0]:, %s\n", success ? "OK" : "FAIL");
+ if (!success) state = false;
+
+ String b = "Godot";
+ success = b[b.size()] == 0;
+ OS::get_singleton()->print("Is 0 String[size()]:, %s\n", success ? "OK" : "FAIL");
+ if (!success) state = false;
+
+ const String c = "";
+ success = c[0] == 0;
+ OS::get_singleton()->print("Is 0 const String[0]:, %s\n", success ? "OK" : "FAIL");
+ if (!success) state = false;
+
+ const String d = "Godot";
+ success = d[d.size()] == 0;
+ OS::get_singleton()->print("Is 0 const String[size()]:, %s\n", success ? "OK" : "FAIL");
+ if (!success) state = false;
+
+ return state;
};
typedef bool (*TestFunc)(void);
@@ -978,6 +1005,7 @@ TestFunc test_funcs[] = {
test_28,
test_29,
test_30,
+ test_31,
0
};