}
END_TEST
+/* Test big-endian UTF-16 given an explicit little-endian encoding */
+START_TEST(test_ext_entity_utf16_le)
+{
+ const char *text =
+ "<!DOCTYPE doc [\n"
+ " <!ENTITY en SYSTEM 'http://example.org/dummy.ent'>\n"
+ "]>\n"
+ "<doc>&en;</doc>";
+ ExtTest2 test_data = {
+ "\0<\0e\0/\0>",
+ 8,
+ "utf-16le",
+ NULL,
+ EE_PARSE_NONE
+ };
+ const XML_Char *expected =
+ "\xe3\xb0\x80" /* U+3C00 */
+ "\xe6\x94\x80" /* U+6A00 */
+ "\xe2\xbc\x80" /* U+2F00 */
+ "\xe3\xb8\x80"; /* U+3E00 */
+ CharData storage;
+
+ CharData_Init(&storage);
+ test_data.storage = &storage;
+ XML_SetExternalEntityRefHandler(parser, external_entity_loader2);
+ XML_SetUserData(parser, &test_data);
+ XML_SetCharacterDataHandler(parser, ext2_accumulate_characters);
+ if (_XML_Parse_SINGLE_BYTES(parser, text, strlen(text),
+ XML_TRUE) == XML_STATUS_ERROR)
+ xml_failure(parser);
+ CharData_CheckXMLChars(&storage, expected);
+}
+END_TEST
+
/* Test not-quite-UTF-8 BOM (0xEF 0xBB 0xBF) */
START_TEST(test_ext_entity_utf8_non_bom)
{
tcase_add_test(tc_basic, test_ext_entity_latin1_utf16le_bom2);
tcase_add_test(tc_basic, test_ext_entity_latin1_utf16be_bom2);
tcase_add_test(tc_basic, test_ext_entity_utf16_be);
+ tcase_add_test(tc_basic, test_ext_entity_utf16_le);
tcase_add_test(tc_basic, test_ext_entity_utf8_non_bom);
suite_add_tcase(s, tc_namespace);