[gnome-keyring: 10/10] Merge branch 'gnome-3-0'



commit 410aa647a4514bb20867164b0946173f514d0710
Merge: ba0956a 2ac257d
Author: Stef Walter <stefw collabora co uk>
Date:   Mon Apr 25 09:07:17 2011 +0200

    Merge branch 'gnome-3-0'
    
    Conflicts:
    	gcr/Makefile.am
    	gcr/tests/Makefile.am

 .gitignore                                         |   43 ++
 Makefile.am                                        |    4 +-
 NEWS                                               |   10 +
 configure.in                                       |   39 +-
 daemon/control/tests/Makefile.am                   |   32 +-
 ...test-control-change.c => frob-control-change.c} |   11 +-
 .../{test-control-init.c => frob-control-init.c}   |   11 +-
 .../{test-control-quit.c => frob-control-quit.c}   |   11 +-
 ...test-control-unlock.c => frob-control-unlock.c} |   11 +-
 daemon/dbus/gkd-dbus-secrets.c                     |    2 +-
 daemon/dbus/gkd-dbus.c                             |    2 +-
 daemon/dbus/tests/Makefile.am                      |    6 +-
 daemon/gkd-main.c                                  |    6 +-
 daemon/gkd-pkcs11.c                                |    2 +-
 daemon/ssh-agent/gkd-ssh-agent-ops.c               |    2 -
 egg/tests/Makefile.am                              |   12 +-
 egg/tests/test-asn1.c                              |   10 +-
 egg/tests/test-asn1x.c                             |   23 +-
 egg/tests/test-cleanup.c                           |    2 +-
 egg/tests/test-dh.c                                |   13 +-
 egg/tests/test-dn.c                                |   12 +-
 egg/tests/test-hex.c                               |    2 +-
 egg/tests/test-hkdf.c                              |    6 +-
 egg/tests/test-oid.c                               |    2 +-
 egg/tests/test-openssl.c                           |   10 +-
 egg/tests/test-padding.c                           |    4 +-
 egg/tests/test-secmem.c                            |    2 +-
 egg/tests/test-spawn.c                             |   20 +-
 egg/tests/test-symkey.c                            |    6 +-
 gck/Makefile.am                                    |   21 +-
 gck/gck-mock.h                                     |    6 +-
 gck/gck-test.h                                     |    4 -
 gck/tests/Makefile.am                              |   19 +-
 gck/tests/test-gck-crypto.c                        |    8 +-
 gck/tests/test-gck-enumerator.c                    |    8 +-
 gck/tests/test-gck-module.c                        |   10 +-
 gck/tests/test-gck-modules.c                       |    8 +-
 gck/tests/test-gck-object.c                        |    8 +-
 gck/tests/test-gck-session.c                       |    8 +-
 gck/tests/test-gck-slot.c                          |    8 +-
 gck/tests/test-gck-uri.c                           |    6 -
 gcr/Makefile.am                                    |   54 +--
 gcr/tests/Makefile.am                              |   13 +-
 gcr/tests/frob-certificate.c                       |    2 +-
 gcr/tests/frob-gnupg-selector.c                    |    6 +-
 gcr/tests/frob-key.c                               |    2 +-
 gcr/tests/frob-parser.c                            |  134 ++++
 gcr/tests/frob-selector.c                          |    2 +-
 gcr/tests/test-certificate-chain.c                 |   12 +-
 gcr/tests/test-certificate.c                       |   12 +-
 gcr/tests/test-parser.c                            |   10 +-
 gcr/tests/test-pkcs11-certificate.c                |   12 +-
 gcr/tests/test-simple-certificate.c                |   10 +-
 gcr/tests/test-trust.c                             |   10 +-
 gcr/tests/test-util.c                              |    2 +-
 pkcs11/gkm/tests/Makefile.am                       |   12 +-
 pkcs11/gkm/tests/mock-module.c                     |    2 +-
 pkcs11/gkm/tests/test-data-asn1.c                  |    2 +-
 pkcs11/gkm/tests/test-data-der.c                   |   15 +-
 pkcs11/gkm/tests/test-object.c                     |    2 +-
 pkcs11/gnome2-store/gkm-gnome2-file.c              |    3 -
 pkcs11/gnome2-store/tests/Makefile.am              |   56 ++-
 pkcs11/gnome2-store/tests/check-gnome2-module.c    |   68 ++
 .../tests/{test-data => files}/.gitempty           |    0
 .../{test-data => files}/data-file-private.store   |  Bin 494 -> 494 bytes
 .../{test-data => files}/data-file-public.store    |  Bin 216 -> 216 bytes
 .../{dump-gnome2-file.c => frob-gnome2-file.c}     |    4 +-
 pkcs11/gnome2-store/tests/test-gnome2-file.c       |  642 ++++++++++++++++++++
 pkcs11/gnome2-store/tests/test-module.c            |   34 -
 pkcs11/gnome2-store/tests/unit-test-gnome2-file.c  |  592 ------------------
 pkcs11/roots-store/gkm-roots-module.c              |    3 +-
 pkcs11/roots-store/tests/Makefile.am               |   40 +-
 pkcs11/roots-store/tests/check-roots-module.c      |   68 ++
 .../RSA_Root_Certificate_1.pem                     |    0
 .../{test-data => files}/RSA_Security_1024_v3.pem  |    0
 .../{test-data => files}/RSA_Security_2048_v3.pem  |    0
 .../Thawte_Personal_Basic_CA.pem                   |    0
 .../Thawte_Personal_Freemail_CA.pem                |    0
 .../Thawte_Personal_Premium_CA.pem                 |    0
 .../Thawte_Premium_Server_CA.pem                   |    0
 .../{test-data => files}/Thawte_Server_CA.pem      |    0
 .../Thawte_Time_Stamping_CA.pem                    |    0
 .../tests/{test-data => files}/ca-certificates.crt |    0
 .../tests/{test-data => files}/cacert.org.pem      |    0
 .../tests/{test-data => files}/der-certificate.crt |  Bin 747 -> 747 bytes
 pkcs11/roots-store/tests/test-module.c             |   34 -
 pkcs11/rpc-layer/gkm-rpc-module.c                  |   10 +-
 pkcs11/secret-store/gkm-secret-binary.c            |    4 +-
 pkcs11/secret-store/gkm-secret-binary.h            |    4 +-
 pkcs11/secret-store/gkm-secret-collection.c        |    2 +-
 pkcs11/secret-store/gkm-secret-textual.c           |    8 +-
 pkcs11/secret-store/gkm-secret-textual.h           |    4 +-
 pkcs11/secret-store/tests/Makefile.am              |   61 ++-
 .../tests/files/created-on-rhel.keyring            |  Bin 0 -> 105 bytes
 .../tests/files/created-on-solaris-opencsw.keyring |  Bin 0 -> 105 bytes
 .../tests/{test-data => files}/encrypted.keyring   |  Bin 733 -> 733 bytes
 .../{test-data => files}/plain-bad-number.keyring  |    0
 .../tests/{test-data => files}/plain.keyring       |    0
 .../{test-secret-module.c => mock-secret-module.c} |   55 ++-
 .../{test-secret-module.h => mock-secret-module.h} |    3 +-
 pkcs11/secret-store/tests/test-secret-binary.c     |  244 ++++++++
 pkcs11/secret-store/tests/test-secret-collection.c |  598 ++++++++++++++++++
 ...t-test-secret-compat.c => test-secret-compat.c} |   31 +-
 ...{unit-test-secret-data.c => test-secret-data.c} |   56 ++-
 ...t-test-secret-fields.c => test-secret-fields.c} |  104 +++-
 pkcs11/secret-store/tests/test-secret-item.c       |  482 +++++++++++++++
 pkcs11/secret-store/tests/test-secret-object.c     |  302 +++++++++
 ...t-test-secret-search.c => test-secret-search.c} |  173 +++---
 pkcs11/secret-store/tests/test-secret-textual.c    |  205 +++++++
 .../secret-store/tests/unit-test-secret-binary.c   |  200 ------
 .../tests/unit-test-secret-collection.c            |  563 -----------------
 pkcs11/secret-store/tests/unit-test-secret-item.c  |  438 -------------
 .../secret-store/tests/unit-test-secret-object.c   |  269 --------
 .../secret-store/tests/unit-test-secret-textual.c  |  184 ------
 pkcs11/ssh-store/gkm-ssh-module.c                  |    3 -
 pkcs11/ssh-store/gkm-ssh-openssh.c                 |    5 +-
 pkcs11/ssh-store/gkm-ssh-openssh.h                 |    4 +-
 pkcs11/ssh-store/tests/Makefile.am                 |   58 ++-
 pkcs11/ssh-store/tests/check-ssh-module.c          |   68 ++
 .../tests/{test-data => files}/id_dsa_encrypted    |    0
 .../{test-data => files}/id_dsa_encrypted.pub      |    0
 .../tests/{test-data => files}/id_dsa_plain        |    0
 .../tests/{test-data => files}/id_dsa_plain.pub    |    0
 .../tests/{test-data => files}/id_dsa_test.pub     |    0
 .../tests/{test-data => files}/id_rsa_encrypted    |    0
 .../{test-data => files}/id_rsa_encrypted.pub      |    0
 .../tests/{test-data => files}/id_rsa_plain        |    0
 .../tests/{test-data => files}/id_rsa_plain.pub    |    0
 .../tests/{test-data => files}/id_rsa_test.pub     |    0
 .../tests/{test-ssh-module.c => mock-ssh-module.c} |   13 +-
 .../tests/{test-ssh-module.h => mock-ssh-module.h} |    0
 ...{unit-test-private-key.c => test-private-key.c} |   67 ++-
 ...{unit-test-ssh-openssh.c => test-ssh-openssh.c} |   49 +-
 pkcs11/wrap-layer/tests/Makefile.am                |   53 ++-
 pkcs11/wrap-layer/tests/mock-secret-store.c        |    4 +-
 pkcs11/wrap-layer/tests/test-create-credential.c   |   88 ++--
 pkcs11/wrap-layer/tests/test-init-pin.c            |   60 ++-
 pkcs11/wrap-layer/tests/test-login-auto.c          |  129 +++--
 pkcs11/wrap-layer/tests/test-login-hints.c         |   19 +-
 pkcs11/wrap-layer/tests/test-login-keyring.c       |   92 ++-
 pkcs11/wrap-layer/tests/test-login-specific.c      |   74 ++-
 pkcs11/wrap-layer/tests/test-login-user.c          |   94 ++-
 pkcs11/wrap-layer/tests/test-set-pin.c             |   58 ++-
 pkcs11/xdg-store/tests/Makefile.am                 |   65 ++-
 pkcs11/xdg-store/tests/check-xdg-module.c          |   68 ++
 .../{test-data => files}/test-certificate-1.cer    |  Bin 813 -> 813 bytes
 .../{test-data => files}/test-certificate-2.cer    |  Bin 813 -> 813 bytes
 .../tests/{test-data => files}/test-refer-1.trust  |  Bin 241 -> 241 bytes
 .../{diddle-trust-file.c => frob-trust-file.c}     |    0
 pkcs11/xdg-store/tests/mock-xdg-module.c           |  214 +++++++
 .../tests/{test-xdg-module.h => mock-xdg-module.h} |   24 +-
 pkcs11/xdg-store/tests/test-xdg-module.c           |  257 +++-----
 pkcs11/xdg-store/tests/test-xdg-trust.c            |  352 +++++++-----
 testing/Makefile.am                                |   18 +-
 testing/testing-build.sh                           |  139 -----
 testing/testing.c                                  |  394 ------------
 testing/testing.h                                  |  104 ----
 testing/testing.make                               |   77 ---
 ui/Makefile.am                                     |    9 +-
 ui/gku-prompt-tool.c                               |   53 ++-
 ui/gku-prompt.c                                    |    4 +-
 ui/gku-prompt.h                                    |    4 +-
 ui/tests/Makefile.am                               |   35 +-
 ui/tests/{test-data => files}/prompt-empty         |    0
 ui/tests/{test-data => files}/prompt-full          |    0
 ui/tests/{test-data => files}/prompt-test          |    0
 ui/tests/{unit-test-util.c => test-util.c}         |   72 ++-
 167 files changed, 4847 insertions(+), 4268 deletions(-)
---
diff --cc .gitignore
index 89c20c9,e49a00a..6599821
--- a/.gitignore
+++ b/.gitignore
@@@ -107,14 -112,10 +112,15 @@@ run-test
  
  /gcr/tests/frob-certificate
  /gcr/tests/frob-key
 +/gcr/tests/frob-gnupg-selector
 +/gcr/tests/frob-selector
  /gcr/tests/frob-unlock-options
+ /gcr/tests/frob-parser
  /gcr/tests/test-certificate
  /gcr/tests/test-certificate-chain
 +/gcr/tests/test-colons
 +/gcr/tests/test-gnupg-collection
 +/gcr/tests/test-gnupg-key
  /gcr/tests/test-parser
  /gcr/tests/test-pkcs11-certificate
  /gcr/tests/test-simple-certificate
diff --cc gcr/tests/Makefile.am
index 87a3397,9d16168..e01cd15
--- a/gcr/tests/Makefile.am
+++ b/gcr/tests/Makefile.am
@@@ -1,11 -1,10 +1,11 @@@
  
  INCLUDES = \
- 	-I$(top_srcdir)/egg \
- 	-I$(top_srcdir)/gcr \
- 	-DSRCDIR=$(srcdir) \
+ 	-I$(top_builddir) \
+ 	-I$(top_srcdir) \
+ 	-DSRCDIR="\"$(srcdir)\"" \
  	-DGCR_API_SUBJECT_TO_CHANGE \
  	-DGCK_API_SUBJECT_TO_CHANGE \
 +	-DGCR_COMPILATION \
  	$(GLIB_CFLAGS) \
  	$(GTK_CFLAGS) \
  	$(LIBGCRYPT_CFLAGS)
@@@ -49,7 -42,6 +47,8 @@@ EXTRA_DIST = 
  
  noinst_PROGRAMS = \
  	frob-certificate \
 +	frob-gnupg-selector \
+ 	frob-parser \
  	frob-key \
 +	frob-selector \
  	frob-unlock-options
diff --cc gcr/tests/frob-gnupg-selector.c
index 02fd837,0000000..dfea94e
mode 100644,000000..100644
--- a/gcr/tests/frob-gnupg-selector.c
+++ b/gcr/tests/frob-gnupg-selector.c
@@@ -1,79 -1,0 +1,79 @@@
 +/*
 + * gnome-keyring
 + *
 + * Copyright (C) 2011 Collabora Ltd.
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU Lesser General Public License as
 + * published by the Free Software Foundation; either version 2.1 of
 + * the License, or (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful, but
 + * WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 + * Lesser General Public License for more details.
 + *
 + * You should have received a copy of the GNU Lesser General Public
 + * License along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 + * 02111-1307, USA.
 + *
 + * Author: Stef Walter <stefw collabora co uk>
 + */
 +
 +#include "config.h"
 +
- #include "gcr.h"
- #include "gcr-gnupg-collection.h"
- #include "gcr-gnupg-key.h"
++#include "gcr/gcr.h"
++#include "gcr/gcr-gnupg-collection.h"
++#include "gcr/gcr-gnupg-key.h"
 +
 +#include <gtk/gtk.h>
 +
 +#include <unistd.h>
 +#include <string.h>
 +#include <errno.h>
 +
 +static void
 +on_collection_loaded (GObject *source, GAsyncResult *result, gpointer unused)
 +{
 +	GError *error = NULL;
 +
 +	_gcr_gnupg_collection_load_finish (GCR_GNUPG_COLLECTION (source), result, &error);
 +	if (error) {
 +		g_warning ("collection load failed: %s", error->message);
 +		g_clear_error (&error);
 +	}
 +}
 +
 +int
 +main (int argc, char *argv[])
 +{
 +	GcrCollection *collection;
 +	GcrSelector *selector;
 +	GtkDialog *dialog;
 +
 +	gtk_init (&argc, &argv);
 +
 +	dialog = GTK_DIALOG (gtk_dialog_new ());
 +	g_object_ref_sink (dialog);
 +
 +	collection = _gcr_gnupg_collection_new (NULL);
 +	selector = gcr_selector_new (collection, GCR_GNUPG_KEY_COLUMNS, GCR_SELECTOR_MODE_MULTIPLE);
 +
 +	gtk_widget_show (GTK_WIDGET (selector));
 +	gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (dialog)), GTK_WIDGET (selector));
 +
 +	_gcr_gnupg_collection_load_async (GCR_GNUPG_COLLECTION (collection), NULL,
 +	                                  on_collection_loaded, NULL);
 +
 +	gtk_window_set_default_size (GTK_WINDOW (dialog), 550, 400);
 +	gtk_container_set_border_width (GTK_CONTAINER (dialog), 20);
 +
 +	g_object_unref (collection);
 +
 +	gtk_dialog_run (dialog);
 +	gtk_widget_destroy (GTK_WIDGET (dialog));
 +	g_object_unref (dialog);
 +
 +	return 0;
 +}
diff --cc gcr/tests/frob-selector.c
index a99f16e,0000000..da01041
mode 100644,000000..100644
--- a/gcr/tests/frob-selector.c
+++ b/gcr/tests/frob-selector.c
@@@ -1,106 -1,0 +1,106 @@@
 +
 +#include "config.h"
 +
- #include "gcr.h"
++#include "gcr/gcr.h"
 +
 +#include <gtk/gtk.h>
 +
 +#include <unistd.h>
 +#include <string.h>
 +#include <errno.h>
 +
 +static void
 +chdir_base_dir (char* argv0)
 +{
 +	gchar *dir, *base;
 +
 +	dir = g_path_get_dirname (argv0);
 +	if (chdir (dir) < 0)
 +		g_warning ("couldn't change directory to: %s: %s",
 +		           dir, g_strerror (errno));
 +
 +	base = g_path_get_basename (dir);
 +	if (strcmp (base, ".libs") == 0) {
 +		if (chdir ("..") < 0)
 +			g_warning ("couldn't change directory to ..: %s",
 +			           g_strerror (errno));
 +	}
 +
 +	g_free (base);
 +	g_free (dir);
 +}
 +
 +static void
 +on_parser_parsed (GcrParser *parser, gpointer user_data)
 +{
 +	GcrSimpleCollection *collection = user_data;
 +	GcrRenderer *renderer;
 +
 +	renderer = gcr_renderer_create (gcr_parser_get_parsed_label (parser),
 +	                                gcr_parser_get_parsed_attributes (parser));
 +
 +	if (renderer) {
 +		gcr_simple_collection_add (collection, G_OBJECT (renderer));
 +		g_object_unref (renderer);
 +	}
 +}
 +
 +static void
 +add_to_selector (GcrParser *parser, const gchar *path)
 +{
 +	GError *err = NULL;
 +	guchar *data;
 +	gsize n_data;
 +
 +	if (!g_file_get_contents (path, (gchar**)&data, &n_data, NULL))
 +		g_error ("couldn't read file: %s", path);
 +
 +	if (!gcr_parser_parse_data (parser, data, n_data, &err))
 +		g_error ("couldn't parse data: %s", err->message);
 +
 +	g_free (data);
 +}
 +
 +int
 +main (int argc, char *argv[])
 +{
 +	GcrCollection *collection;
 +	GcrSelector *selector;
 +	GtkDialog *dialog;
 +	GcrParser *parser;
 +	int i;
 +
 +	gtk_init (&argc, &argv);
 +
 +	dialog = GTK_DIALOG (gtk_dialog_new ());
 +	g_object_ref_sink (dialog);
 +
 +	collection = gcr_simple_collection_new ();
 +	selector = gcr_selector_new (collection, GCR_CERTIFICATE_COLUMNS, GCR_SELECTOR_MODE_MULTIPLE);
 +
 +	gtk_widget_show (GTK_WIDGET (selector));
 +	gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (dialog)), GTK_WIDGET (selector));
 +
 +	gtk_window_set_default_size (GTK_WINDOW (dialog), 550, 400);
 +	gtk_container_set_border_width (GTK_CONTAINER (dialog), 20);
 +
 +	parser = gcr_parser_new ();
 +	g_signal_connect (parser, "parsed", G_CALLBACK (on_parser_parsed), collection);
 +
 +	if (argc == 1) {
 +		chdir_base_dir (argv[0]);
 +		add_to_selector (parser, "files/ca-certificates.crt");
 +	} else {
 +		for (i = 1; i < argc; ++i)
 +			add_to_selector (parser, argv[i]);
 +	}
 +
 +	g_object_unref (parser);
 +	g_object_unref (collection);
 +
 +	gtk_dialog_run (dialog);
 +	gtk_widget_destroy (GTK_WIDGET (dialog));
 +	g_object_unref (dialog);
 +
 +	return 0;
 +}
diff --cc gcr/tests/test-util.c
index 015424f,0000000..8afdd5f
mode 100644,000000..100644
--- a/gcr/tests/test-util.c
+++ b/gcr/tests/test-util.c
@@@ -1,112 -1,0 +1,112 @@@
 +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
 +/*
 +   Copyright (C) 2011 Collabora Ltd.
 +
 +   The Gnome Keyring Library is free software; you can redistribute it and/or
 +   modify it under the terms of the GNU Library General Public License as
 +   published by the Free Software Foundation; either version 2 of the
 +   License, or (at your option) any later version.
 +
 +   The Gnome Keyring Library is distributed in the hope that it will be useful,
 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 +   Library General Public License for more details.
 +
 +   You should have received a copy of the GNU Library General Public
 +   License along with the Gnome Library; see the file COPYING.LIB.  If not,
 +   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 +   Boston, MA 02111-1307, USA.
 +
 +   Author: Stef Walter <stefw collabora co uk>
 +*/
 +
 +#include "config.h"
 +
- #include "gcr.h"
++#include "gcr/gcr.h"
 +#include "gcr/gcr-util.h"
 +
 +#include <errno.h>
 +
 +static void
 +on_line_parsed_match_template (const gchar *line, gpointer user_data)
 +{
 +	const gchar ***matching = user_data;
 +
 +	g_assert (matching);
 +	g_assert (*matching);
 +
 +	/* Must be another line to match */
 +	g_assert ((*matching)[0]);
 +
 +	/* Match this line against expected, and increment to next */
 +	g_assert_cmpstr ((*matching)[0], ==, line);
 +	(*matching)++;
 +}
 +
 +static void
 +test_parse_lines (void)
 +{
 +	GString *string = g_string_new ("first line\nsecond line\n\nlast line");
 +	const gchar *matches[] = { "first line", "second line", "", NULL };
 +	const gchar **matching = matches;
 +
 +	_gcr_util_parse_lines (string, FALSE, on_line_parsed_match_template, &matching);
 +
 +	/* All lines should have matched */
 +	g_assert (*matching == NULL);
 +
 +	/* The last line should still be here */
 +	g_assert_cmpstr (string->str, ==, "last line");
 +	g_string_free (string, TRUE);
 +}
 +
 +static void
 +test_parse_lines_and_last (void)
 +{
 +	GString *string = g_string_new ("first line\nsecond line\n\nlast line");
 +	const gchar *matches[] = { "first line", "second line", "", "last line", NULL };
 +	const gchar **matching = matches;
 +
 +	_gcr_util_parse_lines (string, FALSE, on_line_parsed_match_template, &matching);
 +	_gcr_util_parse_lines (string, TRUE, on_line_parsed_match_template, &matching);
 +
 +	/* All lines should have matched */
 +	g_assert (*matching == NULL);
 +
 +	/* No more data */
 +	g_assert_cmpstr (string->str, ==, "");
 +	g_assert_cmpuint (string->len, ==, 0);
 +	g_string_free (string, TRUE);
 +}
 +
 +static void
 +test_parse_lines_dos (void)
 +{
 +	GString *string = g_string_new ("first line\r\nsecond line\r\n\r\nlast line");
 +	const gchar *matches[] = { "first line", "second line", "", "last line", NULL };
 +	const gchar **matching = matches;
 +
 +	_gcr_util_parse_lines (string, FALSE, on_line_parsed_match_template, &matching);
 +	_gcr_util_parse_lines (string, TRUE, on_line_parsed_match_template, &matching);
 +
 +	/* All lines should have matched */
 +	g_assert (*matching == NULL);
 +
 +	/* No more data */
 +	g_assert_cmpstr (string->str, ==, "");
 +	g_assert_cmpuint (string->len, ==, 0);
 +	g_string_free (string, TRUE);
 +}
 +
 +int
 +main (int argc, char **argv)
 +{
 +	g_type_init ();
 +	g_test_init (&argc, &argv, NULL);
 +
 +	g_test_add_func ("/gcr/util/test_parse_lines", test_parse_lines);
 +	g_test_add_func ("/gcr/util/test_parse_lines_and_last", test_parse_lines_and_last);
 +	g_test_add_func ("/gcr/util/test_parse_lines_dos", test_parse_lines_dos);
 +
 +	return g_test_run ();
 +}



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