mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-10-17 19:02:52 +02:00
Move markup parse tests to the test framework
This commit is contained in:
@@ -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
|
||||
|
290
glib/tests/markup-parse.c
Normal file
290
glib/tests/markup-parse.c
Normal file
@@ -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 ();
|
||||
}
|
||||
|
1
glib/tests/markups/fail-1.expected
Normal file
1
glib/tests/markups/fail-1.expected
Normal file
@@ -0,0 +1 @@
|
||||
ERROR Error on line 1 char 1: Document was empty or contained only whitespace
|
0
glib/tests/markups/fail-1.gmarkup
Normal file
0
glib/tests/markups/fail-1.gmarkup
Normal file
4
glib/tests/markups/fail-10.expected
Normal file
4
glib/tests/markups/fail-10.expected
Normal file
@@ -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'
|
2
glib/tests/markups/fail-10.gmarkup
Normal file
2
glib/tests/markups/fail-10.gmarkup
Normal file
@@ -0,0 +1,2 @@
|
||||
<foo>
|
||||
</|foo>
|
7
glib/tests/markups/fail-11.expected
Normal file
7
glib/tests/markups/fail-11.expected
Normal file
@@ -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'
|
4
glib/tests/markups/fail-11.gmarkup
Normal file
4
glib/tests/markups/fail-11.gmarkup
Normal file
@@ -0,0 +1,4 @@
|
||||
<foo>
|
||||
<bar>
|
||||
</foo>
|
||||
</bar>
|
1
glib/tests/markups/fail-12.expected
Normal file
1
glib/tests/markups/fail-12.expected
Normal file
@@ -0,0 +1 @@
|
||||
ERROR Error on line 1 char 6: Element 'foo' was closed, no element is currently open
|
1
glib/tests/markups/fail-12.gmarkup
Normal file
1
glib/tests/markups/fail-12.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
</foo>
|
1
glib/tests/markups/fail-13.expected
Normal file
1
glib/tests/markups/fail-13.expected
Normal file
@@ -0,0 +1 @@
|
||||
ERROR Error on line 1 char 7: Element 'foo|' was closed, no element is currently open
|
1
glib/tests/markups/fail-13.gmarkup
Normal file
1
glib/tests/markups/fail-13.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
</foo|>
|
4
glib/tests/markups/fail-14.expected
Normal file
4
glib/tests/markups/fail-14.expected
Normal file
@@ -0,0 +1,4 @@
|
||||
ELEMENT 'foo'
|
||||
TEXT '
|
||||
'
|
||||
ERROR Error on line 2 char 3: Document ended unexpectedly just after an open angle bracket '<'
|
2
glib/tests/markups/fail-14.gmarkup
Normal file
2
glib/tests/markups/fail-14.gmarkup
Normal file
@@ -0,0 +1,2 @@
|
||||
<foo>
|
||||
<
|
8
glib/tests/markups/fail-15.expected
Normal file
8
glib/tests/markups/fail-15.expected
Normal file
@@ -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
|
3
glib/tests/markups/fail-15.gmarkup
Normal file
3
glib/tests/markups/fail-15.gmarkup
Normal file
@@ -0,0 +1,3 @@
|
||||
<foo>
|
||||
<bar>
|
||||
</bar>
|
2
glib/tests/markups/fail-16.expected
Normal file
2
glib/tests/markups/fail-16.expected
Normal file
@@ -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/>
|
1
glib/tests/markups/fail-16.gmarkup
Normal file
1
glib/tests/markups/fail-16.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<foo/
|
1
glib/tests/markups/fail-17.expected
Normal file
1
glib/tests/markups/fail-17.expected
Normal file
@@ -0,0 +1 @@
|
||||
ERROR Error on line 1 char 4: Document ended unexpectedly inside an element name
|
1
glib/tests/markups/fail-17.gmarkup
Normal file
1
glib/tests/markups/fail-17.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<fo
|
1
glib/tests/markups/fail-18.expected
Normal file
1
glib/tests/markups/fail-18.expected
Normal file
@@ -0,0 +1 @@
|
||||
ERROR Error on line 1 char 9: Document ended unexpectedly inside an attribute name
|
1
glib/tests/markups/fail-18.gmarkup
Normal file
1
glib/tests/markups/fail-18.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<foo bar
|
1
glib/tests/markups/fail-19.expected
Normal file
1
glib/tests/markups/fail-19.expected
Normal file
@@ -0,0 +1 @@
|
||||
ERROR Error on line 1 char 6: Document ended unexpectedly inside an element-opening tag.
|
1
glib/tests/markups/fail-19.gmarkup
Normal file
1
glib/tests/markups/fail-19.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<foo
|
1
glib/tests/markups/fail-2.expected
Normal file
1
glib/tests/markups/fail-2.expected
Normal file
@@ -0,0 +1 @@
|
||||
ERROR Error on line 1 char 1: Document must begin with an element (e.g. <book>)
|
1
glib/tests/markups/fail-2.gmarkup
Normal file
1
glib/tests/markups/fail-2.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<EFBFBD>ν語
|
1
glib/tests/markups/fail-20.expected
Normal file
1
glib/tests/markups/fail-20.expected
Normal file
@@ -0,0 +1 @@
|
||||
ERROR Error on line 1 char 10: Document ended unexpectedly after the equals sign following an attribute name; no attribute value
|
1
glib/tests/markups/fail-20.gmarkup
Normal file
1
glib/tests/markups/fail-20.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<foo bar=
|
1
glib/tests/markups/fail-21.expected
Normal file
1
glib/tests/markups/fail-21.expected
Normal file
@@ -0,0 +1 @@
|
||||
ERROR Error on line 1 char 15: Document ended unexpectedly while inside an attribute value
|
1
glib/tests/markups/fail-21.gmarkup
Normal file
1
glib/tests/markups/fail-21.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<foo bar="fdsf
|
2
glib/tests/markups/fail-22.expected
Normal file
2
glib/tests/markups/fail-22.expected
Normal file
@@ -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
|
1
glib/tests/markups/fail-22.gmarkup
Normal file
1
glib/tests/markups/fail-22.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<foo>
|
4
glib/tests/markups/fail-23.expected
Normal file
4
glib/tests/markups/fail-23.expected
Normal file
@@ -0,0 +1,4 @@
|
||||
ELEMENT 'foo'
|
||||
TEXT '
|
||||
'
|
||||
ERROR Error on line 2 char 5: Document ended unexpectedly inside an element name
|
2
glib/tests/markups/fail-23.gmarkup
Normal file
2
glib/tests/markups/fail-23.gmarkup
Normal file
@@ -0,0 +1,2 @@
|
||||
<foo>
|
||||
<fo
|
1
glib/tests/markups/fail-24.expected
Normal file
1
glib/tests/markups/fail-24.expected
Normal file
@@ -0,0 +1 @@
|
||||
ERROR Error on line 1 char 44: Document ended unexpectedly inside a comment or processing instruction
|
1
glib/tests/markups/fail-24.gmarkup
Normal file
1
glib/tests/markups/fail-24.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<!-- dfklsjdf;kljsdf;ljk document ends here
|
1
glib/tests/markups/fail-25.expected
Normal file
1
glib/tests/markups/fail-25.expected
Normal file
@@ -0,0 +1 @@
|
||||
ERROR Error on line 1 char 32: Document ended unexpectedly inside a comment or processing instruction
|
1
glib/tests/markups/fail-25.gmarkup
Normal file
1
glib/tests/markups/fail-25.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<? document ending unexpectedly
|
2
glib/tests/markups/fail-26.expected
Normal file
2
glib/tests/markups/fail-26.expected
Normal file
@@ -0,0 +1,2 @@
|
||||
ELEMENT 'foo'
|
||||
ERROR Error on line 1: Empty entity '&;' seen; valid entities are: & " < > '
|
1
glib/tests/markups/fail-26.gmarkup
Normal file
1
glib/tests/markups/fail-26.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<foo>&;</foo>
|
2
glib/tests/markups/fail-27.expected
Normal file
2
glib/tests/markups/fail-27.expected
Normal file
@@ -0,0 +1,2 @@
|
||||
ELEMENT 'foo'
|
||||
ERROR Error on line 1: Entity name '|' is not known
|
1
glib/tests/markups/fail-27.gmarkup
Normal file
1
glib/tests/markups/fail-27.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<foo>&|;</foo>
|
2
glib/tests/markups/fail-28.expected
Normal file
2
glib/tests/markups/fail-28.expected
Normal file
@@ -0,0 +1,2 @@
|
||||
ELEMENT 'foo'
|
||||
ERROR Error on line 1: Entity name 'am|' is not known
|
1
glib/tests/markups/fail-28.gmarkup
Normal file
1
glib/tests/markups/fail-28.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<foo>&am|;</foo>
|
2
glib/tests/markups/fail-29.expected
Normal file
2
glib/tests/markups/fail-29.expected
Normal file
@@ -0,0 +1,2 @@
|
||||
ELEMENT 'foo'
|
||||
ERROR Error on line 1: Entity name 'bar' is not known
|
1
glib/tests/markups/fail-29.gmarkup
Normal file
1
glib/tests/markups/fail-29.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<foo>&bar;</foo>
|
49
glib/tests/markups/fail-3.gmarkup
Normal file
49
glib/tests/markups/fail-3.gmarkup
Normal file
@@ -0,0 +1,49 @@
|
||||
<foobar>
|
||||
Παν語
|
||||
|
||||
This is a list of ways to say hello in various languages. Its purpose is to illustrate a number of scripts.
|
||||
|
||||
(Converted into UTF-8)
|
||||
|
||||
---------------------------------------------------------
|
||||
Arabic السلام عليكم
|
||||
Czech (česky) Dobrý den
|
||||
Danish (Dansk) Hej, Goddag
|
||||
English Hello
|
||||
Esperanto Saluton
|
||||
Estonian Tere, Tervist
|
||||
FORTRAN PROGRAM
|
||||
Finnish (Suomi) Hei
|
||||
French (Français) Bonjour, Salut
|
||||
German (Deutsch Nord) Guten Tag
|
||||
German (Deutsch Süd) Grüß Gott
|
||||
Greek (Ελληνικά) Γειά σας
|
||||
Hebrew שלום
|
||||
Hindi नमस्ते, <20><>मस्कार।
|
||||
Italiano Ciao, Buon giorno
|
||||
Maltese Ċaw, Saħħa
|
||||
Nederlands, Vlaams Hallo, Dag
|
||||
Norwegian (Norsk) Hei, God dag
|
||||
Polish Dzień dobry, Hej
|
||||
Russian (Русский) Здравствуйте!
|
||||
Slovak Dobrý deň
|
||||
Spanish (Español) ¡Hola!
|
||||
Swedish (Svenska) Hej, Goddag
|
||||
Thai (ภาษาไทย) สวัสดีครับ, สวัสดีค่ะ
|
||||
Turkish (Türkçe) Merhaba
|
||||
Vietnamese (Tiếng Việt) Xin Chào
|
||||
Yiddish (ײַדישע) דאָס הײַזעלע
|
||||
|
||||
Japanese (日本語) こんにちは, コンニチハ
|
||||
Chinese (中文,普通话,汉语) 你好
|
||||
Cantonese (粵語,廣東話) 早晨, 你好
|
||||
Korean (한글) 안녕하세요, 안녕하십니까
|
||||
|
||||
Difference among chinese characters in GB, JIS, KSC, BIG5:
|
||||
GB -- 元气 开发
|
||||
JIS -- 元気 開発
|
||||
KSC -- 元氣 開發
|
||||
BIG5 -- 元氣 開發
|
||||
|
||||
|
||||
</foobar>
|
2
glib/tests/markups/fail-30.expected
Normal file
2
glib/tests/markups/fail-30.expected
Normal file
@@ -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 &
|
1
glib/tests/markups/fail-30.gmarkup
Normal file
1
glib/tests/markups/fail-30.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<foo>&sdfkljsdsdfsdfsdfsdf</foo>
|
2
glib/tests/markups/fail-31.expected
Normal file
2
glib/tests/markups/fail-31.expected
Normal file
@@ -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
|
1
glib/tests/markups/fail-31.gmarkup
Normal file
1
glib/tests/markups/fail-31.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<foo>�</foo>
|
2
glib/tests/markups/fail-32.expected
Normal file
2
glib/tests/markups/fail-32.expected
Normal file
@@ -0,0 +1,2 @@
|
||||
ELEMENT 'foo'
|
||||
ERROR Error on line 1: Character reference '0' does not encode a permitted character
|
1
glib/tests/markups/fail-32.gmarkup
Normal file
1
glib/tests/markups/fail-32.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<foo>�</foo>
|
2
glib/tests/markups/fail-33.expected
Normal file
2
glib/tests/markups/fail-33.expected
Normal file
@@ -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
|
1
glib/tests/markups/fail-33.gmarkup
Normal file
1
glib/tests/markups/fail-33.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<foo>&#;</foo>
|
2
glib/tests/markups/fail-34.expected
Normal file
2
glib/tests/markups/fail-34.expected
Normal file
@@ -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 &
|
1
glib/tests/markups/fail-34.gmarkup
Normal file
1
glib/tests/markups/fail-34.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<foo>𹋺</foo>
|
2
glib/tests/markups/fail-35.expected
Normal file
2
glib/tests/markups/fail-35.expected
Normal file
@@ -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 &
|
1
glib/tests/markups/fail-35.gmarkup
Normal file
1
glib/tests/markups/fail-35.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<foo>gedit&</foo>
|
1
glib/tests/markups/fail-36.gmarkup
Normal file
1
glib/tests/markups/fail-36.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<foo><3E></foo><^$non-carriage-null-fail|>
|
1
glib/tests/markups/fail-37.expected
Normal file
1
glib/tests/markups/fail-37.expected
Normal file
@@ -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
|
1
glib/tests/markups/fail-37.gmarkup
Normal file
1
glib/tests/markups/fail-37.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
< foo>
|
3
glib/tests/markups/fail-38.expected
Normal file
3
glib/tests/markups/fail-38.expected
Normal file
@@ -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
|
1
glib/tests/markups/fail-38.gmarkup
Normal file
1
glib/tests/markups/fail-38.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<foo>data< /foo>
|
3
glib/tests/markups/fail-39.expected
Normal file
3
glib/tests/markups/fail-39.expected
Normal file
@@ -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
|
1
glib/tests/markups/fail-39.gmarkup
Normal file
1
glib/tests/markups/fail-39.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<foo>data</ foo>
|
1
glib/tests/markups/fail-4.expected
Normal file
1
glib/tests/markups/fail-4.expected
Normal file
@@ -0,0 +1 @@
|
||||
ERROR Error on line 1 char 1: Document must begin with an element (e.g. <book>)
|
1
glib/tests/markups/fail-4.gmarkup
Normal file
1
glib/tests/markups/fail-4.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
foo
|
2
glib/tests/markups/fail-40.expected
Normal file
2
glib/tests/markups/fail-40.expected
Normal file
@@ -0,0 +1,2 @@
|
||||
ELEMENT 'bla'
|
||||
ERROR Error on line 1: Entity name 'unknownentityname' is not known
|
1
glib/tests/markups/fail-40.gmarkup
Normal file
1
glib/tests/markups/fail-40.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<bla>&unknownentityname;</bla>
|
1
glib/tests/markups/fail-5.expected
Normal file
1
glib/tests/markups/fail-5.expected
Normal file
@@ -0,0 +1 @@
|
||||
ERROR Error on line 2 char 1: '|foo' is not a valid name
|
2
glib/tests/markups/fail-5.gmarkup
Normal file
2
glib/tests/markups/fail-5.gmarkup
Normal file
@@ -0,0 +1,2 @@
|
||||
<|foo>
|
||||
</|foo>
|
1
glib/tests/markups/fail-6.expected
Normal file
1
glib/tests/markups/fail-6.expected
Normal file
@@ -0,0 +1 @@
|
||||
ERROR Error on line 2 char 1: 'foo|' is not a valid name: '|'
|
2
glib/tests/markups/fail-6.gmarkup
Normal file
2
glib/tests/markups/fail-6.gmarkup
Normal file
@@ -0,0 +1,2 @@
|
||||
<foo|>
|
||||
</foo>
|
1
glib/tests/markups/fail-7.expected
Normal file
1
glib/tests/markups/fail-7.expected
Normal file
@@ -0,0 +1 @@
|
||||
ERROR Error on line 1 char 15: 'bar}"baz"' is not a valid name: '}'
|
2
glib/tests/markups/fail-7.gmarkup
Normal file
2
glib/tests/markups/fail-7.gmarkup
Normal file
@@ -0,0 +1,2 @@
|
||||
<foo bar}"baz">
|
||||
</foo>
|
3
glib/tests/markups/fail-8.expected
Normal file
3
glib/tests/markups/fail-8.expected
Normal file
@@ -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'
|
2
glib/tests/markups/fail-8.gmarkup
Normal file
2
glib/tests/markups/fail-8.gmarkup
Normal file
@@ -0,0 +1,2 @@
|
||||
<foo/}>
|
||||
</foo>
|
1
glib/tests/markups/fail-9.expected
Normal file
1
glib/tests/markups/fail-9.expected
Normal file
@@ -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'
|
2
glib/tests/markups/fail-9.gmarkup
Normal file
2
glib/tests/markups/fail-9.gmarkup
Normal file
@@ -0,0 +1,2 @@
|
||||
<foo bar={baz">
|
||||
</foo>
|
37
glib/tests/markups/valid-1.expected
Normal file
37
glib/tests/markups/valid-1.expected
Normal file
@@ -0,0 +1,37 @@
|
||||
PASS '<!-- Comment -->'
|
||||
PASS '<?PI ?>'
|
||||
ELEMENT 'foobar'
|
||||
TEXT '
|
||||
'
|
||||
ELEMENT 'e1'
|
||||
TEXT 'Hi & this is some text inside an element Two 'E' chars as character refs: E E and some 'J': J J'
|
||||
END 'e1'
|
||||
TEXT '
|
||||
'
|
||||
ELEMENT 'e2:foo'
|
||||
TEXT ' Text '
|
||||
ELEMENT 'childfree'
|
||||
END 'childfree'
|
||||
TEXT ' with some '
|
||||
ELEMENT 'nested'
|
||||
TEXT 'nested elements'
|
||||
END 'nested'
|
||||
TEXT ' and entities "& < >> ' and whitespace '
|
||||
END 'e2:foo'
|
||||
TEXT '
|
||||
'
|
||||
ELEMENT 'tag'
|
||||
ab="fo<o"
|
||||
bar="foo"
|
||||
baz="blah"
|
||||
TEXT 'This element has attributes'
|
||||
END 'tag'
|
||||
TEXT '
|
||||
'
|
||||
ELEMENT 'nochildren'
|
||||
a="b"
|
||||
xyz="qrs"
|
||||
END 'nochildren'
|
||||
TEXT '
|
||||
'
|
||||
END 'foobar'
|
9
glib/tests/markups/valid-1.gmarkup
Normal file
9
glib/tests/markups/valid-1.gmarkup
Normal file
@@ -0,0 +1,9 @@
|
||||
<!-- Comment -->
|
||||
<?PI ?>
|
||||
<foobar>
|
||||
<e1>Hi & this is some text inside an element Two 'E' chars as character refs: E E and some 'J': J J</e1>
|
||||
<e2:foo> Text <childfree/> with some <nested>nested elements</nested> and entities "& < >> ' and whitespace </e2:foo>
|
||||
<tag ab="fo<o" bar="foo" baz="blah">This element has attributes</tag>
|
||||
<nochildren a="b" xyz="qrs"/>
|
||||
</foobar>
|
||||
|
6
glib/tests/markups/valid-10.expected
Normal file
6
glib/tests/markups/valid-10.expected
Normal file
@@ -0,0 +1,6 @@
|
||||
ELEMENT 'foo'
|
||||
bar="baz"
|
||||
bar2="baz2"
|
||||
bar3="baz3"
|
||||
TEXT 'data'
|
||||
END 'foo'
|
6
glib/tests/markups/valid-10.gmarkup
Normal file
6
glib/tests/markups/valid-10.gmarkup
Normal file
@@ -0,0 +1,6 @@
|
||||
<foo
|
||||
bar="baz"
|
||||
bar2 = "baz2"
|
||||
bar3 =
|
||||
"baz3"
|
||||
>data</foo>
|
3
glib/tests/markups/valid-11.expected
Normal file
3
glib/tests/markups/valid-11.expected
Normal file
@@ -0,0 +1,3 @@
|
||||
ELEMENT 'foo'
|
||||
TEXT 'data'
|
||||
END 'foo'
|
2
glib/tests/markups/valid-11.gmarkup
Normal file
2
glib/tests/markups/valid-11.gmarkup
Normal file
@@ -0,0 +1,2 @@
|
||||
<foo
|
||||
>data</foo>
|
51
glib/tests/markups/valid-2.expected
Normal file
51
glib/tests/markups/valid-2.expected
Normal file
@@ -0,0 +1,51 @@
|
||||
ELEMENT 'foobar'
|
||||
TEXT '
|
||||
Παν語
|
||||
|
||||
This is a list of ways to say hello in various languages. Its purpose is to illustrate a number of scripts.
|
||||
|
||||
(Converted into UTF-8)
|
||||
|
||||
---------------------------------------------------------
|
||||
Arabic السلام عليكم
|
||||
Czech (česky) Dobrý den
|
||||
Danish (Dansk) Hej, Goddag
|
||||
English Hello
|
||||
Esperanto Saluton
|
||||
Estonian Tere, Tervist
|
||||
FORTRAN PROGRAM
|
||||
Finnish (Suomi) Hei
|
||||
French (Français) Bonjour, Salut
|
||||
German (Deutsch Nord) Guten Tag
|
||||
German (Deutsch Süd) Grüß Gott
|
||||
Greek (Ελληνικά) Γειά σας
|
||||
Hebrew שלום
|
||||
Hindi नमस्ते, नमस्कार।
|
||||
Italiano Ciao, Buon giorno
|
||||
Maltese Ċaw, Saħħa
|
||||
Nederlands, Vlaams Hallo, Dag
|
||||
Norwegian (Norsk) Hei, God dag
|
||||
Polish Dzień dobry, Hej
|
||||
Russian (Русский) Здравствуйте!
|
||||
Slovak Dobrý deň
|
||||
Spanish (Español) ¡Hola!
|
||||
Swedish (Svenska) Hej, Goddag
|
||||
Thai (ภาษาไทย) สวัสดีครับ, สวัสดีค่ะ
|
||||
Turkish (Türkçe) Merhaba
|
||||
Vietnamese (Tiếng Việt) Xin Chào
|
||||
Yiddish (ײַדישע) דאָס הײַזעלע
|
||||
|
||||
Japanese (日本語) こんにちは, コンニチハ
|
||||
Chinese (中文,普通话,汉语) 你好
|
||||
Cantonese (粵語,廣東話) 早晨, 你好
|
||||
Korean (한글) 안녕하세요, 안녕하십니까
|
||||
|
||||
Difference among chinese characters in GB, JIS, KSC, BIG5:
|
||||
GB -- 元气 开发
|
||||
JIS -- 元気 開発
|
||||
KSC -- 元氣 開發
|
||||
BIG5 -- 元氣 開發
|
||||
|
||||
|
||||
'
|
||||
END 'foobar'
|
49
glib/tests/markups/valid-2.gmarkup
Normal file
49
glib/tests/markups/valid-2.gmarkup
Normal file
@@ -0,0 +1,49 @@
|
||||
<foobar>
|
||||
Παν語
|
||||
|
||||
This is a list of ways to say hello in various languages. Its purpose is to illustrate a number of scripts.
|
||||
|
||||
(Converted into UTF-8)
|
||||
|
||||
---------------------------------------------------------
|
||||
Arabic السلام عليكم
|
||||
Czech (česky) Dobrý den
|
||||
Danish (Dansk) Hej, Goddag
|
||||
English Hello
|
||||
Esperanto Saluton
|
||||
Estonian Tere, Tervist
|
||||
FORTRAN PROGRAM
|
||||
Finnish (Suomi) Hei
|
||||
French (Français) Bonjour, Salut
|
||||
German (Deutsch Nord) Guten Tag
|
||||
German (Deutsch Süd) Grüß Gott
|
||||
Greek (Ελληνικά) Γειά σας
|
||||
Hebrew שלום
|
||||
Hindi नमस्ते, नमस्कार।
|
||||
Italiano Ciao, Buon giorno
|
||||
Maltese Ċaw, Saħħa
|
||||
Nederlands, Vlaams Hallo, Dag
|
||||
Norwegian (Norsk) Hei, God dag
|
||||
Polish Dzień dobry, Hej
|
||||
Russian (Русский) Здравствуйте!
|
||||
Slovak Dobrý deň
|
||||
Spanish (Español) ¡Hola!
|
||||
Swedish (Svenska) Hej, Goddag
|
||||
Thai (ภาษาไทย) สวัสดีครับ, สวัสดีค่ะ
|
||||
Turkish (Türkçe) Merhaba
|
||||
Vietnamese (Tiếng Việt) Xin Chào
|
||||
Yiddish (ײַדישע) דאָס הײַזעלע
|
||||
|
||||
Japanese (日本語) こんにちは, コンニチハ
|
||||
Chinese (中文,普通话,汉语) 你好
|
||||
Cantonese (粵語,廣東話) 早晨, 你好
|
||||
Korean (한글) 안녕하세요, 안녕하십니까
|
||||
|
||||
Difference among chinese characters in GB, JIS, KSC, BIG5:
|
||||
GB -- 元气 开发
|
||||
JIS -- 元気 開発
|
||||
KSC -- 元氣 開發
|
||||
BIG5 -- 元氣 開發
|
||||
|
||||
|
||||
</foobar>
|
61
glib/tests/markups/valid-3.expected
Normal file
61
glib/tests/markups/valid-3.expected
Normal file
@@ -0,0 +1,61 @@
|
||||
ELEMENT 'foo'
|
||||
TEXT '
|
||||
'
|
||||
ELEMENT 'bar'
|
||||
a="1"
|
||||
END 'bar'
|
||||
TEXT '
|
||||
'
|
||||
ELEMENT 'bar'
|
||||
a="1"
|
||||
b="2"
|
||||
END 'bar'
|
||||
TEXT '
|
||||
'
|
||||
ELEMENT 'bar'
|
||||
a="1"
|
||||
b="2"
|
||||
c="3"
|
||||
END 'bar'
|
||||
TEXT '
|
||||
'
|
||||
ELEMENT 'bar'
|
||||
a="1"
|
||||
b="2"
|
||||
c="3"
|
||||
d="4"
|
||||
END 'bar'
|
||||
TEXT '
|
||||
'
|
||||
ELEMENT 'bar'
|
||||
a="1"
|
||||
b="2"
|
||||
c="3"
|
||||
d="4"
|
||||
e="5"
|
||||
END 'bar'
|
||||
TEXT '
|
||||
'
|
||||
ELEMENT 'bar'
|
||||
a="1"
|
||||
b="2"
|
||||
c="3"
|
||||
d="4"
|
||||
e="5"
|
||||
f="6"
|
||||
END 'bar'
|
||||
TEXT '
|
||||
'
|
||||
ELEMENT 'bar'
|
||||
a="1"
|
||||
b="2"
|
||||
c="3"
|
||||
END 'bar'
|
||||
TEXT '
|
||||
'
|
||||
ELEMENT 'bar'
|
||||
a="1"
|
||||
END 'bar'
|
||||
TEXT '
|
||||
'
|
||||
END 'foo'
|
10
glib/tests/markups/valid-3.gmarkup
Normal file
10
glib/tests/markups/valid-3.gmarkup
Normal file
@@ -0,0 +1,10 @@
|
||||
<foo>
|
||||
<bar a="1"/>
|
||||
<bar a="1" b="2"/>
|
||||
<bar a="1" b="2" c="3"/>
|
||||
<bar a="1" b="2" c="3" d="4"/>
|
||||
<bar a="1" b="2" c="3" d="4" e="5"/>
|
||||
<bar a="1" b="2" c="3" d="4" e="5" f="6"/>
|
||||
<bar a="1" b="2" c="3"/>
|
||||
<bar a="1"/>
|
||||
</foo>
|
29
glib/tests/markups/valid-4.expected
Normal file
29
glib/tests/markups/valid-4.expected
Normal file
@@ -0,0 +1,29 @@
|
||||
ELEMENT 'foo'
|
||||
TEXT '
|
||||
'
|
||||
ELEMENT 'bar'
|
||||
a="1"
|
||||
END 'bar'
|
||||
TEXT '
|
||||
'
|
||||
ELEMENT 'bar'
|
||||
a="2"
|
||||
END 'bar'
|
||||
TEXT '
|
||||
'
|
||||
ELEMENT 'bar'
|
||||
a="3""
|
||||
END 'bar'
|
||||
TEXT '
|
||||
'
|
||||
ELEMENT 'bar'
|
||||
a="4'"
|
||||
END 'bar'
|
||||
TEXT '
|
||||
'
|
||||
ELEMENT 'bar'
|
||||
a="5''''"
|
||||
END 'bar'
|
||||
TEXT '
|
||||
'
|
||||
END 'foo'
|
8
glib/tests/markups/valid-4.gmarkup
Normal file
8
glib/tests/markups/valid-4.gmarkup
Normal file
@@ -0,0 +1,8 @@
|
||||
<foo>
|
||||
<bar a='1'/>
|
||||
<bar a="2"/>
|
||||
<bar a='3"'/>
|
||||
<bar a="4'"/>
|
||||
<bar a="5''''"/>
|
||||
</foo>
|
||||
|
4
glib/tests/markups/valid-5.expected
Normal file
4
glib/tests/markups/valid-5.expected
Normal file
@@ -0,0 +1,4 @@
|
||||
PASS '<?xml version="1.0" ?>'
|
||||
ELEMENT 'foo'
|
||||
TEXT ''
|
||||
END 'foo'
|
2
glib/tests/markups/valid-5.gmarkup
Normal file
2
glib/tests/markups/valid-5.gmarkup
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" ?>
|
||||
<foo></foo>
|
6
glib/tests/markups/valid-6.expected
Normal file
6
glib/tests/markups/valid-6.expected
Normal file
@@ -0,0 +1,6 @@
|
||||
PASS '<!DOCTYPE foo "foo" [
|
||||
<!ELEMENT foo ANY >
|
||||
]>'
|
||||
ELEMENT 'foo'
|
||||
TEXT ''
|
||||
END 'foo'
|
4
glib/tests/markups/valid-6.gmarkup
Normal file
4
glib/tests/markups/valid-6.gmarkup
Normal file
@@ -0,0 +1,4 @@
|
||||
<!DOCTYPE foo "foo" [
|
||||
<!ELEMENT foo ANY >
|
||||
]>
|
||||
<foo></foo>
|
4
glib/tests/markups/valid-7.expected
Normal file
4
glib/tests/markups/valid-7.expected
Normal file
@@ -0,0 +1,4 @@
|
||||
PASS '<!-- a comment -->'
|
||||
ELEMENT 'foo'
|
||||
TEXT ''
|
||||
END 'foo'
|
2
glib/tests/markups/valid-7.gmarkup
Normal file
2
glib/tests/markups/valid-7.gmarkup
Normal file
@@ -0,0 +1,2 @@
|
||||
<!-- a comment -->
|
||||
<foo></foo>
|
5
glib/tests/markups/valid-8.expected
Normal file
5
glib/tests/markups/valid-8.expected
Normal file
@@ -0,0 +1,5 @@
|
||||
ELEMENT 'foo'
|
||||
TEXT ''
|
||||
PASS '<![CDATA[ some <<<<>>>> CDATA ]]>'
|
||||
TEXT ''
|
||||
END 'foo'
|
1
glib/tests/markups/valid-8.gmarkup
Normal file
1
glib/tests/markups/valid-8.gmarkup
Normal file
@@ -0,0 +1 @@
|
||||
<foo><![CDATA[ some <<<<>>>> CDATA ]]></foo>
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user