From e39152702c839cafe5a73536ba6d3c3d769d4546 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Sun, 12 Jul 2009 13:52:34 -0600 Subject: "set keycmd = x" is now equivalent to "keycmd x" --- tests/test-command.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 tests/test-command.c (limited to 'tests/test-command.c') 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +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: */ -- cgit v1.2.3