[totem-pl-parser/wip/hadess/more-encoding: 3/4] tests: Fix invalid UTF-8 RSS test




commit 988ab5073a692e70f4d80f69f6e150d42fa44aa1
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Mar 4 15:47:26 2021 +0100

    tests: Fix invalid UTF-8 RSS test
    
    The test expected us to pass invalid UTF-8 through, and just feed it to
    the calling application.
    
    GLib APIs actually guarantee that data passed is UTF-8 unless stated
    otherwise, so make sure that no data is parsed if the data isn't UTF-8
    and we can't detect what encoding it's in.

 plparse/tests/parser.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/plparse/tests/parser.c b/plparse/tests/parser.c
index dabe7f2..05b6928 100644
--- a/plparse/tests/parser.c
+++ b/plparse/tests/parser.c
@@ -1011,7 +1011,11 @@ test_invalid_utf8_characters (void)
 
        /* Test all entries have been parsed by checking entry count */
        uri = get_relative_uri (TEST_SRCDIR "invalid-utf8-characters.rss");
+#ifdef HAVE_UCHARDET
        g_assert_cmpuint (parser_test_get_num_entries (uri), ==, 4);
+#else
+       g_assert_cmpint (simple_parser_test (uri), !=, TOTEM_PL_PARSER_RESULT_SUCCESS);
+#endif
        g_free (uri);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]