{glib,gio}/cxx: Add more tests for C++ inline funcs

These could behave differently in C++ so let's ensure this is not the
case.
This commit is contained in:
Marco Trevisan (Treviño)
2023-01-25 16:06:06 +01:00
parent cc0fb5e77c
commit 23da6bade0
2 changed files with 70 additions and 3 deletions

View File

@@ -349,6 +349,30 @@ test_strdup_macro (void)
g_free (str);
}
static void
test_str_has_prefix (void)
{
g_assert_true ((g_str_has_prefix) ("C++ is cool!", "C++"));
}
static void
test_str_has_prefix_macro (void)
{
g_assert_true (g_str_has_prefix ("C++ is cool!", "C++"));
}
static void
test_str_has_suffix (void)
{
g_assert_true ((g_str_has_suffix) ("C++ is cool!", "cool!"));
}
static void
test_str_has_suffix_macro (void)
{
g_assert_true (g_str_has_suffix ("C++ is cool!", "cool!"));
}
static void
test_string_append (void)
{
@@ -473,6 +497,10 @@ main (int argc, char *argv[])
g_test_add_func ("/C++/str-equal", test_str_equal);
g_test_add_func ("/C++/strdup", test_strdup);
g_test_add_func ("/C++/strdup/macro", test_strdup_macro);
g_test_add_func ("/C++/str-has-prefix", test_str_has_prefix);
g_test_add_func ("/C++/str-has-prefix/macro", test_str_has_prefix_macro);
g_test_add_func ("/C++/str-has-suffix", test_str_has_suffix);
g_test_add_func ("/C++/str-has-suffix/macro", test_str_has_suffix_macro);
g_test_add_func ("/C++/string-append", test_string_append);
return g_test_run ();