From 1fbdc13dcb5049412cd297cc8175bd8dc1d51498 Mon Sep 17 00:00:00 2001 From: Rhodri James Date: Tue, 28 Feb 2017 15:33:55 +0000 Subject: [PATCH] Test a bad encoding is rejected at initialisation time --- expat/tests/runtests.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/expat/tests/runtests.c b/expat/tests/runtests.c index 9ad3b073..12542724 100644 --- a/expat/tests/runtests.c +++ b/expat/tests/runtests.c @@ -681,6 +681,19 @@ START_TEST(test_not_utf16) } END_TEST +/* Test that an unknown encoding is rejected */ +START_TEST(test_bad_encoding) +{ + const char *text = "Hi"; + + if (!XML_SetEncoding(parser, "unknown-encoding")) + fail("XML_SetEncoding failed"); + expect_failure(text, + XML_ERROR_UNKNOWN_ENCODING, + "Unknown encoding not faulted"); +} +END_TEST + /* Regression test for SF bug #481609, #774028. */ START_TEST(test_latin1_umlauts) { @@ -5865,6 +5878,7 @@ make_suite(void) tcase_add_test(tc_basic, test_utf16); tcase_add_test(tc_basic, test_utf16_le_epilog_newline); tcase_add_test(tc_basic, test_not_utf16); + tcase_add_test(tc_basic, test_bad_encoding); tcase_add_test(tc_basic, test_latin1_umlauts); /* Regression test for SF bug #491986. */ tcase_add_test(tc_basic, test_danish_latin1); -- 2.40.0