talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

xml_test.c (891B)


      1 #include "config.h"
      2 
      3 #include <glib.h>
      4 
      5 #include "xml.h"
      6 
      7 #include "mock_prefs_common_get_use_shred.h"
      8 #include "mock_prefs_common_get_flush_metadata.h"
      9 
     10 #define DATADIR "data/"
     11 
     12 static void
     13 test_xml_open_file_missing(void)
     14 {
     15 	XMLFile *xf = xml_open_file(DATADIR "missing.xml");
     16 	g_assert_null(xf);
     17 }
     18 
     19 static void
     20 test_xml_open_file_empty(void)
     21 {
     22 	XMLFile *xf = xml_open_file(DATADIR "empty.xml");
     23 	g_assert_nonnull(xf);
     24 	g_assert_nonnull(xf->buf);
     25 	g_assert_nonnull(xf->bufp);
     26 	g_assert_null(xf->dtd);
     27 	g_assert_null(xf->encoding);
     28 	g_assert_null(xf->tag_stack);
     29 	g_assert_cmpint(xf->level, ==, 0);
     30 	g_assert_false(xf->is_empty_element);
     31 }
     32 
     33 int
     34 main(int argc, char *argv[])
     35 {
     36 	g_test_init(&argc, &argv, NULL);
     37 
     38 	g_test_add_func("/common/xml_open_file_missing", test_xml_open_file_missing);
     39 	g_test_add_func("/common/xml_open_file_empty", test_xml_open_file_empty);
     40 
     41 	return g_test_run();
     42 }