From b73713d8933b53fcfa322e94fde949c7b2c3827d Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 19 Mar 2019 11:18:48 +0000 Subject: [PATCH] tests: Add a test for g_content_type_guess() with no arguments It should produce a generic result, but not crash. It was previously crashing on macOS. Signed-off-by: Philip Withnall Fixes: #1729 --- gio/tests/contenttype.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gio/tests/contenttype.c b/gio/tests/contenttype.c index b860a1dac..3696e3662 100644 --- a/gio/tests/contenttype.c +++ b/gio/tests/contenttype.c @@ -118,6 +118,14 @@ test_guess (void) g_assert_false (uncertain); g_free (res); g_free (expected); + + /* The data below would be detected as a valid content type, but shouldn’t be read at all. */ + res = g_content_type_guess (NULL, (guchar *)"%!PS-Adobe-2.0 EPSF-1.2", 0, &uncertain); + expected = g_content_type_from_mime_type ("application/x-zerosize"); + g_assert_content_type_equals (expected, res); + g_assert_false (uncertain); + g_free (res); + g_free (expected); } static void