diff options
author | Theraot <Theraot@gmail.com> | 2021-08-24 04:25:59 -0500 |
---|---|---|
committer | Theraot <Theraot@gmail.com> | 2021-08-24 04:25:59 -0500 |
commit | cc78405b12728ede89f53e2a9f6f65a3eb6ee730 (patch) | |
tree | 0c878cd13007fdc5282eaf64776ff4a4603a5001 | |
parent | ef54d35395d3b75cf3189c33cd2d2a096a3ad4a1 (diff) |
Expanded path functions tests
The new tests cover:
- A file with empty extension.
- A file with only extension (a "hidden" file, unix style).
- A file directly at the windows top level directory.
- A file directly at the unix root directory.
- A file directly at the res:// base directory.
-rw-r--r-- | tests/test_string.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/test_string.h b/tests/test_string.h index 79fdb7bb56..aa63ced730 100644 --- a/tests/test_string.h +++ b/tests/test_string.h @@ -1142,14 +1142,14 @@ TEST_CASE("[String] dedent") { } TEST_CASE("[String] Path functions") { - static const char *path[4] = { "C:\\Godot\\project\\test.tscn", "/Godot/project/test.xscn", "../Godot/project/test.scn", "Godot\\test.doc" }; - static const char *base_dir[4] = { "C:\\Godot\\project", "/Godot/project", "../Godot/project", "Godot" }; - static const char *base_name[4] = { "C:\\Godot\\project\\test", "/Godot/project/test", "../Godot/project/test", "Godot\\test" }; - static const char *ext[4] = { "tscn", "xscn", "scn", "doc" }; - static const char *file[4] = { "test.tscn", "test.xscn", "test.scn", "test.doc" }; - static const bool abs[4] = { true, true, false, false }; - - for (int i = 0; i < 4; i++) { + static const char *path[7] = { "C:\\Godot\\project\\test.tscn", "/Godot/project/test.xscn", "../Godot/project/test.scn", "Godot\\test.doc", "C:\\test.", "res://test", "/.test" }; + static const char *base_dir[7] = { "C:\\Godot\\project", "/Godot/project", "../Godot/project", "Godot", "C:\\", "res://", "/" }; + static const char *base_name[7] = { "C:\\Godot\\project\\test", "/Godot/project/test", "../Godot/project/test", "Godot\\test", "C:\\test", "res://test", "/" }; + static const char *ext[7] = { "tscn", "xscn", "scn", "doc", "", "", "test" }; + static const char *file[7] = { "test.tscn", "test.xscn", "test.scn", "test.doc", "test.", "test", ".test" }; + static const bool abs[7] = { true, true, false, false, true, true, true }; + + for (int i = 0; i < 7; i++) { CHECK(String(path[i]).get_base_dir() == base_dir[i]); CHECK(String(path[i]).get_basename() == base_name[i]); CHECK(String(path[i]).get_extension() == ext[i]); |