[evolution-data-server/openismus-work-master: 36/46] libedata-book tests: Changed all cursor tests to use new testing APIs



commit a68c359f18a69479ad4944cc6ea891aa6db05814
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Mon May 27 12:04:16 2013 +0900

    libedata-book tests: Changed all cursor tests to use new testing APIs
    
    Mostly changed to include the locale in the move-by tests and to stop
    setting the 'EDS_COLLATE' variable to hack the current locale used by
    the backend.

 tests/libedata-book/test-sqlite-cursor-calculate.c |    3 ---
 .../test-sqlite-cursor-de-DE-migrated.c            |    3 +--
 .../test-sqlite-cursor-en-US-migrated.c            |    3 +--
 .../test-sqlite-cursor-fr-CA-migrated.c            |    3 +--
 .../test-sqlite-cursor-move-by-de-DE.c             |   13 +++++--------
 .../test-sqlite-cursor-move-by-en-US.c             |   13 +++++--------
 .../test-sqlite-cursor-move-by-fr-CA.c             |   13 +++++--------
 .../test-sqlite-cursor-move-by-posix.c             |   13 +++++--------
 .../test-sqlite-cursor-posix-initial.c             |    4 +---
 .../test-sqlite-cursor-posix-migrated.c            |    3 +--
 tests/libedata-book/test-sqlite-cursor-set-sexp.c  |    3 ---
 .../libedata-book/test-sqlite-cursor-set-target.c  |    3 ---
 12 files changed, 25 insertions(+), 52 deletions(-)
---
diff --git a/tests/libedata-book/test-sqlite-cursor-calculate.c 
b/tests/libedata-book/test-sqlite-cursor-calculate.c
index 7638b8c..029a768 100644
--- a/tests/libedata-book/test-sqlite-cursor-calculate.c
+++ b/tests/libedata-book/test-sqlite-cursor-calculate.c
@@ -413,9 +413,6 @@ main (gint argc,
 #endif
        g_test_init (&argc, &argv, NULL);
 
-       /* Ensure that the client and server get the same locale */
-       g_assert (g_setenv ("EDS_COLLATE", "en_US.UTF-8", TRUE));
-
        g_test_add ("/EbSdbCursor/Calculate/Initial", EbSdbCursorFixture, &book_closure,
                    e_sqlitedb_cursor_fixture_setup,
                    test_cursor_calculate_initial,
diff --git a/tests/libedata-book/test-sqlite-cursor-de-DE-migrated.c 
b/tests/libedata-book/test-sqlite-cursor-de-DE-migrated.c
index d281635..9944ddc 100644
--- a/tests/libedata-book/test-sqlite-cursor-de-DE-migrated.c
+++ b/tests/libedata-book/test-sqlite-cursor-de-DE-migrated.c
@@ -18,10 +18,9 @@ main (gint argc,
        g_test_init (&argc, &argv, NULL);
 
        /* Ensure that the client and server get the same locale */
-       g_assert (g_setenv ("EDS_COLLATE", "de_DE.UTF-8", TRUE));
        g_assert (g_setenv ("MIGRATION_TEST_SOURCE_NAME", "migration-test-source", TRUE));
 
-       data = move_by_test_new ("/EbSdbCursor/Locale/de_DE/Migrated");
+       data = move_by_test_new ("/EbSdbCursor/Locale/de_DE/Migrated", "de_DE.UTF-8");
        move_by_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
        move_by_test_add_assertion (data, 5, 7,  8,  4,  3,  15);
        move_by_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
diff --git a/tests/libedata-book/test-sqlite-cursor-en-US-migrated.c 
b/tests/libedata-book/test-sqlite-cursor-en-US-migrated.c
index 01d1c47..7e2f969 100644
--- a/tests/libedata-book/test-sqlite-cursor-en-US-migrated.c
+++ b/tests/libedata-book/test-sqlite-cursor-en-US-migrated.c
@@ -19,10 +19,9 @@ main (gint argc,
        g_test_init (&argc, &argv, NULL);
 
        /* Ensure that the client and server get the same locale */
-       g_assert (g_setenv ("EDS_COLLATE", "en_US.UTF-8", TRUE));
        g_assert (g_setenv ("MIGRATION_TEST_SOURCE_NAME", "migration-test-source", TRUE));
 
-       data = move_by_test_new ("/EbSdbCursor/Locale/en_US/Migrated");
+       data = move_by_test_new ("/EbSdbCursor/Locale/en_US/Migrated", "en_US.UTF-8");
        move_by_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
        move_by_test_add_assertion (data, 5, 4,  3,  7,  8,  15);
        move_by_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
diff --git a/tests/libedata-book/test-sqlite-cursor-fr-CA-migrated.c 
b/tests/libedata-book/test-sqlite-cursor-fr-CA-migrated.c
index e70b709..bc1cc9b 100644
--- a/tests/libedata-book/test-sqlite-cursor-fr-CA-migrated.c
+++ b/tests/libedata-book/test-sqlite-cursor-fr-CA-migrated.c
@@ -18,10 +18,9 @@ main (gint argc,
        g_test_init (&argc, &argv, NULL);
 
        /* Ensure that the client and server get the same locale */
-       g_assert (g_setenv ("EDS_COLLATE", "fr_CA.UTF-8", TRUE));
        g_assert (g_setenv ("MIGRATION_TEST_SOURCE_NAME", "migration-test-source", TRUE));
 
-       data = move_by_test_new ("/EbSdbCursor/Locale/fr_CA/Migrated");
+       data = move_by_test_new ("/EbSdbCursor/Locale/fr_CA/Migrated", "fr_CA.UTF-8");
        move_by_test_add_assertion (data, 5, 11, 1,  2,  5,  6);
        move_by_test_add_assertion (data, 5, 4,  3,  7,  8,  15);
        move_by_test_add_assertion (data, 5, 17, 16, 18, 10, 14);
diff --git a/tests/libedata-book/test-sqlite-cursor-move-by-de-DE.c 
b/tests/libedata-book/test-sqlite-cursor-move-by-de-DE.c
index 7638ea7..d3fac4e 100644
--- a/tests/libedata-book/test-sqlite-cursor-move-by-de-DE.c
+++ b/tests/libedata-book/test-sqlite-cursor-move-by-de-DE.c
@@ -17,30 +17,27 @@ main (gint argc,
 #endif
        g_test_init (&argc, &argv, NULL);
 
-       /* Ensure that the client and server get the same locale */
-       g_assert (g_setenv ("EDS_COLLATE", "de_DE.UTF-8", TRUE));
-
-       data = move_by_test_new ("/EbSdbCursor/de_DE/Move/Forward");
+       data = move_by_test_new ("/EbSdbCursor/de_DE/Move/Forward", "de_DE.UTF-8");
        move_by_test_add_assertion (data, 5, 11, 1, 2, 5, 6);
        move_by_test_add_assertion (data, 6, 7, 8, 4, 3, 15, 17);
        move_by_test_add (data, FALSE);
 
-       data = move_by_test_new ("/EbSdbCursor/de_DE/Move/ForwardOnNameless");
+       data = move_by_test_new ("/EbSdbCursor/de_DE/Move/ForwardOnNameless", "de_DE.UTF-8");
        move_by_test_add_assertion (data, 1, 11);
        move_by_test_add_assertion (data, 3, 1, 2, 5);
        move_by_test_add (data, FALSE);
 
-       data = move_by_test_new ("/EbSdbCursor/de_DE/Move/Backwards");
+       data = move_by_test_new ("/EbSdbCursor/de_DE/Move/Backwards", "de_DE.UTF-8");
        move_by_test_add_assertion (data, -5, 19, 20, 9, 13, 12);
        move_by_test_add_assertion (data, -8, 14, 10, 18, 16, 17, 15, 3, 4);
        move_by_test_add (data, FALSE);
 
-       data = move_by_test_new ("/EbSdbCursor/de_DE/Filtered/Move/Forward");
+       data = move_by_test_new ("/EbSdbCursor/de_DE/Filtered/Move/Forward", "de_DE.UTF-8");
        move_by_test_add_assertion (data, 5, 11, 1, 2, 5, 8);
        move_by_test_add_assertion (data, 8, 3, 17, 16, 18, 10, 14, 12, 9);
        move_by_test_add (data, TRUE);
 
-       data = move_by_test_new ("/EbSdbCursor/de_DE/Filtered/Move/Backwards");
+       data = move_by_test_new ("/EbSdbCursor/de_DE/Filtered/Move/Backwards", "de_DE.UTF-8");
        move_by_test_add_assertion (data, -5, 9, 12, 14, 10, 18);
        move_by_test_add_assertion (data, -8, 16, 17, 3, 8, 5, 2, 1, 11);
        move_by_test_add (data, TRUE);
diff --git a/tests/libedata-book/test-sqlite-cursor-move-by-en-US.c 
b/tests/libedata-book/test-sqlite-cursor-move-by-en-US.c
index 7c095ec..5411b08 100644
--- a/tests/libedata-book/test-sqlite-cursor-move-by-en-US.c
+++ b/tests/libedata-book/test-sqlite-cursor-move-by-en-US.c
@@ -17,30 +17,27 @@ main (gint argc,
 #endif
        g_test_init (&argc, &argv, NULL);
 
-       /* Ensure that the client and server get the same locale */
-       g_assert (g_setenv ("EDS_COLLATE", "en_US.UTF-8", TRUE));
-
-       data = move_by_test_new ("/EbSdbCursor/en_US/Move/Forward");
+       data = move_by_test_new ("/EbSdbCursor/en_US/Move/Forward", "en_US.UTF-8");
        move_by_test_add_assertion (data, 5, 11, 1, 2, 5, 6);
        move_by_test_add_assertion (data, 6, 4, 3, 7, 8, 15, 17);
        move_by_test_add (data, FALSE);
 
-       data = move_by_test_new ("/EbSdbCursor/en_US/Move/ForwardOnNameless");
+       data = move_by_test_new ("/EbSdbCursor/en_US/Move/ForwardOnNameless", "en_US.UTF-8");
        move_by_test_add_assertion (data, 1, 11);
        move_by_test_add_assertion (data, 3, 1, 2, 5);
        move_by_test_add (data, FALSE);
 
-       data = move_by_test_new ("/EbSdbCursor/en_US/Move/Backwards");
+       data = move_by_test_new ("/EbSdbCursor/en_US/Move/Backwards", "en_US.UTF-8");
        move_by_test_add_assertion (data, -5, 20, 19, 9, 13, 12);
        move_by_test_add_assertion (data, -8, 14, 10, 18, 16, 17, 15, 8, 7);
        move_by_test_add (data, FALSE);
 
-       data = move_by_test_new ("/EbSdbCursor/en_US/Filtered/Move/Forward");
+       data = move_by_test_new ("/EbSdbCursor/en_US/Filtered/Move/Forward", "en_US.UTF-8");
        move_by_test_add_assertion (data, 5, 11, 1, 2, 5, 3);
        move_by_test_add_assertion (data, 8, 8, 17, 16, 18, 10, 14, 12, 9);
        move_by_test_add (data, TRUE);
 
-       data = move_by_test_new ("/EbSdbCursor/en_US/Filtered/Move/Backwards");
+       data = move_by_test_new ("/EbSdbCursor/en_US/Filtered/Move/Backwards", "en_US.UTF-8");
        move_by_test_add_assertion (data, -5, 9, 12, 14, 10, 18);
        move_by_test_add_assertion (data, -8, 16, 17, 8, 3, 5, 2, 1, 11);
        move_by_test_add (data, TRUE);
diff --git a/tests/libedata-book/test-sqlite-cursor-move-by-fr-CA.c 
b/tests/libedata-book/test-sqlite-cursor-move-by-fr-CA.c
index 3c7ecdd..4d13e24 100644
--- a/tests/libedata-book/test-sqlite-cursor-move-by-fr-CA.c
+++ b/tests/libedata-book/test-sqlite-cursor-move-by-fr-CA.c
@@ -17,30 +17,27 @@ main (gint argc,
 #endif
        g_test_init (&argc, &argv, NULL);
 
-       /* Ensure that the client and server get the same locale */
-       g_assert (g_setenv ("EDS_COLLATE", "fr_CA.UTF-8", TRUE));
-
-       data = move_by_test_new ("/EbSdbCursor/fr_CA/Move/Forward");
+       data = move_by_test_new ("/EbSdbCursor/fr_CA/Move/Forward", "fr_CA.UTF-8");
        move_by_test_add_assertion (data, 5, 11, 1, 2, 5, 6);
        move_by_test_add_assertion (data, 6, 4, 3, 7, 8, 15, 17);
        move_by_test_add (data, FALSE);
 
-       data = move_by_test_new ("/EbSdbCursor/fr_CA/Move/ForwardOnNameless");
+       data = move_by_test_new ("/EbSdbCursor/fr_CA/Move/ForwardOnNameless", "fr_CA.UTF-8");
        move_by_test_add_assertion (data, 1, 11);
        move_by_test_add_assertion (data, 3, 1, 2, 5);
        move_by_test_add (data, FALSE);
 
-       data = move_by_test_new ("/EbSdbCursor/fr_CA/Move/Backwards");
+       data = move_by_test_new ("/EbSdbCursor/fr_CA/Move/Backwards", "fr_CA.UTF-8");
        move_by_test_add_assertion (data, -5, 20, 19, 9, 12, 13);
        move_by_test_add_assertion (data, -8, 14, 10, 18, 16, 17, 15, 8, 7);
        move_by_test_add (data, FALSE);
 
-       data = move_by_test_new ("/EbSdbCursor/fr_CA/Filtered/Move/Forward");
+       data = move_by_test_new ("/EbSdbCursor/fr_CA/Filtered/Move/Forward", "fr_CA.UTF-8");
        move_by_test_add_assertion (data, 5, 11, 1, 2, 5, 3);
        move_by_test_add_assertion (data, 8, 8, 17, 16, 18, 10, 14, 12, 9);
        move_by_test_add (data, TRUE);
 
-       data = move_by_test_new ("/EbSdbCursor/fr_CA/Filtered/Move/Backwards");
+       data = move_by_test_new ("/EbSdbCursor/fr_CA/Filtered/Move/Backwards", "fr_CA.UTF-8");
        move_by_test_add_assertion (data, -5, 9, 12, 14, 10, 18);
        move_by_test_add_assertion (data, -8, 16, 17, 8, 3, 5, 2, 1, 11);
        move_by_test_add (data, TRUE);
diff --git a/tests/libedata-book/test-sqlite-cursor-move-by-posix.c 
b/tests/libedata-book/test-sqlite-cursor-move-by-posix.c
index 9b1365a..b35990a 100644
--- a/tests/libedata-book/test-sqlite-cursor-move-by-posix.c
+++ b/tests/libedata-book/test-sqlite-cursor-move-by-posix.c
@@ -17,30 +17,27 @@ main (gint argc,
 #endif
        g_test_init (&argc, &argv, NULL);
 
-       /* Ensure that the client and server get the same locale */
-       g_assert (g_setenv ("EDS_COLLATE", "POSIX", TRUE));
-
-       data = move_by_test_new ("/EbSdbCursor/POSIX/Move/Forward");
+       data = move_by_test_new ("/EbSdbCursor/POSIX/Move/Forward", "POSIX");
        move_by_test_add_assertion (data, 5, 11, 2, 6, 3, 8);
        move_by_test_add_assertion (data, 6, 10, 19, 20, 1, 5, 4);
        move_by_test_add (data, FALSE);
 
-       data = move_by_test_new ("/EbSdbCursor/POSIX/Move/ForwardOnNameless");
+       data = move_by_test_new ("/EbSdbCursor/POSIX/Move/ForwardOnNameless", "POSIX");
        move_by_test_add_assertion (data, 1, 11);
        move_by_test_add_assertion (data, 3, 2, 6, 3);
        move_by_test_add (data, FALSE);
 
-       data = move_by_test_new ("/EbSdbCursor/POSIX/Move/Backwards");
+       data = move_by_test_new ("/EbSdbCursor/POSIX/Move/Backwards", "POSIX");
        move_by_test_add_assertion (data, -5, 9, 13, 12, 14, 18);
        move_by_test_add_assertion (data, -12, 16, 17, 15, 7, 4, 5, 1, 20, 19, 10, 8, 3);
        move_by_test_add (data, FALSE);
 
-       data = move_by_test_new ("/EbSdbCursor/POSIX/Filtered/Move/Forward");
+       data = move_by_test_new ("/EbSdbCursor/POSIX/Filtered/Move/Forward", "POSIX");
        move_by_test_add_assertion (data, 5, 11, 2, 3, 8, 10);
        move_by_test_add_assertion (data, 8, 1, 5, 17, 16, 18, 14, 12, 9);
        move_by_test_add (data, TRUE);
 
-       data = move_by_test_new ("/EbSdbCursor/POSIX/Filtered/Move/Backwards");
+       data = move_by_test_new ("/EbSdbCursor/POSIX/Filtered/Move/Backwards", "POSIX");
        move_by_test_add_assertion (data, -5, 9, 12, 14, 18, 16);
        move_by_test_add_assertion (data, -8, 17, 5, 1, 10, 8, 3, 2, 11);
        move_by_test_add (data, TRUE);
diff --git a/tests/libedata-book/test-sqlite-cursor-posix-initial.c 
b/tests/libedata-book/test-sqlite-cursor-posix-initial.c
index 85411ba..e7c234f 100644
--- a/tests/libedata-book/test-sqlite-cursor-posix-initial.c
+++ b/tests/libedata-book/test-sqlite-cursor-posix-initial.c
@@ -17,15 +17,13 @@ main (gint argc,
 #endif
        g_test_init (&argc, &argv, NULL);
 
-       /* Ensure that the client and server get the same locale */
-       g_assert (g_setenv ("EDS_COLLATE", "POSIX", TRUE));
        g_assert (g_setenv ("MIGRATION_TEST_SOURCE_NAME", "migration-test-source", TRUE));
 
        /* This test actually creates the addressbook, subsequent migration tests dont
         * recreate the contacts but rely on the addressbook to have migrated the sort keys
         * into the new locales
         */
-       data = move_by_test_new ("/EbSdbCursor/Locale/POSIX/Initial");
+       data = move_by_test_new ("/EbSdbCursor/Locale/POSIX/Initial", "POSIX");
        move_by_test_add_assertion (data, 5, 11, 2,  6,  3,  8);
        move_by_test_add_assertion (data, 5, 10, 19, 20, 1,  5);
        move_by_test_add_assertion (data, 5, 4,  7,  15, 17, 16);
diff --git a/tests/libedata-book/test-sqlite-cursor-posix-migrated.c 
b/tests/libedata-book/test-sqlite-cursor-posix-migrated.c
index 5cb6676..632a593 100644
--- a/tests/libedata-book/test-sqlite-cursor-posix-migrated.c
+++ b/tests/libedata-book/test-sqlite-cursor-posix-migrated.c
@@ -18,10 +18,9 @@ main (gint argc,
        g_test_init (&argc, &argv, NULL);
 
        /* Ensure that the client and server get the same locale */
-       g_assert (g_setenv ("EDS_COLLATE", "POSIX", TRUE));
        g_assert (g_setenv ("MIGRATION_TEST_SOURCE_NAME", "migration-test-source", TRUE));
 
-       data = move_by_test_new ("/EbSdbCursor/Locale/POSIX/Migrated");
+       data = move_by_test_new ("/EbSdbCursor/Locale/POSIX/Migrated", "POSIX");
        move_by_test_add_assertion (data, 5, 11, 2,  6,  3,  8);
        move_by_test_add_assertion (data, 5, 10, 19, 20, 1,  5);
        move_by_test_add_assertion (data, 5, 4,  7,  15, 17, 16);
diff --git a/tests/libedata-book/test-sqlite-cursor-set-sexp.c 
b/tests/libedata-book/test-sqlite-cursor-set-sexp.c
index 473be38..f52877f 100644
--- a/tests/libedata-book/test-sqlite-cursor-set-sexp.c
+++ b/tests/libedata-book/test-sqlite-cursor-set-sexp.c
@@ -78,9 +78,6 @@ main (gint argc,
 #endif
        g_test_init (&argc, &argv, NULL);
 
-       /* Ensure that the client and server get the same locale */
-       g_assert (g_setenv ("EDS_COLLATE", "en_US.UTF-8", TRUE));
-
        g_test_add ("/EbSdbCursor/SetSexp/Invalid", EbSdbCursorFixture, &book_closure,
                    e_sqlitedb_cursor_fixture_setup,
                    test_cursor_sexp_invalid,
diff --git a/tests/libedata-book/test-sqlite-cursor-set-target.c 
b/tests/libedata-book/test-sqlite-cursor-set-target.c
index de1db46..d0ad7e6 100644
--- a/tests/libedata-book/test-sqlite-cursor-set-target.c
+++ b/tests/libedata-book/test-sqlite-cursor-set-target.c
@@ -220,9 +220,6 @@ main (gint argc,
 #endif
        g_test_init (&argc, &argv, NULL);
 
-       /* Ensure that the client and server get the same locale */
-       g_assert (g_setenv ("EDS_COLLATE", "en_US.UTF-8", TRUE));
-
        g_test_add ("/EbSdbCursor/SetTarget/ResetCursor", EbSdbCursorFixture, &book_closure,
                    e_sqlitedb_cursor_fixture_setup,
                    test_cursor_set_target_reset_cursor,


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