fix the testsuite
authorJelmer Vernooij <jelmer@samba.org>
Mon, 3 Sep 2007 16:13:12 +0000 (18:13 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 3 Sep 2007 16:13:12 +0000 (18:13 +0200)
NEWS
testsuite/test-network.c
testsuite/test-networkinfo.c
testsuite/test-nickserv.c
testsuite/test-redirect.c
testsuite/test-user.c

diff --git a/NEWS b/NEWS
index c3319df..96b846b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,8 @@ Ctrlproxy 3.0.4 UNRELEASED
 
        * Allow configuring a single listener in ~/.ctrlproxy/config.
 
+       * Several simplifications of the configuration file.
+
        * Recognize NS as command for NickServ (#145)
 
 
index 390c56c..effee6f 100644 (file)
        Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
+#include "internals.h"
 #include <stdio.h>
 #include <unistd.h>
 #include <string.h>
 #include <check.h>
-#include "internals.h"
 #include "torture.h"
 
 START_TEST(test_create)
index 2e861da..d6504cd 100644 (file)
        Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
+#include "internals.h"
 #include <stdio.h>
 #include <unistd.h>
 #include <string.h>
 #include <check.h>
 #include <stdbool.h>
-#include "internals.h"
 #include "torture.h"
 
 START_TEST(test_is_prefix)
index 60f34c1..7f1e54e 100644 (file)
@@ -31,11 +31,25 @@ void nickserv_identify_me(struct network *network, char *nick);
 gboolean nickserv_write_file(GList *nicks, const char *filename);
 gboolean nickserv_read_file(const char *filename, GList **nicks);
 
+static void strip_comments(char *str)
+{
+       char *comment_start, *line_end;
+
+       do {
+               comment_start = strchr(str, '#');
+               if (comment_start == NULL)
+                       return;
+               line_end = strchr(comment_start, '\n');
+               memmove(comment_start, line_end+1, strlen(line_end+1)+1);
+       } while(TRUE);
+}
+
 START_TEST(test_write_file_empty)
        char *fn = torture_tempfile(__FUNCTION__);
        char *contents;
        fail_unless(nickserv_write_file(NULL, fn) == TRUE);
        fail_unless(g_file_get_contents(fn, &contents, NULL, NULL));
+       strip_comments(contents);
        fail_unless(!strcmp(contents, ""), "Excepted empty file, got: %s", contents);
 END_TEST
 
@@ -49,6 +63,7 @@ START_TEST(test_write_file_simple_network)
        };
        fail_unless(nickserv_write_file(g_list_append(NULL, &n), fn) == TRUE);
        fail_unless(g_file_get_contents(fn, &contents, NULL, NULL));
+       strip_comments(contents);
        fail_unless(!strcmp(contents, "anick\tsomepw\tbla\n"), "got: %s", contents);
 END_TEST
 
@@ -63,6 +78,7 @@ START_TEST(test_write_file_simple_nonetwork)
        };
        fail_unless(nickserv_write_file(g_list_append(NULL, &n), fn) == TRUE);
        fail_unless(g_file_get_contents(fn, &contents, NULL, NULL));
+       strip_comments(contents);
        fail_unless(!strcmp(contents, "anick\tsomepw\t*\n"), "got: %s", contents);
 END_TEST
 
index 31d8e59..d15c692 100644 (file)
        Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
+#include "internals.h"
 #include <stdio.h>
 #include <unistd.h>
 #include <string.h>
 #include <check.h>
-#include "internals.h"
 #include "torture.h"
 
 static void test_redirect_response(struct network *n, const char *line)
index f284eff..715afba 100644 (file)
        Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
+#include "internals.h"
 #include <stdio.h>
 #include <unistd.h>
 #include <string.h>
 #include <check.h>
-#include "internals.h"
 
 START_TEST(test_create)
        struct global *gl;