aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/test-command.c
diff options
context:
space:
mode:
authorGravatar keis <keijser@gmail.com>2011-01-17 20:50:20 +0100
committerGravatar keis <keijser@gmail.com>2011-01-17 21:08:06 +0100
commite8814adcd1835d6faa0ad166ba1bf2aaf64bb5e0 (patch)
tree1d491e1b7ea11738dc757eaff751abbbe9312a1b /tests/test-command.c
parent15c83d8a85a150f46e80f7fc97041f10a43a96df (diff)
parent835f5d8d09b429a4776192dbe00be5ae20704b16 (diff)
Merge branch 'experimental' of git://github.com/Dieterbe/uzbl into intcookies
Conflicts: Makefile
Diffstat (limited to 'tests/test-command.c')
-rw-r--r--tests/test-command.c38
1 files changed, 2 insertions, 36 deletions
diff --git a/tests/test-command.c b/tests/test-command.c
index 6194081..7b33405 100644
--- a/tests/test-command.c
+++ b/tests/test-command.c
@@ -29,33 +29,6 @@ extern UzblCore uzbl;
#define INSTANCE_NAME "testing"
-gchar*
-assert_str_beginswith(GString *expected, gchar *actual) {
- gchar *actual_beginning = g_strndup(actual, expected->len);
- g_assert_cmpstr(expected->str, ==, actual_beginning);
- g_free(actual_beginning);
-
- /* return the part of the actual string that hasn't been compared yet */
- return &actual[expected->len];
-}
-
-/* compare the contents of uzbl.comm.sync_stdout to the standard arguments that
- * should have been passed. This is meant to be called after something like "sync echo". */
-gchar*
-assert_sync_beginswith_stdarg() {
- GString *stdargs = g_string_new("");
-
- g_string_append_printf(stdargs, "%s %d %d ", uzbl.state.config_file, getpid(), (int)uzbl.xwin);
- g_string_append_printf(stdargs, "%s %s ", uzbl.comm.fifo_path, uzbl.comm.socket_path);
- g_string_append_printf(stdargs, "%s %s ", uzbl.state.uri, uzbl.gui.main_title);
-
- gchar *rest = assert_str_beginswith(stdargs, uzbl.comm.sync_stdout);
-
- g_string_free(stdargs, TRUE);
-
- return rest;
-}
-
#define ASSERT_EVENT(EF, STR) { read_event(ef); \
g_assert_cmpstr("EVENT [" INSTANCE_NAME "] " STR "\n", ==, ef->event_buffer); }
@@ -314,13 +287,10 @@ test_run_handler_arg_order (void) {
assert(uzbl.comm.sync_stdout);
- /* the result should begin with the standard handler arguments */
- gchar *rest = assert_sync_beginswith_stdarg();
-
/* the rest of the result should be the arguments passed to run_handler. */
/* the arguments in the second argument to run_handler should be placed before any
* included in the first argument to run handler. */
- g_assert_cmpstr("abc def uvw xyz\n", ==, rest);
+ g_assert_cmpstr("abc def uvw xyz\n", ==, uzbl.comm.sync_stdout);
}
void
@@ -330,12 +300,8 @@ test_run_handler_expand (void) {
assert(uzbl.comm.sync_stdout);
- /* the result should begin with the standard handler arguments */
- gchar *rest = assert_sync_beginswith_stdarg();
-
- /* the rest of the result should be the arguments passed to run_handler. */
/* the user-specified arguments to the handler should have been expanded */
- g_assert_cmpstr("result: Test uzbl uzr agent\n", ==, rest);
+ g_assert_cmpstr("result: Test uzbl uzr agent\n", ==, uzbl.comm.sync_stdout);
}
int