diff options
author | Matthias Clasen <mclasen@redhat.com> | 2010-07-29 20:52:31 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2010-07-30 19:51:21 -0400 |
commit | 03be0d7237c7f250e01b785af4e4e4e8724a3e8f (patch) | |
tree | 1e623e5858b7e506eb278b851e2f9d71e96cd59e | |
parent | aa196c60df8bbe6f8e998780579b12863098107f (diff) | |
download | glib-03be0d7237c7f250e01b785af4e4e4e8724a3e8f.tar.gz |
Move markup parse tests to the test framework
-rw-r--r-- | glib/tests/Makefile.am | 20 | ||||
-rw-r--r-- | glib/tests/markup-parse.c | 290 | ||||
-rw-r--r-- | glib/tests/markups/fail-1.expected | 1 | ||||
-rw-r--r-- | glib/tests/markups/fail-1.gmarkup (renamed from tests/markups/fail-1.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-10.expected | 4 | ||||
-rw-r--r-- | glib/tests/markups/fail-10.gmarkup (renamed from tests/markups/fail-10.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-11.expected | 7 | ||||
-rw-r--r-- | glib/tests/markups/fail-11.gmarkup (renamed from tests/markups/fail-11.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-12.expected | 1 | ||||
-rw-r--r-- | glib/tests/markups/fail-12.gmarkup (renamed from tests/markups/fail-12.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-13.expected | 1 | ||||
-rw-r--r-- | glib/tests/markups/fail-13.gmarkup (renamed from tests/markups/fail-13.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-14.expected | 4 | ||||
-rw-r--r-- | glib/tests/markups/fail-14.gmarkup (renamed from tests/markups/fail-14.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-15.expected | 8 | ||||
-rw-r--r-- | glib/tests/markups/fail-15.gmarkup (renamed from tests/markups/fail-15.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-16.expected | 2 | ||||
-rw-r--r-- | glib/tests/markups/fail-16.gmarkup (renamed from tests/markups/fail-16.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-17.expected | 1 | ||||
-rw-r--r-- | glib/tests/markups/fail-17.gmarkup (renamed from tests/markups/fail-17.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-18.expected | 1 | ||||
-rw-r--r-- | glib/tests/markups/fail-18.gmarkup (renamed from tests/markups/fail-18.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-19.expected | 1 | ||||
-rw-r--r-- | glib/tests/markups/fail-19.gmarkup (renamed from tests/markups/fail-19.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-2.expected | 1 | ||||
-rw-r--r-- | glib/tests/markups/fail-2.gmarkup (renamed from tests/markups/fail-2.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-20.expected | 1 | ||||
-rw-r--r-- | glib/tests/markups/fail-20.gmarkup (renamed from tests/markups/fail-20.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-21.expected | 1 | ||||
-rw-r--r-- | glib/tests/markups/fail-21.gmarkup (renamed from tests/markups/fail-21.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-22.expected | 2 | ||||
-rw-r--r-- | glib/tests/markups/fail-22.gmarkup (renamed from tests/markups/fail-22.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-23.expected | 4 | ||||
-rw-r--r-- | glib/tests/markups/fail-23.gmarkup (renamed from tests/markups/fail-23.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-24.expected | 1 | ||||
-rw-r--r-- | glib/tests/markups/fail-24.gmarkup (renamed from tests/markups/fail-24.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-25.expected | 1 | ||||
-rw-r--r-- | glib/tests/markups/fail-25.gmarkup (renamed from tests/markups/fail-25.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-26.expected | 2 | ||||
-rw-r--r-- | glib/tests/markups/fail-26.gmarkup (renamed from tests/markups/fail-26.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-27.expected | 2 | ||||
-rw-r--r-- | glib/tests/markups/fail-27.gmarkup (renamed from tests/markups/fail-27.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-28.expected | 2 | ||||
-rw-r--r-- | glib/tests/markups/fail-28.gmarkup (renamed from tests/markups/fail-28.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-29.expected | 2 | ||||
-rw-r--r-- | glib/tests/markups/fail-29.gmarkup (renamed from tests/markups/fail-29.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-3.gmarkup (renamed from tests/markups/fail-3.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-30.expected | 2 | ||||
-rw-r--r-- | glib/tests/markups/fail-30.gmarkup (renamed from tests/markups/fail-30.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-31.expected | 2 | ||||
-rw-r--r-- | glib/tests/markups/fail-31.gmarkup (renamed from tests/markups/fail-31.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-32.expected | 2 | ||||
-rw-r--r-- | glib/tests/markups/fail-32.gmarkup (renamed from tests/markups/fail-32.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-33.expected | 2 | ||||
-rw-r--r-- | glib/tests/markups/fail-33.gmarkup (renamed from tests/markups/fail-33.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-34.expected | 2 | ||||
-rw-r--r-- | glib/tests/markups/fail-34.gmarkup (renamed from tests/markups/fail-34.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-35.expected | 2 | ||||
-rw-r--r-- | glib/tests/markups/fail-35.gmarkup (renamed from tests/markups/fail-35.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-36.gmarkup (renamed from tests/markups/fail-36.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-37.expected | 1 | ||||
-rw-r--r-- | glib/tests/markups/fail-37.gmarkup (renamed from tests/markups/fail-37.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-38.expected | 3 | ||||
-rw-r--r-- | glib/tests/markups/fail-38.gmarkup (renamed from tests/markups/fail-38.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-39.expected | 3 | ||||
-rw-r--r-- | glib/tests/markups/fail-39.gmarkup (renamed from tests/markups/fail-39.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-4.expected | 1 | ||||
-rw-r--r-- | glib/tests/markups/fail-4.gmarkup (renamed from tests/markups/fail-4.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-40.expected | 2 | ||||
-rw-r--r-- | glib/tests/markups/fail-40.gmarkup (renamed from tests/markups/fail-40.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-5.expected | 1 | ||||
-rw-r--r-- | glib/tests/markups/fail-5.gmarkup (renamed from tests/markups/fail-5.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-6.expected | 1 | ||||
-rw-r--r-- | glib/tests/markups/fail-6.gmarkup (renamed from tests/markups/fail-6.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-7.expected | 1 | ||||
-rw-r--r-- | glib/tests/markups/fail-7.gmarkup (renamed from tests/markups/fail-7.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-8.expected | 3 | ||||
-rw-r--r-- | glib/tests/markups/fail-8.gmarkup (renamed from tests/markups/fail-8.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/fail-9.expected | 1 | ||||
-rw-r--r-- | glib/tests/markups/fail-9.gmarkup (renamed from tests/markups/fail-9.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/valid-1.expected (renamed from tests/markups/expected-1) | 0 | ||||
-rw-r--r-- | glib/tests/markups/valid-1.gmarkup (renamed from tests/markups/valid-1.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/valid-10.expected (renamed from tests/markups/expected-10) | 0 | ||||
-rw-r--r-- | glib/tests/markups/valid-10.gmarkup (renamed from tests/markups/valid-10.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/valid-11.expected (renamed from tests/markups/expected-11) | 0 | ||||
-rw-r--r-- | glib/tests/markups/valid-11.gmarkup (renamed from tests/markups/valid-11.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/valid-2.expected (renamed from tests/markups/expected-2) | 0 | ||||
-rw-r--r-- | glib/tests/markups/valid-2.gmarkup (renamed from tests/markups/valid-2.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/valid-3.expected (renamed from tests/markups/expected-3) | 0 | ||||
-rw-r--r-- | glib/tests/markups/valid-3.gmarkup (renamed from tests/markups/valid-3.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/valid-4.expected (renamed from tests/markups/expected-4) | 0 | ||||
-rw-r--r-- | glib/tests/markups/valid-4.gmarkup (renamed from tests/markups/valid-4.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/valid-5.expected (renamed from tests/markups/expected-5) | 0 | ||||
-rw-r--r-- | glib/tests/markups/valid-5.gmarkup (renamed from tests/markups/valid-5.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/valid-6.expected (renamed from tests/markups/expected-6) | 0 | ||||
-rw-r--r-- | glib/tests/markups/valid-6.gmarkup (renamed from tests/markups/valid-6.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/valid-7.expected (renamed from tests/markups/expected-7) | 0 | ||||
-rw-r--r-- | glib/tests/markups/valid-7.gmarkup (renamed from tests/markups/valid-7.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/valid-8.expected (renamed from tests/markups/expected-8) | 0 | ||||
-rw-r--r-- | glib/tests/markups/valid-8.gmarkup (renamed from tests/markups/valid-8.gmarkup) | 0 | ||||
-rw-r--r-- | glib/tests/markups/valid-9.expected (renamed from tests/markups/expected-9) | 0 | ||||
-rw-r--r-- | glib/tests/markups/valid-9.gmarkup (renamed from tests/markups/valid-9.gmarkup) | 0 | ||||
-rw-r--r-- | tests/Makefile.am | 8 | ||||
-rw-r--r-- | tests/markup-test.c | 214 | ||||
-rwxr-xr-x | tests/run-markup-tests.sh | 41 |
105 files changed, 385 insertions, 267 deletions
diff --git a/glib/tests/Makefile.am b/glib/tests/Makefile.am index c2d6f0ab0..0269dc95e 100644 --- a/glib/tests/Makefile.am +++ b/glib/tests/Makefile.am @@ -47,6 +47,15 @@ TEST_PROGS += string string_SOURCES = string.c string_LDADD = $(progs_ldadd) -lm +TEST_PROGS += markup-parse +markup_parse_LDADD = $(progs_ldadd) + +TEST_PROGS += markup-collect +markup_collect_LDADD = $(progs_ldadd) + +TEST_PROGS += markup-escape +markup_escape_LDADD = $(progs_ldadd) + TEST_PROGS += markup-subparser markup_subparser_LDADD = $(progs_ldadd) @@ -128,15 +137,9 @@ dir_LDADD = $(progs_ldadd) TEST_PROGS += pattern pattern_LDADD = $(progs_ldadd) -TEST_PROGS += markup-escape -markup_escape_LDADD = $(progs_ldadd) - TEST_PROGS += logging logging_LDADD = $(progs_ldadd) -TEST_PROGS += markup-collect -markup_collect_LDADD = $(progs_ldadd) - if OS_UNIX # some testing of gtester funcitonality @@ -155,3 +158,8 @@ EXTRA_DIST += \ 4096-random-bytes \ keyfiletest.ini \ bookmarks.xbel + +dist_hook: + mkdir $(distdir)/markups; \ + for f in $(srcdir)/markups/*; do \ + cp $$f $(distdir)/markups; done diff --git a/glib/tests/markup-parse.c b/glib/tests/markup-parse.c new file mode 100644 index 000000000..62f1718b9 --- /dev/null +++ b/glib/tests/markup-parse.c @@ -0,0 +1,290 @@ +#undef G_DISABLE_ASSERT +#undef G_LOG_DOMAIN + +#include <string.h> +#include <stdio.h> +#include <glib.h> + +#ifndef SRCDIR +#define SRCDIR "." +#endif + +static int depth = 0; +static GString *string; + +static void +indent (int extra) +{ + int i = 0; + while (i < depth) + { + g_string_append (string, " "); + ++i; + } +} + +static void +start_element_handler (GMarkupParseContext *context, + const gchar *element_name, + const gchar **attribute_names, + const gchar **attribute_values, + gpointer user_data, + GError **error) +{ + int i; + + indent (0); + g_string_append_printf (string, "ELEMENT '%s'\n", element_name); + + i = 0; + while (attribute_names[i] != NULL) + { + indent (1); + + g_string_append_printf (string, "%s=\"%s\"\n", + attribute_names[i], + attribute_values[i]); + + ++i; + } + + ++depth; +} + +static void +end_element_handler (GMarkupParseContext *context, + const gchar *element_name, + gpointer user_data, + GError **error) +{ + --depth; + indent (0); + g_string_append_printf (string, "END '%s'\n", element_name); + } + +static void +text_handler (GMarkupParseContext *context, + const gchar *text, + gsize text_len, + gpointer user_data, + GError **error) +{ + indent (0); + g_string_append_printf (string, "TEXT '%.*s'\n", (int)text_len, text); +} + + +static void +passthrough_handler (GMarkupParseContext *context, + const gchar *passthrough_text, + gsize text_len, + gpointer user_data, + GError **error) +{ + indent (0); + + g_string_append_printf (string, "PASS '%.*s'\n", (int)text_len, passthrough_text); +} + +static void +error_handler (GMarkupParseContext *context, + GError *error, + gpointer user_data) +{ + g_string_append_printf (string, "ERROR %s\n", error->message); +} + +static const GMarkupParser parser = { + start_element_handler, + end_element_handler, + text_handler, + passthrough_handler, + error_handler +}; + +static const GMarkupParser silent_parser = { + NULL, + NULL, + NULL, + NULL, + error_handler +}; + +static int +test_in_chunks (const gchar *contents, + gint length, + gint chunk_size) +{ + GMarkupParseContext *context; + int i = 0; + + context = g_markup_parse_context_new (&silent_parser, 0, NULL, NULL); + + while (i < length) + { + int this_chunk = MIN (length - i, chunk_size); + + if (!g_markup_parse_context_parse (context, + contents + i, + this_chunk, + NULL)) + { + g_markup_parse_context_free (context); + return 1; + } + + i += this_chunk; + } + + if (!g_markup_parse_context_end_parse (context, NULL)) + { + g_markup_parse_context_free (context); + return 1; + } + + g_markup_parse_context_free (context); + + return 0; +} + +static int +test_file (const gchar *filename) +{ + gchar *contents; + gsize length; + GError *error; + GMarkupParseContext *context; + gint line, col; + + error = NULL; + if (!g_file_get_contents (filename, + &contents, + &length, + &error)) + { + fprintf (stderr, "%s\n", error->message); + g_error_free (error); + return 1; + } + + context = g_markup_parse_context_new (&parser, 0, NULL, NULL); + g_assert (g_markup_parse_context_get_user_data (context) == NULL); + g_markup_parse_context_get_position (context, &line, &col); + g_assert (line == 1 && col == 1); + + if (!g_markup_parse_context_parse (context, contents, length, NULL)) + { + g_markup_parse_context_free (context); + return 1; + } + + if (!g_markup_parse_context_end_parse (context, NULL)) + { + g_markup_parse_context_free (context); + return 1; + } + + g_markup_parse_context_free (context); + + /* A byte at a time */ + if (test_in_chunks (contents, length, 1) != 0) + return 1; + + /* 2 bytes */ + if (test_in_chunks (contents, length, 2) != 0) + return 1; + + /*5 bytes */ + if (test_in_chunks (contents, length, 5) != 0) + return 1; + + /* 12 bytes */ + if (test_in_chunks (contents, length, 12) != 0) + return 1; + + /* 1024 bytes */ + if (test_in_chunks (contents, length, 1024) != 0) + return 1; + + return 0; +} + +static gchar * +get_expected_filename (const gchar *filename) +{ + gchar *f, *p, *expected; + + f = g_strdup (filename); + p = strstr (f, ".gmarkup"); + *p = 0; + expected = g_strconcat (f, ".expected", NULL); + g_free (f); + + return expected; +} + +static void +test_parse (gconstpointer d) +{ + const gchar *filename = d; + gchar *expected_file; + gchar *expected; + gint res; + + depth = 0; + string = g_string_sized_new (0); + + res = test_file (filename); + + if (strstr (filename, "valid")) + g_assert_cmpint (res, ==, 0); + else + g_assert_cmpint (res, ==, 1); + + expected_file = get_expected_filename (filename); + if (g_file_get_contents (expected_file, &expected, NULL, NULL)) + { + g_assert_cmpstr (string->str, ==, expected); + g_free (expected); + } + g_free (expected_file); + + g_string_free (string, TRUE); +} + +int +main (int argc, char *argv[]) +{ + GDir *dir; + GError *error; + const gchar *name; + gchar *path; + + g_test_init (&argc, &argv, NULL); + + /* allow to easily generate expected output for new test cases */ + if (argc > 1) + { + string = g_string_sized_new (0); + test_file (argv[1]); + g_print (string->str); + return 0; + } + + error = NULL; + dir = g_dir_open (SRCDIR "/markups", 0, &error); + g_assert_no_error (error); + while ((name = g_dir_read_name (dir)) != NULL) + { + if (strstr (name, "expected")) + continue; + + path = g_strdup_printf ("/markup/parse/%s", name); + g_test_add_data_func (path, g_build_filename (SRCDIR, "markups", name, NULL), test_parse); + g_free (path); + } + g_dir_close (dir); + + return g_test_run (); +} + diff --git a/glib/tests/markups/fail-1.expected b/glib/tests/markups/fail-1.expected new file mode 100644 index 000000000..ccd621991 --- /dev/null +++ b/glib/tests/markups/fail-1.expected @@ -0,0 +1 @@ +ERROR Error on line 1 char 1: Document was empty or contained only whitespace diff --git a/tests/markups/fail-1.gmarkup b/glib/tests/markups/fail-1.gmarkup index e69de29bb..e69de29bb 100644 --- a/tests/markups/fail-1.gmarkup +++ b/glib/tests/markups/fail-1.gmarkup diff --git a/glib/tests/markups/fail-10.expected b/glib/tests/markups/fail-10.expected new file mode 100644 index 000000000..7761a2262 --- /dev/null +++ b/glib/tests/markups/fail-10.expected @@ -0,0 +1,4 @@ +ELEMENT 'foo' + TEXT ' +' +ERROR Error on line 2 char 8: Element '|foo' was closed, but the currently open element is 'foo' diff --git a/tests/markups/fail-10.gmarkup b/glib/tests/markups/fail-10.gmarkup index fe16558d2..fe16558d2 100644 --- a/tests/markups/fail-10.gmarkup +++ b/glib/tests/markups/fail-10.gmarkup diff --git a/glib/tests/markups/fail-11.expected b/glib/tests/markups/fail-11.expected new file mode 100644 index 000000000..3a7173d37 --- /dev/null +++ b/glib/tests/markups/fail-11.expected @@ -0,0 +1,7 @@ +ELEMENT 'foo' + TEXT ' +' + ELEMENT 'bar' + TEXT ' +' +ERROR Error on line 3 char 7: Element 'foo' was closed, but the currently open element is 'bar' diff --git a/tests/markups/fail-11.gmarkup b/glib/tests/markups/fail-11.gmarkup index 216f40ccf..216f40ccf 100644 --- a/tests/markups/fail-11.gmarkup +++ b/glib/tests/markups/fail-11.gmarkup diff --git a/glib/tests/markups/fail-12.expected b/glib/tests/markups/fail-12.expected new file mode 100644 index 000000000..0aab7b5f1 --- /dev/null +++ b/glib/tests/markups/fail-12.expected @@ -0,0 +1 @@ +ERROR Error on line 1 char 6: Element 'foo' was closed, no element is currently open diff --git a/tests/markups/fail-12.gmarkup b/glib/tests/markups/fail-12.gmarkup index a64029968..a64029968 100644 --- a/tests/markups/fail-12.gmarkup +++ b/glib/tests/markups/fail-12.gmarkup diff --git a/glib/tests/markups/fail-13.expected b/glib/tests/markups/fail-13.expected new file mode 100644 index 000000000..60157fa4a --- /dev/null +++ b/glib/tests/markups/fail-13.expected @@ -0,0 +1 @@ +ERROR Error on line 1 char 7: Element 'foo|' was closed, no element is currently open diff --git a/tests/markups/fail-13.gmarkup b/glib/tests/markups/fail-13.gmarkup index a71928806..a71928806 100644 --- a/tests/markups/fail-13.gmarkup +++ b/glib/tests/markups/fail-13.gmarkup diff --git a/glib/tests/markups/fail-14.expected b/glib/tests/markups/fail-14.expected new file mode 100644 index 000000000..47e6847cc --- /dev/null +++ b/glib/tests/markups/fail-14.expected @@ -0,0 +1,4 @@ +ELEMENT 'foo' + TEXT ' +' +ERROR Error on line 2 char 3: Document ended unexpectedly just after an open angle bracket '<' diff --git a/tests/markups/fail-14.gmarkup b/glib/tests/markups/fail-14.gmarkup index ed52a60c2..ed52a60c2 100644 --- a/tests/markups/fail-14.gmarkup +++ b/glib/tests/markups/fail-14.gmarkup diff --git a/glib/tests/markups/fail-15.expected b/glib/tests/markups/fail-15.expected new file mode 100644 index 000000000..380ab74d8 --- /dev/null +++ b/glib/tests/markups/fail-15.expected @@ -0,0 +1,8 @@ +ELEMENT 'foo' + TEXT ' +' + ELEMENT 'bar' + TEXT ' +' + END 'bar' +ERROR Error on line 3 char 8: Document ended unexpectedly with elements still open - 'foo' was the last element opened diff --git a/tests/markups/fail-15.gmarkup b/glib/tests/markups/fail-15.gmarkup index c3b59e0d7..c3b59e0d7 100644 --- a/tests/markups/fail-15.gmarkup +++ b/glib/tests/markups/fail-15.gmarkup diff --git a/glib/tests/markups/fail-16.expected b/glib/tests/markups/fail-16.expected new file mode 100644 index 000000000..a9f1f82fe --- /dev/null +++ b/glib/tests/markups/fail-16.expected @@ -0,0 +1,2 @@ +ELEMENT 'foo' +ERROR Error on line 1 char 6: Document ended unexpectedly, expected to see a close angle bracket ending the tag <foo/> diff --git a/tests/markups/fail-16.gmarkup b/glib/tests/markups/fail-16.gmarkup index 20f0148d3..20f0148d3 100644 --- a/tests/markups/fail-16.gmarkup +++ b/glib/tests/markups/fail-16.gmarkup diff --git a/glib/tests/markups/fail-17.expected b/glib/tests/markups/fail-17.expected new file mode 100644 index 000000000..8fce36910 --- /dev/null +++ b/glib/tests/markups/fail-17.expected @@ -0,0 +1 @@ +ERROR Error on line 1 char 4: Document ended unexpectedly inside an element name diff --git a/tests/markups/fail-17.gmarkup b/glib/tests/markups/fail-17.gmarkup index 9f4093ee6..9f4093ee6 100644 --- a/tests/markups/fail-17.gmarkup +++ b/glib/tests/markups/fail-17.gmarkup diff --git a/glib/tests/markups/fail-18.expected b/glib/tests/markups/fail-18.expected new file mode 100644 index 000000000..b50f00954 --- /dev/null +++ b/glib/tests/markups/fail-18.expected @@ -0,0 +1 @@ +ERROR Error on line 1 char 9: Document ended unexpectedly inside an attribute name diff --git a/tests/markups/fail-18.gmarkup b/glib/tests/markups/fail-18.gmarkup index e9d02b30e..e9d02b30e 100644 --- a/tests/markups/fail-18.gmarkup +++ b/glib/tests/markups/fail-18.gmarkup diff --git a/glib/tests/markups/fail-19.expected b/glib/tests/markups/fail-19.expected new file mode 100644 index 000000000..8a4300ab1 --- /dev/null +++ b/glib/tests/markups/fail-19.expected @@ -0,0 +1 @@ +ERROR Error on line 1 char 6: Document ended unexpectedly inside an element-opening tag. diff --git a/tests/markups/fail-19.gmarkup b/glib/tests/markups/fail-19.gmarkup index a253adf46..a253adf46 100644 --- a/tests/markups/fail-19.gmarkup +++ b/glib/tests/markups/fail-19.gmarkup diff --git a/glib/tests/markups/fail-2.expected b/glib/tests/markups/fail-2.expected new file mode 100644 index 000000000..c7d1b6507 --- /dev/null +++ b/glib/tests/markups/fail-2.expected @@ -0,0 +1 @@ +ERROR Error on line 1 char 1: Document must begin with an element (e.g. <book>) diff --git a/tests/markups/fail-2.gmarkup b/glib/tests/markups/fail-2.gmarkup index c7e4a54df..c7e4a54df 100644 --- a/tests/markups/fail-2.gmarkup +++ b/glib/tests/markups/fail-2.gmarkup diff --git a/glib/tests/markups/fail-20.expected b/glib/tests/markups/fail-20.expected new file mode 100644 index 000000000..0dc081bd6 --- /dev/null +++ b/glib/tests/markups/fail-20.expected @@ -0,0 +1 @@ +ERROR Error on line 1 char 10: Document ended unexpectedly after the equals sign following an attribute name; no attribute value diff --git a/tests/markups/fail-20.gmarkup b/glib/tests/markups/fail-20.gmarkup index 39fcbad3a..39fcbad3a 100644 --- a/tests/markups/fail-20.gmarkup +++ b/glib/tests/markups/fail-20.gmarkup diff --git a/glib/tests/markups/fail-21.expected b/glib/tests/markups/fail-21.expected new file mode 100644 index 000000000..5b46ce7a0 --- /dev/null +++ b/glib/tests/markups/fail-21.expected @@ -0,0 +1 @@ +ERROR Error on line 1 char 15: Document ended unexpectedly while inside an attribute value diff --git a/tests/markups/fail-21.gmarkup b/glib/tests/markups/fail-21.gmarkup index 7ae8c6e9a..7ae8c6e9a 100644 --- a/tests/markups/fail-21.gmarkup +++ b/glib/tests/markups/fail-21.gmarkup diff --git a/glib/tests/markups/fail-22.expected b/glib/tests/markups/fail-22.expected new file mode 100644 index 000000000..b9585de18 --- /dev/null +++ b/glib/tests/markups/fail-22.expected @@ -0,0 +1,2 @@ +ELEMENT 'foo' +ERROR Error on line 1 char 6: Document ended unexpectedly with elements still open - 'foo' was the last element opened diff --git a/tests/markups/fail-22.gmarkup b/glib/tests/markups/fail-22.gmarkup index 9e20df031..9e20df031 100644 --- a/tests/markups/fail-22.gmarkup +++ b/glib/tests/markups/fail-22.gmarkup diff --git a/glib/tests/markups/fail-23.expected b/glib/tests/markups/fail-23.expected new file mode 100644 index 000000000..a1b5ce48e --- /dev/null +++ b/glib/tests/markups/fail-23.expected @@ -0,0 +1,4 @@ +ELEMENT 'foo' + TEXT ' +' +ERROR Error on line 2 char 5: Document ended unexpectedly inside an element name diff --git a/tests/markups/fail-23.gmarkup b/glib/tests/markups/fail-23.gmarkup index b57a25b05..b57a25b05 100644 --- a/tests/markups/fail-23.gmarkup +++ b/glib/tests/markups/fail-23.gmarkup diff --git a/glib/tests/markups/fail-24.expected b/glib/tests/markups/fail-24.expected new file mode 100644 index 000000000..b71005a41 --- /dev/null +++ b/glib/tests/markups/fail-24.expected @@ -0,0 +1 @@ +ERROR Error on line 1 char 44: Document ended unexpectedly inside a comment or processing instruction diff --git a/tests/markups/fail-24.gmarkup b/glib/tests/markups/fail-24.gmarkup index 778547fb8..778547fb8 100644 --- a/tests/markups/fail-24.gmarkup +++ b/glib/tests/markups/fail-24.gmarkup diff --git a/glib/tests/markups/fail-25.expected b/glib/tests/markups/fail-25.expected new file mode 100644 index 000000000..063c71023 --- /dev/null +++ b/glib/tests/markups/fail-25.expected @@ -0,0 +1 @@ +ERROR Error on line 1 char 32: Document ended unexpectedly inside a comment or processing instruction diff --git a/tests/markups/fail-25.gmarkup b/glib/tests/markups/fail-25.gmarkup index a3674e622..a3674e622 100644 --- a/tests/markups/fail-25.gmarkup +++ b/glib/tests/markups/fail-25.gmarkup diff --git a/glib/tests/markups/fail-26.expected b/glib/tests/markups/fail-26.expected new file mode 100644 index 000000000..99ab934bb --- /dev/null +++ b/glib/tests/markups/fail-26.expected @@ -0,0 +1,2 @@ +ELEMENT 'foo' +ERROR Error on line 1: Empty entity '&;' seen; valid entities are: & " < > ' diff --git a/tests/markups/fail-26.gmarkup b/glib/tests/markups/fail-26.gmarkup index 10e01505a..10e01505a 100644 --- a/tests/markups/fail-26.gmarkup +++ b/glib/tests/markups/fail-26.gmarkup diff --git a/glib/tests/markups/fail-27.expected b/glib/tests/markups/fail-27.expected new file mode 100644 index 000000000..3090f33f9 --- /dev/null +++ b/glib/tests/markups/fail-27.expected @@ -0,0 +1,2 @@ +ELEMENT 'foo' +ERROR Error on line 1: Entity name '|' is not known diff --git a/tests/markups/fail-27.gmarkup b/glib/tests/markups/fail-27.gmarkup index ab00615bf..ab00615bf 100644 --- a/tests/markups/fail-27.gmarkup +++ b/glib/tests/markups/fail-27.gmarkup diff --git a/glib/tests/markups/fail-28.expected b/glib/tests/markups/fail-28.expected new file mode 100644 index 000000000..e54ab6615 --- /dev/null +++ b/glib/tests/markups/fail-28.expected @@ -0,0 +1,2 @@ +ELEMENT 'foo' +ERROR Error on line 1: Entity name 'am|' is not known diff --git a/tests/markups/fail-28.gmarkup b/glib/tests/markups/fail-28.gmarkup index 3baf17202..3baf17202 100644 --- a/tests/markups/fail-28.gmarkup +++ b/glib/tests/markups/fail-28.gmarkup diff --git a/glib/tests/markups/fail-29.expected b/glib/tests/markups/fail-29.expected new file mode 100644 index 000000000..ddc0090cc --- /dev/null +++ b/glib/tests/markups/fail-29.expected @@ -0,0 +1,2 @@ +ELEMENT 'foo' +ERROR Error on line 1: Entity name 'bar' is not known diff --git a/tests/markups/fail-29.gmarkup b/glib/tests/markups/fail-29.gmarkup index 4e6912fad..4e6912fad 100644 --- a/tests/markups/fail-29.gmarkup +++ b/glib/tests/markups/fail-29.gmarkup diff --git a/tests/markups/fail-3.gmarkup b/glib/tests/markups/fail-3.gmarkup index 0eba18ab3..0eba18ab3 100644 --- a/tests/markups/fail-3.gmarkup +++ b/glib/tests/markups/fail-3.gmarkup diff --git a/glib/tests/markups/fail-30.expected b/glib/tests/markups/fail-30.expected new file mode 100644 index 000000000..15169e35f --- /dev/null +++ b/glib/tests/markups/fail-30.expected @@ -0,0 +1,2 @@ +ELEMENT 'foo' +ERROR Error on line 1: Entity did not end with a semicolon; most likely you used an ampersand character without intending to start an entity - escape ampersand as & diff --git a/tests/markups/fail-30.gmarkup b/glib/tests/markups/fail-30.gmarkup index c8968a808..c8968a808 100644 --- a/tests/markups/fail-30.gmarkup +++ b/glib/tests/markups/fail-30.gmarkup diff --git a/glib/tests/markups/fail-31.expected b/glib/tests/markups/fail-31.expected new file mode 100644 index 000000000..a17ae976c --- /dev/null +++ b/glib/tests/markups/fail-31.expected @@ -0,0 +1,2 @@ +ELEMENT 'foo' +ERROR Error on line 1: Failed to parse '34592348345343453453455645765736575865767', which should have been a digit inside a character reference (ê for example) - perhaps the digit is too large diff --git a/tests/markups/fail-31.gmarkup b/glib/tests/markups/fail-31.gmarkup index cde190d7a..cde190d7a 100644 --- a/tests/markups/fail-31.gmarkup +++ b/glib/tests/markups/fail-31.gmarkup diff --git a/glib/tests/markups/fail-32.expected b/glib/tests/markups/fail-32.expected new file mode 100644 index 000000000..c3d9c45af --- /dev/null +++ b/glib/tests/markups/fail-32.expected @@ -0,0 +1,2 @@ +ELEMENT 'foo' +ERROR Error on line 1: Character reference '0' does not encode a permitted character diff --git a/tests/markups/fail-32.gmarkup b/glib/tests/markups/fail-32.gmarkup index 5e865d026..5e865d026 100644 --- a/tests/markups/fail-32.gmarkup +++ b/glib/tests/markups/fail-32.gmarkup diff --git a/glib/tests/markups/fail-33.expected b/glib/tests/markups/fail-33.expected new file mode 100644 index 000000000..c4854633c --- /dev/null +++ b/glib/tests/markups/fail-33.expected @@ -0,0 +1,2 @@ +ELEMENT 'foo' +ERROR Error on line 1: Failed to parse '', which should have been a digit inside a character reference (ê for example) - perhaps the digit is too large diff --git a/tests/markups/fail-33.gmarkup b/glib/tests/markups/fail-33.gmarkup index 2cc33f497..2cc33f497 100644 --- a/tests/markups/fail-33.gmarkup +++ b/glib/tests/markups/fail-33.gmarkup diff --git a/glib/tests/markups/fail-34.expected b/glib/tests/markups/fail-34.expected new file mode 100644 index 000000000..7fac38c00 --- /dev/null +++ b/glib/tests/markups/fail-34.expected @@ -0,0 +1,2 @@ +ELEMENT 'foo' +ERROR Error on line 1: Character reference did not end with a semicolon; most likely you used an ampersand character without intending to start an entity - escape ampersand as & diff --git a/tests/markups/fail-34.gmarkup b/glib/tests/markups/fail-34.gmarkup index f5523e41a..f5523e41a 100644 --- a/tests/markups/fail-34.gmarkup +++ b/glib/tests/markups/fail-34.gmarkup diff --git a/glib/tests/markups/fail-35.expected b/glib/tests/markups/fail-35.expected new file mode 100644 index 000000000..15169e35f --- /dev/null +++ b/glib/tests/markups/fail-35.expected @@ -0,0 +1,2 @@ +ELEMENT 'foo' +ERROR Error on line 1: Entity did not end with a semicolon; most likely you used an ampersand character without intending to start an entity - escape ampersand as & diff --git a/tests/markups/fail-35.gmarkup b/glib/tests/markups/fail-35.gmarkup index d7f35120a..d7f35120a 100644 --- a/tests/markups/fail-35.gmarkup +++ b/glib/tests/markups/fail-35.gmarkup diff --git a/tests/markups/fail-36.gmarkup b/glib/tests/markups/fail-36.gmarkup index 4e90be4ba..4e90be4ba 100644 --- a/tests/markups/fail-36.gmarkup +++ b/glib/tests/markups/fail-36.gmarkup diff --git a/glib/tests/markups/fail-37.expected b/glib/tests/markups/fail-37.expected new file mode 100644 index 000000000..f04ec3556 --- /dev/null +++ b/glib/tests/markups/fail-37.expected @@ -0,0 +1 @@ +ERROR Error on line 1 char 2: ' ' is not a valid character following a '<' character; it may not begin an element name diff --git a/tests/markups/fail-37.gmarkup b/glib/tests/markups/fail-37.gmarkup index 95b7155f2..95b7155f2 100644 --- a/tests/markups/fail-37.gmarkup +++ b/glib/tests/markups/fail-37.gmarkup diff --git a/glib/tests/markups/fail-38.expected b/glib/tests/markups/fail-38.expected new file mode 100644 index 000000000..f25b4cdd2 --- /dev/null +++ b/glib/tests/markups/fail-38.expected @@ -0,0 +1,3 @@ +ELEMENT 'foo' + TEXT 'data' +ERROR Error on line 1 char 11: ' ' is not a valid character following a '<' character; it may not begin an element name diff --git a/tests/markups/fail-38.gmarkup b/glib/tests/markups/fail-38.gmarkup index b7d37df8d..b7d37df8d 100644 --- a/tests/markups/fail-38.gmarkup +++ b/glib/tests/markups/fail-38.gmarkup diff --git a/glib/tests/markups/fail-39.expected b/glib/tests/markups/fail-39.expected new file mode 100644 index 000000000..de0e4b8db --- /dev/null +++ b/glib/tests/markups/fail-39.expected @@ -0,0 +1,3 @@ +ELEMENT 'foo' + TEXT 'data' +ERROR Error on line 1 char 12: ' ' is not a valid character following the characters '</'; ' ' may not begin an element name diff --git a/tests/markups/fail-39.gmarkup b/glib/tests/markups/fail-39.gmarkup index 7cf2e2a27..7cf2e2a27 100644 --- a/tests/markups/fail-39.gmarkup +++ b/glib/tests/markups/fail-39.gmarkup diff --git a/glib/tests/markups/fail-4.expected b/glib/tests/markups/fail-4.expected new file mode 100644 index 000000000..c7d1b6507 --- /dev/null +++ b/glib/tests/markups/fail-4.expected @@ -0,0 +1 @@ +ERROR Error on line 1 char 1: Document must begin with an element (e.g. <book>) diff --git a/tests/markups/fail-4.gmarkup b/glib/tests/markups/fail-4.gmarkup index 191028156..191028156 100644 --- a/tests/markups/fail-4.gmarkup +++ b/glib/tests/markups/fail-4.gmarkup diff --git a/glib/tests/markups/fail-40.expected b/glib/tests/markups/fail-40.expected new file mode 100644 index 000000000..a2b5cbcb8 --- /dev/null +++ b/glib/tests/markups/fail-40.expected @@ -0,0 +1,2 @@ +ELEMENT 'bla' +ERROR Error on line 1: Entity name 'unknownentityname' is not known diff --git a/tests/markups/fail-40.gmarkup b/glib/tests/markups/fail-40.gmarkup index f4c1a7025..f4c1a7025 100644 --- a/tests/markups/fail-40.gmarkup +++ b/glib/tests/markups/fail-40.gmarkup diff --git a/glib/tests/markups/fail-5.expected b/glib/tests/markups/fail-5.expected new file mode 100644 index 000000000..7bd0f7847 --- /dev/null +++ b/glib/tests/markups/fail-5.expected @@ -0,0 +1 @@ +ERROR Error on line 2 char 1: '|foo' is not a valid name diff --git a/tests/markups/fail-5.gmarkup b/glib/tests/markups/fail-5.gmarkup index 41d8a3e11..41d8a3e11 100644 --- a/tests/markups/fail-5.gmarkup +++ b/glib/tests/markups/fail-5.gmarkup diff --git a/glib/tests/markups/fail-6.expected b/glib/tests/markups/fail-6.expected new file mode 100644 index 000000000..1c0ea0ecc --- /dev/null +++ b/glib/tests/markups/fail-6.expected @@ -0,0 +1 @@ +ERROR Error on line 2 char 1: 'foo|' is not a valid name: '|' diff --git a/tests/markups/fail-6.gmarkup b/glib/tests/markups/fail-6.gmarkup index 4c63568bc..4c63568bc 100644 --- a/tests/markups/fail-6.gmarkup +++ b/glib/tests/markups/fail-6.gmarkup diff --git a/glib/tests/markups/fail-7.expected b/glib/tests/markups/fail-7.expected new file mode 100644 index 000000000..09159d64d --- /dev/null +++ b/glib/tests/markups/fail-7.expected @@ -0,0 +1 @@ +ERROR Error on line 1 char 15: 'bar}"baz"' is not a valid name: '}' diff --git a/tests/markups/fail-7.gmarkup b/glib/tests/markups/fail-7.gmarkup index 5585bd630..5585bd630 100644 --- a/tests/markups/fail-7.gmarkup +++ b/glib/tests/markups/fail-7.gmarkup diff --git a/glib/tests/markups/fail-8.expected b/glib/tests/markups/fail-8.expected new file mode 100644 index 000000000..2448220fd --- /dev/null +++ b/glib/tests/markups/fail-8.expected @@ -0,0 +1,3 @@ +ELEMENT 'foo' +END 'foo' +ERROR Error on line 1 char 6: Odd character '}', expected a '>' character to end the empty-element tag 'foo' diff --git a/tests/markups/fail-8.gmarkup b/glib/tests/markups/fail-8.gmarkup index b355951fb..b355951fb 100644 --- a/tests/markups/fail-8.gmarkup +++ b/glib/tests/markups/fail-8.gmarkup diff --git a/glib/tests/markups/fail-9.expected b/glib/tests/markups/fail-9.expected new file mode 100644 index 000000000..9994eb345 --- /dev/null +++ b/glib/tests/markups/fail-9.expected @@ -0,0 +1 @@ +ERROR Error on line 1 char 10: Odd character '{', expected an open quote mark after the equals sign when giving value for attribute 'bar' of element 'foo' diff --git a/tests/markups/fail-9.gmarkup b/glib/tests/markups/fail-9.gmarkup index edd559685..edd559685 100644 --- a/tests/markups/fail-9.gmarkup +++ b/glib/tests/markups/fail-9.gmarkup diff --git a/tests/markups/expected-1 b/glib/tests/markups/valid-1.expected index 8b6cdd77c..8b6cdd77c 100644 --- a/tests/markups/expected-1 +++ b/glib/tests/markups/valid-1.expected diff --git a/tests/markups/valid-1.gmarkup b/glib/tests/markups/valid-1.gmarkup index 6745c5ca6..6745c5ca6 100644 --- a/tests/markups/valid-1.gmarkup +++ b/glib/tests/markups/valid-1.gmarkup diff --git a/tests/markups/expected-10 b/glib/tests/markups/valid-10.expected index e7b8af84b..e7b8af84b 100644 --- a/tests/markups/expected-10 +++ b/glib/tests/markups/valid-10.expected diff --git a/tests/markups/valid-10.gmarkup b/glib/tests/markups/valid-10.gmarkup index cbeb68e43..cbeb68e43 100644 --- a/tests/markups/valid-10.gmarkup +++ b/glib/tests/markups/valid-10.gmarkup diff --git a/tests/markups/expected-11 b/glib/tests/markups/valid-11.expected index 781039429..781039429 100644 --- a/tests/markups/expected-11 +++ b/glib/tests/markups/valid-11.expected diff --git a/tests/markups/valid-11.gmarkup b/glib/tests/markups/valid-11.gmarkup index fe1cc4e73..fe1cc4e73 100644 --- a/tests/markups/valid-11.gmarkup +++ b/glib/tests/markups/valid-11.gmarkup diff --git a/tests/markups/expected-2 b/glib/tests/markups/valid-2.expected index 82a531ad6..82a531ad6 100644 --- a/tests/markups/expected-2 +++ b/glib/tests/markups/valid-2.expected diff --git a/tests/markups/valid-2.gmarkup b/glib/tests/markups/valid-2.gmarkup index 4a3fa6939..4a3fa6939 100644 --- a/tests/markups/valid-2.gmarkup +++ b/glib/tests/markups/valid-2.gmarkup diff --git a/tests/markups/expected-3 b/glib/tests/markups/valid-3.expected index 9b4465347..9b4465347 100644 --- a/tests/markups/expected-3 +++ b/glib/tests/markups/valid-3.expected diff --git a/tests/markups/valid-3.gmarkup b/glib/tests/markups/valid-3.gmarkup index aed984e2f..aed984e2f 100644 --- a/tests/markups/valid-3.gmarkup +++ b/glib/tests/markups/valid-3.gmarkup diff --git a/tests/markups/expected-4 b/glib/tests/markups/valid-4.expected index 395f453b7..395f453b7 100644 --- a/tests/markups/expected-4 +++ b/glib/tests/markups/valid-4.expected diff --git a/tests/markups/valid-4.gmarkup b/glib/tests/markups/valid-4.gmarkup index 20361623f..20361623f 100644 --- a/tests/markups/valid-4.gmarkup +++ b/glib/tests/markups/valid-4.gmarkup diff --git a/tests/markups/expected-5 b/glib/tests/markups/valid-5.expected index 12d05c895..12d05c895 100644 --- a/tests/markups/expected-5 +++ b/glib/tests/markups/valid-5.expected diff --git a/tests/markups/valid-5.gmarkup b/glib/tests/markups/valid-5.gmarkup index 3b861de5a..3b861de5a 100644 --- a/tests/markups/valid-5.gmarkup +++ b/glib/tests/markups/valid-5.gmarkup diff --git a/tests/markups/expected-6 b/glib/tests/markups/valid-6.expected index bfb41cefc..bfb41cefc 100644 --- a/tests/markups/expected-6 +++ b/glib/tests/markups/valid-6.expected diff --git a/tests/markups/valid-6.gmarkup b/glib/tests/markups/valid-6.gmarkup index d7c065a32..d7c065a32 100644 --- a/tests/markups/valid-6.gmarkup +++ b/glib/tests/markups/valid-6.gmarkup diff --git a/tests/markups/expected-7 b/glib/tests/markups/valid-7.expected index 2fe197564..2fe197564 100644 --- a/tests/markups/expected-7 +++ b/glib/tests/markups/valid-7.expected diff --git a/tests/markups/valid-7.gmarkup b/glib/tests/markups/valid-7.gmarkup index 832445d6d..832445d6d 100644 --- a/tests/markups/valid-7.gmarkup +++ b/glib/tests/markups/valid-7.gmarkup diff --git a/tests/markups/expected-8 b/glib/tests/markups/valid-8.expected index 5bbda0421..5bbda0421 100644 --- a/tests/markups/expected-8 +++ b/glib/tests/markups/valid-8.expected diff --git a/tests/markups/valid-8.gmarkup b/glib/tests/markups/valid-8.gmarkup index a75aee055..a75aee055 100644 --- a/tests/markups/valid-8.gmarkup +++ b/glib/tests/markups/valid-8.gmarkup diff --git a/tests/markups/expected-9 b/glib/tests/markups/valid-9.expected index 781039429..781039429 100644 --- a/tests/markups/expected-9 +++ b/glib/tests/markups/valid-9.expected diff --git a/tests/markups/valid-9.gmarkup b/glib/tests/markups/valid-9.gmarkup index 90a99a042..90a99a042 100644 --- a/tests/markups/valid-9.gmarkup +++ b/glib/tests/markups/valid-9.gmarkup diff --git a/tests/Makefile.am b/tests/Makefile.am index fe4799798..6d5c102da 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -112,9 +112,9 @@ test_programs = \ unicode-caseconv \ unicode-encoding -test_scripts = run-markup-tests.sh run-collate-tests.sh run-bookmark-test.sh run-assert-msg-test.sh +test_scripts = run-collate-tests.sh run-bookmark-test.sh run-assert-msg-test.sh -test_script_support_programs = markup-test unicode-collate bookmarkfile-test +test_script_support_programs = unicode-collate bookmarkfile-test check_PROGRAMS = $(test_programs) $(test_script_support_programs) @@ -141,7 +141,6 @@ gio_test_LDADD = $(progs_ldadd) iochannel_test_LDADD = $(progs_ldadd) list_test_LDADD = $(progs_ldadd) mainloop_test_LDADD = $(thread_ldadd) -markup_test_LDADD = $(progs_ldadd) mapping_test_LDADD = $(progs_ldadd) module_test_LDADD = $(module_ldadd) $(module_test_exp) module_test_LDFLAGS = $(G_MODULE_LDFLAGS) @@ -180,9 +179,6 @@ dist-hook: $(BUILT_EXTRA_DIST) for f in $$files; do \ if test -f $$f; then d=.; else d=$(srcdir); fi; \ cp $$d/$$f $(distdir) || exit 1; done - mkdir $(distdir)/markups; \ - for f in $(srcdir)/markups/* ; do \ - cp $$f $(distdir)/markups; done mkdir $(distdir)/collate; \ for f in $(srcdir)/collate/* ; do \ if test -f $$f; then cp $$f $(distdir)/collate; fi; done diff --git a/tests/markup-test.c b/tests/markup-test.c deleted file mode 100644 index 6d5f44b65..000000000 --- a/tests/markup-test.c +++ /dev/null @@ -1,214 +0,0 @@ -#undef G_DISABLE_ASSERT -#undef G_LOG_DOMAIN - -#include <stdio.h> -#include <glib.h> - -static int depth = 0; - -static void -indent (int extra) -{ - int i = 0; - while (i < depth) - { - fputs (" ", stdout); - ++i; - } -} - -static void -start_element_handler (GMarkupParseContext *context, - const gchar *element_name, - const gchar **attribute_names, - const gchar **attribute_values, - gpointer user_data, - GError **error) -{ - int i; - - indent (0); - printf ("ELEMENT '%s'\n", element_name); - - i = 0; - while (attribute_names[i] != NULL) - { - indent (1); - - printf ("%s=\"%s\"\n", - attribute_names[i], - attribute_values[i]); - - ++i; - } - - ++depth; -} - -static void -end_element_handler (GMarkupParseContext *context, - const gchar *element_name, - gpointer user_data, - GError **error) -{ - --depth; - indent (0); - printf ("END '%s'\n", element_name); - } - -static void -text_handler (GMarkupParseContext *context, - const gchar *text, - gsize text_len, - gpointer user_data, - GError **error) -{ - indent (0); - printf ("TEXT '%.*s'\n", (int)text_len, text); -} - - -static void -passthrough_handler (GMarkupParseContext *context, - const gchar *passthrough_text, - gsize text_len, - gpointer user_data, - GError **error) -{ - indent (0); - - printf ("PASS '%.*s'\n", (int)text_len, passthrough_text); -} - -static void -error_handler (GMarkupParseContext *context, - GError *error, - gpointer user_data) -{ - fprintf (stderr, " %s\n", error->message); -} - -static const GMarkupParser parser = { - start_element_handler, - end_element_handler, - text_handler, - passthrough_handler, - error_handler -}; - -static const GMarkupParser silent_parser = { - NULL, - NULL, - NULL, - NULL, - error_handler -}; - -static int -test_in_chunks (const gchar *contents, - gint length, - gint chunk_size) -{ - GMarkupParseContext *context; - int i = 0; - - context = g_markup_parse_context_new (&silent_parser, 0, NULL, NULL); - - while (i < length) - { - int this_chunk = MIN (length - i, chunk_size); - - if (!g_markup_parse_context_parse (context, - contents + i, - this_chunk, - NULL)) - { - g_markup_parse_context_free (context); - return 1; - } - - i += this_chunk; - } - - if (!g_markup_parse_context_end_parse (context, NULL)) - { - g_markup_parse_context_free (context); - return 1; - } - - g_markup_parse_context_free (context); - - return 0; -} - -static int -test_file (const gchar *filename) -{ - gchar *contents; - gsize length; - GError *error; - GMarkupParseContext *context; - - error = NULL; - if (!g_file_get_contents (filename, - &contents, - &length, - &error)) - { - fprintf (stderr, "%s\n", error->message); - g_error_free (error); - return 1; - } - - context = g_markup_parse_context_new (&parser, 0, NULL, NULL); - - if (!g_markup_parse_context_parse (context, contents, length, NULL)) - { - g_markup_parse_context_free (context); - return 1; - } - - if (!g_markup_parse_context_end_parse (context, NULL)) - { - g_markup_parse_context_free (context); - return 1; - } - - g_markup_parse_context_free (context); - - /* A byte at a time */ - if (test_in_chunks (contents, length, 1) != 0) - return 1; - - /* 2 bytes */ - if (test_in_chunks (contents, length, 2) != 0) - return 1; - - /*5 bytes */ - if (test_in_chunks (contents, length, 5) != 0) - return 1; - - /* 12 bytes */ - if (test_in_chunks (contents, length, 12) != 0) - return 1; - - /* 1024 bytes */ - if (test_in_chunks (contents, length, 1024) != 0) - return 1; - - return 0; -} - -int -main (int argc, - char *argv[]) -{ - if (argc > 1) - return test_file (argv[1]); - else - { - fprintf (stderr, "Give a markup file on the command line\n"); - return 1; - } -} - diff --git a/tests/run-markup-tests.sh b/tests/run-markup-tests.sh deleted file mode 100755 index 38074cc7c..000000000 --- a/tests/run-markup-tests.sh +++ /dev/null @@ -1,41 +0,0 @@ -#! /bin/sh - -fail () -{ - echo "Test failed: $*" - exit 1 -} - -echo_v () -{ - if [ "$verbose" = "1" ]; then - echo "$*" - fi -} - -error_out=/dev/null -if [ "$1" = "-v" ]; then - verbose=1 - error_out=/dev/stderr -fi -for I in ${srcdir:-.}/markups/fail-*.gmarkup; do - echo_v "Parsing $I, should fail" - ./markup-test $I > /dev/null 2> $error_out && fail "failed to generate error on $I" - if test "$?" != "1"; then - fail "unexpected error on $I" - fi -done - -I=1 -while test $I -lt 100 ; do - F=${srcdir:-.}/markups/valid-$I.gmarkup - if [ -f $F ] ; then - echo_v "Parsing $F, should succeed" - ./markup-test $F > actual 2> $error_out || fail "failed on $F" - diff ${srcdir:-.}/markups/expected-$I actual || fail "unexpected output on $F" - rm actual - fi - I=`expr $I + 1` -done - -echo_v "All tests passed." |