diff options
author | Brendan Taylor <whateley@gmail.com> | 2011-01-13 12:11:19 -0700 |
---|---|---|
committer | Brendan Taylor <whateley@gmail.com> | 2011-01-13 17:52:42 -0700 |
commit | 975e322d37afaca6e565b37282f2d9e6038124bc (patch) | |
tree | f2fca34cd3dd36bfa52bfc84313757468a3c601a /tests/test-command.c | |
parent | 9340e4f23264c7e820b52f18de5ca29132c68e72 (diff) |
add a variable @_ that expands to the result of the last sync command
Diffstat (limited to 'tests/test-command.c')
-rw-r--r-- | tests/test-command.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test-command.c b/tests/test-command.c index 7b33405..20c6aa0 100644 --- a/tests/test-command.c +++ b/tests/test-command.c @@ -282,6 +282,21 @@ test_js (void) { } void +test_last_result (void) { + GString *result = g_string_new(""); + + /* the last result gets set */ + parse_cmd_line("js -1", result); + g_assert_cmpstr("-1", ==, uzbl.state.last_result); + + /* the last result can be used in a chain */ + parse_cmd_line("chain 'js 1' 'js \\@_ + 1'", result); + g_assert_cmpstr("2", ==, uzbl.state.last_result); + + g_string_free(result, TRUE); +} + +void test_run_handler_arg_order (void) { run_handler("sync_spawn echo uvw xyz", "abc def"); @@ -320,6 +335,8 @@ main (int argc, char *argv[]) { g_test_add_func("/test-command/js", test_js); + g_test_add_func("/test-command/last-result", test_last_result); + /* the following aren't really "command" tests, but they're not worth * splitting into a separate file yet */ g_test_add_func("/test-command/run_handler/arg-order", test_run_handler_arg_order); |