[glib] glib/tests: Use explicit file listings



commit 225d8fb97d4400a3417c32ee16ba3d1da570a010
Author: Colin Walters <walters verbum org>
Date:   Fri May 3 18:36:43 2013 -0400

    glib/tests: Use explicit file listings
    
    This is a preparatory commit for installed tests work; having things
    cleanly categorized helps.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=699079

 glib/tests/Makefile.am              |   71 ++++++++++++++++++++++++++++------
 glib/tests/markup-parse.c           |   10 ++--
 glib/tests/markups/fail-3.expected  |   50 ++++++++++++++++++++++++
 glib/tests/markups/fail-36.expected |    4 ++
 4 files changed, 117 insertions(+), 18 deletions(-)
---
diff --git a/glib/tests/Makefile.am b/glib/tests/Makefile.am
index 7a06a3b..9d19871 100644
--- a/glib/tests/Makefile.am
+++ b/glib/tests/Makefile.am
@@ -1,4 +1,57 @@
 include $(top_srcdir)/Makefile.decl
+NULL =
+
+bookmark_test_files = \
+       bookmarks/fail-01.xbel \
+       bookmarks/fail-02.xbel \
+       bookmarks/fail-03.xbel \
+       bookmarks/fail-04.xbel \
+       bookmarks/fail-05.xbel \
+       bookmarks/fail-06.xbel \
+       bookmarks/fail-07.xbel \
+       bookmarks/fail-08.xbel \
+       bookmarks/fail-09.xbel \
+       bookmarks/fail-10.xbel \
+       bookmarks/fail-11.xbel \
+       bookmarks/fail-12.xbel \
+       bookmarks/fail-13.xbel \
+       bookmarks/fail-14.xbel \
+       bookmarks/fail-15.xbel \
+       bookmarks/fail-16.xbel \
+       bookmarks/fail-17.xbel \
+       bookmarks/valid-01.xbel \
+       bookmarks/valid-02.xbel \
+       bookmarks/valid-03.xbel \
+       $(NULL)
+
+markup_tests = \
+       fail-1 fail-2 fail-3 fail-4 fail-5 \
+       fail-6 fail-7 fail-8 fail-9 fail-10 \
+       fail-11 fail-12 fail-13 fail-14 fail-15 \
+       fail-16 fail-17 fail-18 fail-19 fail-20 \
+       fail-21 fail-22 fail-23 fail-24 fail-25 \
+       fail-26 fail-27 fail-28 fail-29 fail-30 \
+       fail-31 fail-32 fail-33 fail-34 fail-35 \
+       fail-36 fail-37 fail-38 fail-39 fail-40 \
+       fail-41 fail-42 fail-43 fail-44 fail-45 \
+       fail-46 fail-47 fail-48 fail-49 \
+       valid-1 valid-2 valid-3 valid-4 valid-5 \
+       valid-6 valid-7 valid-8 valid-9 valid-10 \
+       valid-11 valid-12 valid-13 valid-14 valid-15 \
+       $(NULL)
+
+all_markup_test_files = $(addprefix markups/,$(markup_tests:=.gmarkup) $(markup_tests:=.expected))
+
+test_files = \
+       keyfiletest.ini         \
+       pages.ini               \
+       keyfile.c               \
+       empty                   \
+       4096-random-bytes       \
+       $(NULL)
+
+test_script_files = \
+       echo-script
 
 AM_CPPFLAGS =                          \
        -g                              \
@@ -131,17 +184,9 @@ CLEANFILES = \
        tmpsample.xml
 
 EXTRA_DIST += \
-       4096-random-bytes       \
-       keyfiletest.ini         \
-       pages.ini               \
+       $(bookmark_test_files)  \
+       $(all_markup_test_files) \
+       $(test_files)           \
+       $(test_script_files)    \
        bookmarks.xbel          \
-       empty                   \
-       echo-script
-
-dist-hook:
-       mkdir $(distdir)/markups;               \
-       for f in $(srcdir)/markups/*; do        \
-         cp $$f $(distdir)/markups; done
-       mkdir $(distdir)/bookmarks;             \
-       for f in $(srcdir)/bookmarks/* ; do     \
-         cp $$f $(distdir)/bookmarks; done
+       $(NULL)
diff --git a/glib/tests/markup-parse.c b/glib/tests/markup-parse.c
index 4c7445e..856bc94 100644
--- a/glib/tests/markup-parse.c
+++ b/glib/tests/markup-parse.c
@@ -250,6 +250,7 @@ test_parse (gconstpointer d)
   const gchar *filename = d;
   gchar *expected_file;
   gchar *expected;
+  GError *error = NULL;
   gint res;
 
   depth = 0;
@@ -263,11 +264,10 @@ test_parse (gconstpointer d)
     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_file_get_contents (expected_file, &expected, NULL, &error);
+  g_assert_no_error (error);
+  g_assert_cmpstr (string->str, ==, expected);
+  g_free (expected);
   g_free (expected_file);
 
   g_string_free (string, TRUE);
diff --git a/glib/tests/markups/fail-3.expected b/glib/tests/markups/fail-3.expected
new file mode 100644
index 0000000..e39f81c
--- /dev/null
+++ b/glib/tests/markups/fail-3.expected
@@ -0,0 +1,50 @@
+ELEMENT 'foobar'
+ERROR Error on line 49 char 2: Invalid UTF-8 encoded text in name - not valid '
+Παν語
+
+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  --      元氣      開發
+
+
+'
diff --git a/glib/tests/markups/fail-36.expected b/glib/tests/markups/fail-36.expected
new file mode 100644
index 0000000..2bd9fbb
--- /dev/null
+++ b/glib/tests/markups/fail-36.expected
@@ -0,0 +1,4 @@
+ELEMENT 'foo'
+  TEXT '�'
+END 'foo'
+ERROR Error on line 2 char 1: '^$non-carriage-null-fail|' is not a valid name


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]