|
@@ -1451,6 +1451,14 @@ TEST_CASE("[String] Capitalize against many strings") {
|
|
output = "Snake Snake Case";
|
|
output = "Snake Snake Case";
|
|
CHECK(input.capitalize() == output);
|
|
CHECK(input.capitalize() == output);
|
|
|
|
|
|
|
|
+ input = "kebab-case";
|
|
|
|
+ output = "Kebab Case";
|
|
|
|
+ CHECK(input.capitalize() == output);
|
|
|
|
+
|
|
|
|
+ input = "kebab-kebab-case";
|
|
|
|
+ output = "Kebab Kebab Case";
|
|
|
|
+ CHECK(input.capitalize() == output);
|
|
|
|
+
|
|
input = "sha256sum";
|
|
input = "sha256sum";
|
|
output = "Sha 256 Sum";
|
|
output = "Sha 256 Sum";
|
|
CHECK(input.capitalize() == output);
|
|
CHECK(input.capitalize() == output);
|
|
@@ -1471,6 +1479,14 @@ TEST_CASE("[String] Capitalize against many strings") {
|
|
output = "Snake Case Function( Snake Case Arg )";
|
|
output = "Snake Case Function( Snake Case Arg )";
|
|
CHECK(input.capitalize() == output);
|
|
CHECK(input.capitalize() == output);
|
|
|
|
|
|
|
|
+ input = "kebab-case-function( kebab-case-arg )";
|
|
|
|
+ output = "Kebab Case Function( Kebab Case Arg )";
|
|
|
|
+ CHECK(input.capitalize() == output);
|
|
|
|
+
|
|
|
|
+ input = "kebab_case_function( kebab_case_arg )";
|
|
|
|
+ output = "Kebab Case Function( Kebab Case Arg )";
|
|
|
|
+ CHECK(input.capitalize() == output);
|
|
|
|
+
|
|
input = U"словоСлово_слово слово";
|
|
input = U"словоСлово_слово слово";
|
|
output = U"Слово Слово Слово Слово";
|
|
output = U"Слово Слово Слово Слово";
|
|
CHECK(input.capitalize() == output);
|
|
CHECK(input.capitalize() == output);
|
|
@@ -1489,35 +1505,37 @@ struct StringCasesTestCase {
|
|
const char32_t *camel_case;
|
|
const char32_t *camel_case;
|
|
const char32_t *pascal_case;
|
|
const char32_t *pascal_case;
|
|
const char32_t *snake_case;
|
|
const char32_t *snake_case;
|
|
|
|
+ const char32_t *kebab_case;
|
|
};
|
|
};
|
|
|
|
|
|
TEST_CASE("[String] Checking case conversion methods") {
|
|
TEST_CASE("[String] Checking case conversion methods") {
|
|
StringCasesTestCase test_cases[] = {
|
|
StringCasesTestCase test_cases[] = {
|
|
/* clang-format off */
|
|
/* clang-format off */
|
|
- { U"2D", U"2d", U"2d", U"2d" },
|
|
|
|
- { U"2d", U"2d", U"2d", U"2d" },
|
|
|
|
- { U"2db", U"2Db", U"2Db", U"2_db" },
|
|
|
|
- { U"Vector3", U"vector3", U"Vector3", U"vector_3" },
|
|
|
|
- { U"sha256", U"sha256", U"Sha256", U"sha_256" },
|
|
|
|
- { U"Node2D", U"node2d", U"Node2d", U"node_2d" },
|
|
|
|
- { U"RichTextLabel", U"richTextLabel", U"RichTextLabel", U"rich_text_label" },
|
|
|
|
- { U"HTML5", U"html5", U"Html5", U"html_5" },
|
|
|
|
- { U"Node2DPosition", U"node2dPosition", U"Node2dPosition", U"node_2d_position" },
|
|
|
|
- { U"Number2Digits", U"number2Digits", U"Number2Digits", U"number_2_digits" },
|
|
|
|
- { U"get_property_list", U"getPropertyList", U"GetPropertyList", U"get_property_list" },
|
|
|
|
- { U"get_camera_2d", U"getCamera2d", U"GetCamera2d", U"get_camera_2d" },
|
|
|
|
- { U"_physics_process", U"physicsProcess", U"PhysicsProcess", U"_physics_process" },
|
|
|
|
- { U"bytes2var", U"bytes2Var", U"Bytes2Var", U"bytes_2_var" },
|
|
|
|
- { U"linear2db", U"linear2Db", U"Linear2Db", U"linear_2_db" },
|
|
|
|
- { U"sha256sum", U"sha256Sum", U"Sha256Sum", U"sha_256_sum" },
|
|
|
|
- { U"camelCase", U"camelCase", U"CamelCase", U"camel_case" },
|
|
|
|
- { U"PascalCase", U"pascalCase", U"PascalCase", U"pascal_case" },
|
|
|
|
- { U"snake_case", U"snakeCase", U"SnakeCase", U"snake_case" },
|
|
|
|
- { U"Test TEST test", U"testTestTest", U"TestTestTest", U"test_test_test" },
|
|
|
|
- { U"словоСлово_слово слово", U"словоСловоСловоСлово", U"СловоСловоСловоСлово", U"слово_слово_слово_слово" },
|
|
|
|
- { U"λέξηΛέξη_λέξη λέξη", U"λέξηΛέξηΛέξηΛέξη", U"ΛέξηΛέξηΛέξηΛέξη", U"λέξη_λέξη_λέξη_λέξη" },
|
|
|
|
- { U"բառԲառ_բառ բառ", U"բառԲառԲառԲառ", U"ԲառԲառԲառԲառ", U"բառ_բառ_բառ_բառ" },
|
|
|
|
- { nullptr, nullptr, nullptr, nullptr },
|
|
|
|
|
|
+ { U"2D", U"2d", U"2d", U"2d", U"2d" },
|
|
|
|
+ { U"2d", U"2d", U"2d", U"2d", U"2d" },
|
|
|
|
+ { U"2db", U"2Db", U"2Db", U"2_db", U"2-db" },
|
|
|
|
+ { U"Vector3", U"vector3", U"Vector3", U"vector_3", U"vector-3" },
|
|
|
|
+ { U"sha256", U"sha256", U"Sha256", U"sha_256", U"sha-256" },
|
|
|
|
+ { U"Node2D", U"node2d", U"Node2d", U"node_2d", U"node-2d" },
|
|
|
|
+ { U"RichTextLabel", U"richTextLabel", U"RichTextLabel", U"rich_text_label", U"rich-text-label" },
|
|
|
|
+ { U"HTML5", U"html5", U"Html5", U"html_5", U"html-5" },
|
|
|
|
+ { U"Node2DPosition", U"node2dPosition", U"Node2dPosition", U"node_2d_position", U"node-2d-position" },
|
|
|
|
+ { U"Number2Digits", U"number2Digits", U"Number2Digits", U"number_2_digits", U"number-2-digits" },
|
|
|
|
+ { U"get_property_list", U"getPropertyList", U"GetPropertyList", U"get_property_list", U"get-property-list" },
|
|
|
|
+ { U"get_camera_2d", U"getCamera2d", U"GetCamera2d", U"get_camera_2d", U"get-camera-2d" },
|
|
|
|
+ { U"_physics_process", U"physicsProcess", U"PhysicsProcess", U"_physics_process", U"-physics-process" },
|
|
|
|
+ { U"bytes2var", U"bytes2Var", U"Bytes2Var", U"bytes_2_var", U"bytes-2-var" },
|
|
|
|
+ { U"linear2db", U"linear2Db", U"Linear2Db", U"linear_2_db", U"linear-2-db" },
|
|
|
|
+ { U"sha256sum", U"sha256Sum", U"Sha256Sum", U"sha_256_sum", U"sha-256-sum" },
|
|
|
|
+ { U"camelCase", U"camelCase", U"CamelCase", U"camel_case", U"camel-case" },
|
|
|
|
+ { U"PascalCase", U"pascalCase", U"PascalCase", U"pascal_case", U"pascal-case" },
|
|
|
|
+ { U"snake_case", U"snakeCase", U"SnakeCase", U"snake_case", U"snake-case" },
|
|
|
|
+ { U"kebab-case", U"kebabCase", U"KebabCase", U"kebab_case", U"kebab-case" },
|
|
|
|
+ { U"Test TEST test", U"testTestTest", U"TestTestTest", U"test_test_test", U"test-test-test" },
|
|
|
|
+ { U"словоСлово_слово слово", U"словоСловоСловоСлово", U"СловоСловоСловоСлово", U"слово_слово_слово_слово", U"слово-слово-слово-слово" },
|
|
|
|
+ { U"λέξηΛέξη_λέξη λέξη", U"λέξηΛέξηΛέξηΛέξη", U"ΛέξηΛέξηΛέξηΛέξη", U"λέξη_λέξη_λέξη_λέξη", U"λέξη-λέξη-λέξη-λέξη" },
|
|
|
|
+ { U"բառԲառ_բառ բառ", U"բառԲառԲառԲառ", U"ԲառԲառԲառԲառ", U"բառ_բառ_բառ_բառ", U"բառ-բառ-բառ-բառ" },
|
|
|
|
+ { nullptr, nullptr, nullptr, nullptr, nullptr },
|
|
/* clang-format on */
|
|
/* clang-format on */
|
|
};
|
|
};
|
|
|
|
|
|
@@ -1527,6 +1545,7 @@ TEST_CASE("[String] Checking case conversion methods") {
|
|
CHECK(input.to_camel_case() == test_cases[idx].camel_case);
|
|
CHECK(input.to_camel_case() == test_cases[idx].camel_case);
|
|
CHECK(input.to_pascal_case() == test_cases[idx].pascal_case);
|
|
CHECK(input.to_pascal_case() == test_cases[idx].pascal_case);
|
|
CHECK(input.to_snake_case() == test_cases[idx].snake_case);
|
|
CHECK(input.to_snake_case() == test_cases[idx].snake_case);
|
|
|
|
+ CHECK(input.to_kebab_case() == test_cases[idx].kebab_case);
|
|
idx++;
|
|
idx++;
|
|
}
|
|
}
|
|
}
|
|
}
|