Output that test-markup is expected to produce when run on the valid

2006-05-28  Matthias Clasen  <mclasen@redhat.com>

	* tests/markups/expected-*: Output that test-markup
	is expected to produce when run on the valid gmarkup
	examples.

	* tests/markup-test.c: Only dump the results of the
	first, unchunked parse, to compare it against the expected
	output.

	* tests/run-markup-tests.sh: For valid examples, compare
	the output of test-markup against the corresponding
	expected-<n> file.
This commit is contained in:
Matthias Clasen 2006-05-28 22:58:41 +00:00 committed by Matthias Clasen
parent 2585e9aadb
commit c8922bb143
15 changed files with 258 additions and 8 deletions

View File

@ -1,3 +1,17 @@
2006-05-28 Matthias Clasen <mclasen@redhat.com>
* tests/markups/expected-*: Output that test-markup
is expected to produce when run on the valid gmarkup
examples.
* tests/markup-test.c: Only dump the results of the
first, unchunked parse, to compare it against the expected
output.
* tests/run-markup-tests.sh: For valid examples, compare
the output of test-markup against the corresponding
expected-<n> file.
2006-05-24 Matthias Clasen <mclasen@redhat.com> 2006-05-24 Matthias Clasen <mclasen@redhat.com>
* configure.in: Don't compile timeloop on Minix. * configure.in: Don't compile timeloop on Minix.

View File

@ -1,3 +1,17 @@
2006-05-28 Matthias Clasen <mclasen@redhat.com>
* tests/markups/expected-*: Output that test-markup
is expected to produce when run on the valid gmarkup
examples.
* tests/markup-test.c: Only dump the results of the
first, unchunked parse, to compare it against the expected
output.
* tests/run-markup-tests.sh: For valid examples, compare
the output of test-markup against the corresponding
expected-<n> file.
2006-05-24 Matthias Clasen <mclasen@redhat.com> 2006-05-24 Matthias Clasen <mclasen@redhat.com>
* configure.in: Don't compile timeloop on Minix. * configure.in: Don't compile timeloop on Minix.

View File

@ -54,10 +54,10 @@ end_element_handler (GMarkupParseContext *context,
--depth; --depth;
indent (0); indent (0);
printf ("END '%s'\n", element_name); printf ("END '%s'\n", element_name);
} }
static void static void
text_handler (GMarkupParseContext *context, text_handler (GMarkupParseContext *context,
const gchar *text, const gchar *text,
gsize text_len, gsize text_len,
gpointer user_data, gpointer user_data,
@ -88,7 +88,7 @@ error_handler (GMarkupParseContext *context,
fprintf (stderr, " %s\n", error->message); fprintf (stderr, " %s\n", error->message);
} }
static GMarkupParser parser = { static const GMarkupParser parser = {
start_element_handler, start_element_handler,
end_element_handler, end_element_handler,
text_handler, text_handler,
@ -96,6 +96,14 @@ static GMarkupParser parser = {
error_handler error_handler
}; };
static const GMarkupParser silent_parser = {
NULL,
NULL,
NULL,
NULL,
error_handler
};
static int static int
test_in_chunks (const gchar *contents, test_in_chunks (const gchar *contents,
gint length, gint length,
@ -104,7 +112,7 @@ test_in_chunks (const gchar *contents,
GMarkupParseContext *context; GMarkupParseContext *context;
int i = 0; int i = 0;
context = g_markup_parse_context_new (&parser, 0, NULL, NULL); context = g_markup_parse_context_new (&silent_parser, 0, NULL, NULL);
while (i < length) while (i < length)
{ {

37
tests/markups/expected-1 Normal file
View 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'

View File

@ -0,0 +1,6 @@
ELEMENT 'foo'
bar="baz"
bar2="baz2"
bar3="baz3"
TEXT 'data'
END 'foo'

View File

@ -0,0 +1,3 @@
ELEMENT 'foo'
TEXT 'data'
END 'foo'

51
tests/markups/expected-2 Normal file
View 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'

61
tests/markups/expected-3 Normal file
View 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'

29
tests/markups/expected-4 Normal file
View 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'

4
tests/markups/expected-5 Normal file
View File

@ -0,0 +1,4 @@
PASS '<?xml version="1.0" ?>'
ELEMENT 'foo'
TEXT ''
END 'foo'

6
tests/markups/expected-6 Normal file
View File

@ -0,0 +1,6 @@
PASS '<!DOCTYPE foo "foo" [
<!ELEMENT foo ANY >
]>'
ELEMENT 'foo'
TEXT ''
END 'foo'

4
tests/markups/expected-7 Normal file
View File

@ -0,0 +1,4 @@
PASS '<!-- a comment -->'
ELEMENT 'foo'
TEXT ''
END 'foo'

5
tests/markups/expected-8 Normal file
View File

@ -0,0 +1,5 @@
ELEMENT 'foo'
TEXT ''
PASS '<![CDATA[ some <<<<>>>> CDATA ]]>'
TEXT ''
END 'foo'

3
tests/markups/expected-9 Normal file
View File

@ -0,0 +1,3 @@
ELEMENT 'foo'
TEXT 'data'
END 'foo'

View File

@ -26,9 +26,14 @@ for I in ${srcdir:-.}/markups/fail-*.gmarkup; do
fi fi
done done
for I in ${srcdir:-.}/markups/valid-*.gmarkup; do for (( I=1 ; I < 100 ; I++ )) ; do
echo_v "Parsing $I, should succeed" F=${srcdir:-.}/markups/valid-$I.gmarkup
./markup-test $I > /dev/null 2> $error_out || fail "failed on $I" if [ -f $F ] ; then
echo_v "Parsing $F, should succeed"
./markup-test $F > actual 2> $error_out || fail "failed on $F"
diff -u ${srcdir:-.}/markups/expected-$I actual || fail "unexpected output on $F"
rm actual
fi
done done
echo_v "All tests passed." echo_v "All tests passed."