From d52b4141496bd26bd716d88c67af8f2250bd0da6 Mon Sep 17 00:00:00 2001 From: Snild Dolkow Date: Thu, 24 Aug 2023 09:31:31 +0200 Subject: [PATCH] tests: Move triplet_start_checker flag check after isFinal=1 call There is no guarantee that the callback will happen before the parse call with isFinal=XML_TRUE. Let's move the assertion to a location where we know it must have happened. --- expat/tests/ns_tests.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/expat/tests/ns_tests.c b/expat/tests/ns_tests.c index 826018b6..5ecb09ac 100644 --- a/expat/tests/ns_tests.c +++ b/expat/tests/ns_tests.c @@ -18,6 +18,7 @@ Copyright (c) 2019 David Loffredo Copyright (c) 2020 Tim Gates Copyright (c) 2021 Dong-hee Na + Copyright (c) 2023 Sony Corporation / Snild Dolkow Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining @@ -81,13 +82,13 @@ START_TEST(test_return_ns_triplet) { if (_XML_Parse_SINGLE_BYTES(g_parser, text, (int)strlen(text), XML_FALSE) == XML_STATUS_ERROR) xml_failure(g_parser); - if (! g_triplet_start_flag) - fail("triplet_start_checker not invoked"); /* Check that unsetting "return triplets" fails while still parsing */ XML_SetReturnNSTriplet(g_parser, XML_FALSE); if (_XML_Parse_SINGLE_BYTES(g_parser, epilog, (int)strlen(epilog), XML_TRUE) == XML_STATUS_ERROR) xml_failure(g_parser); + if (! g_triplet_start_flag) + fail("triplet_start_checker not invoked"); if (! g_triplet_end_flag) fail("triplet_end_checker not invoked"); if (get_dummy_handler_flags()