Output that test-markup is expected to produce when run on the valid
authorMatthias Clasen <mclasen@redhat.com>
Sun, 28 May 2006 22:58:41 +0000 (22:58 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sun, 28 May 2006 22:58:41 +0000 (22:58 +0000)
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.

15 files changed:
ChangeLog
ChangeLog.pre-2-12
tests/markup-test.c
tests/markups/expected-1 [new file with mode: 0644]
tests/markups/expected-10 [new file with mode: 0644]
tests/markups/expected-11 [new file with mode: 0644]
tests/markups/expected-2 [new file with mode: 0644]
tests/markups/expected-3 [new file with mode: 0644]
tests/markups/expected-4 [new file with mode: 0644]
tests/markups/expected-5 [new file with mode: 0644]
tests/markups/expected-6 [new file with mode: 0644]
tests/markups/expected-7 [new file with mode: 0644]
tests/markups/expected-8 [new file with mode: 0644]
tests/markups/expected-9 [new file with mode: 0644]
tests/run-markup-tests.sh

index 5db5a35..fb1f1cc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * configure.in: Don't compile timeloop on Minix. 
index 5db5a35..fb1f1cc 100644 (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>
 
        * configure.in: Don't compile timeloop on Minix. 
index af19a5e..6d5f44b 100644 (file)
@@ -54,10 +54,10 @@ end_element_handler    (GMarkupParseContext *context,
   --depth;
   indent (0);
   printf ("END '%s'\n", element_name);
-}
+  }
 
 static void
-text_handler           (GMarkupParseContext *context,
+text_handler                      (GMarkupParseContext *context,
                         const gchar         *text,
                         gsize                text_len,
                         gpointer             user_data,
@@ -88,7 +88,7 @@ error_handler          (GMarkupParseContext *context,
   fprintf (stderr, " %s\n", error->message);
 }
 
-static GMarkupParser parser = {
+static const GMarkupParser parser = {
   start_element_handler,
   end_element_handler,
   text_handler,
@@ -96,6 +96,14 @@ static GMarkupParser parser = {
   error_handler
 };
 
+static const GMarkupParser silent_parser = {
+  NULL,
+  NULL,
+  NULL,
+  NULL,
+  error_handler
+};
+
 static int
 test_in_chunks (const gchar *contents,
                 gint         length,
@@ -104,7 +112,7 @@ test_in_chunks (const gchar *contents,
   GMarkupParseContext *context;
   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)
     {
diff --git a/tests/markups/expected-1 b/tests/markups/expected-1
new file mode 100644 (file)
index 0000000..8b6cdd7
--- /dev/null
@@ -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'
diff --git a/tests/markups/expected-10 b/tests/markups/expected-10
new file mode 100644 (file)
index 0000000..e7b8af8
--- /dev/null
@@ -0,0 +1,6 @@
+ELEMENT 'foo'
+bar="baz"
+bar2="baz2"
+bar3="baz3"
+  TEXT 'data'
+END 'foo'
diff --git a/tests/markups/expected-11 b/tests/markups/expected-11
new file mode 100644 (file)
index 0000000..7810394
--- /dev/null
@@ -0,0 +1,3 @@
+ELEMENT 'foo'
+  TEXT 'data'
+END 'foo'
diff --git a/tests/markups/expected-2 b/tests/markups/expected-2
new file mode 100644 (file)
index 0000000..82a531a
--- /dev/null
@@ -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'
diff --git a/tests/markups/expected-3 b/tests/markups/expected-3
new file mode 100644 (file)
index 0000000..9b44653
--- /dev/null
@@ -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'
diff --git a/tests/markups/expected-4 b/tests/markups/expected-4
new file mode 100644 (file)
index 0000000..395f453
--- /dev/null
@@ -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'
diff --git a/tests/markups/expected-5 b/tests/markups/expected-5
new file mode 100644 (file)
index 0000000..12d05c8
--- /dev/null
@@ -0,0 +1,4 @@
+PASS '<?xml version="1.0" ?>'
+ELEMENT 'foo'
+  TEXT ''
+END 'foo'
diff --git a/tests/markups/expected-6 b/tests/markups/expected-6
new file mode 100644 (file)
index 0000000..bfb41ce
--- /dev/null
@@ -0,0 +1,6 @@
+PASS '<!DOCTYPE foo "foo" [
+<!ELEMENT foo ANY >
+]>'
+ELEMENT 'foo'
+  TEXT ''
+END 'foo'
diff --git a/tests/markups/expected-7 b/tests/markups/expected-7
new file mode 100644 (file)
index 0000000..2fe1975
--- /dev/null
@@ -0,0 +1,4 @@
+PASS '<!-- a comment -->'
+ELEMENT 'foo'
+  TEXT ''
+END 'foo'
diff --git a/tests/markups/expected-8 b/tests/markups/expected-8
new file mode 100644 (file)
index 0000000..5bbda04
--- /dev/null
@@ -0,0 +1,5 @@
+ELEMENT 'foo'
+  TEXT ''
+  PASS '<![CDATA[ some <<<<>>>> CDATA ]]>'
+  TEXT ''
+END 'foo'
diff --git a/tests/markups/expected-9 b/tests/markups/expected-9
new file mode 100644 (file)
index 0000000..7810394
--- /dev/null
@@ -0,0 +1,3 @@
+ELEMENT 'foo'
+  TEXT 'data'
+END 'foo'
index 94ec143..db6b474 100755 (executable)
@@ -17,7 +17,7 @@ error_out=/dev/null
 if [ "$1" = "-v" ]; then
   verbose=1
   error_out=/dev/stderr
-fi  
+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"
@@ -26,9 +26,14 @@ for I in ${srcdir:-.}/markups/fail-*.gmarkup; do
   fi  
 done
 
-for I in ${srcdir:-.}/markups/valid-*.gmarkup; do
-  echo_v "Parsing $I, should succeed"
-  ./markup-test $I > /dev/null 2> $error_out || fail "failed on $I"
+for (( I=1 ; I < 100 ; I++ )) ; 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 -u ${srcdir:-.}/markups/expected-$I actual || fail "unexpected output on $F"
+    rm actual
+  fi
 done
 
 echo_v "All tests passed."