diff options
author | Brendan Taylor <whateley@gmail.com> | 2009-07-12 13:52:34 -0600 |
---|---|---|
committer | Brendan Taylor <whateley@gmail.com> | 2009-07-12 13:52:34 -0600 |
commit | e39152702c839cafe5a73536ba6d3c3d769d4546 (patch) | |
tree | 69f50b26f81b2cf3855da4267f56ecb6d2ba05ee /tests | |
parent | 8fab11200e300712484ac5f31bc610f9943029cc (diff) |
"set keycmd = x" is now equivalent to "keycmd x"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile | 2 | ||||
-rw-r--r-- | tests/test-command.c | 60 |
2 files changed, 61 insertions, 1 deletions
diff --git a/tests/Makefile b/tests/Makefile index 2bfcf98..7901b7d 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -4,7 +4,7 @@ LDFLAGS:=$(shell pkg-config --libs gtk+-2.0 webkit-1.0 libsoup-2.4 gthread-2.0) GTESTER:=gtester GTESTER_REPORT:=gtester-report -TEST_PROGS:=test-expand +TEST_PROGS:=test-expand test-command all: $(TEST_PROGS) LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):." $(GTESTER) --verbose $(TEST_PROGS) diff --git a/tests/test-command.c b/tests/test-command.c new file mode 100644 index 0000000..aee4bf2 --- /dev/null +++ b/tests/test-command.c @@ -0,0 +1,60 @@ +/* -*- c-basic-offset: 4; -*- */ +#define _POSIX_SOURCE + +#include <gtk/gtk.h> +#include <gdk/gdkx.h> +#include <gdk/gdkkeysyms.h> +#include <sys/socket.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <sys/un.h> +#include <sys/utsname.h> +#include <sys/time.h> +#include <webkit/webkit.h> +#include <libsoup/soup.h> +#include <JavaScriptCore/JavaScript.h> + +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <stdlib.h> +#include <errno.h> +#include <fcntl.h> +#include <signal.h> + +#include <uzbl.h> +#include <config.h> + +extern Uzbl uzbl; + +void +test_keycmd (void) { + add_binding("insert", "set insert_mode = 1"); + add_binding("command", "set insert_mode = 0"); + + /* the 'keycmd' command */ + parse_command("keycmd", "insert", NULL); + + g_assert_cmpint(1, ==, uzbl.behave.insert_mode); + g_assert_cmpstr("", ==, uzbl.state.keycmd); + + /* setting the keycmd variable directly, equivalent to the 'keycmd' comand */ + set_var_value("keycmd", "command"); + + g_assert_cmpint(0, ==, uzbl.behave.insert_mode); + g_assert_cmpstr("", ==, uzbl.state.keycmd); +} + +int +main (int argc, char *argv[]) { + g_type_init(); + g_test_init(&argc, &argv, NULL); + + g_test_add_func("/test-command/keycmd", test_keycmd); + + initialize(argc, argv); + + return g_test_run(); +} + +/* vi: set et ts=4: */ |