Merge branch 'move_g_basename_test' into 'main'

Move unit test on g_basename() function to glib/tests/fileutils.c

See merge request GNOME/glib!2558
This commit is contained in:
Philip Withnall 2022-03-21 12:14:59 +00:00
commit 48a3e8f7f2
2 changed files with 16 additions and 13 deletions

View File

@ -1059,7 +1059,8 @@ test_file_errors (void)
static void
test_basename (void)
{
gchar *b;
const gchar *path = "/path/to/a/file/deep/down.sh";
const gchar *b;
if (g_test_undefined ())
{
@ -1067,7 +1068,20 @@ test_basename (void)
"*assertion*!= NULL*");
g_assert_null (g_basename (NULL));
g_test_assert_expected_messages ();
}
b = g_basename (path);
g_assert_cmpstr (b, ==, "down.sh");
}
static void
test_get_basename (void)
{
gchar *b;
if (g_test_undefined ())
{
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
"*assertion*!= NULL*");
g_assert_null (g_path_get_basename (NULL));
@ -2434,6 +2448,7 @@ main (int argc,
g_test_add_func ("/fileutils/format-size-for-display", test_format_size_for_display);
g_test_add_func ("/fileutils/errors", test_file_errors);
g_test_add_func ("/fileutils/basename", test_basename);
g_test_add_func ("/fileutils/get-basename", test_get_basename);
g_test_add_func ("/fileutils/dirname", test_dirname);
g_test_add_func ("/fileutils/dir-make-tmp", test_dir_make_tmp);
g_test_add_func ("/fileutils/file-open-tmp", test_file_open_tmp);

View File

@ -593,17 +593,6 @@ test_console_charset (void)
#endif
}
static void
test_basename (void)
{
const gchar *path = "/path/to/a/file/deep/down.sh";
const gchar *b;
b = g_basename (path);
g_assert_cmpstr (b, ==, "down.sh");
}
extern const gchar *glib_pgettext (const gchar *msgidctxt, gsize msgidoffset);
static void
@ -1162,7 +1151,6 @@ main (int argc,
g_test_add_func ("/utils/codeset", test_codeset);
g_test_add_func ("/utils/codeset2", test_codeset2);
g_test_add_func ("/utils/console-charset", test_console_charset);
g_test_add_func ("/utils/basename", test_basename);
g_test_add_func ("/utils/gettext", test_gettext);
g_test_add_func ("/utils/username", test_username);
g_test_add_func ("/utils/realname", test_realname);