diff options
author | Brendan Taylor <whateley@gmail.com> | 2011-02-14 22:51:46 -0700 |
---|---|---|
committer | Brendan Taylor <whateley@gmail.com> | 2011-02-14 22:54:54 -0700 |
commit | db3984b609153ff213233f1a78c8895fdb525350 (patch) | |
tree | 24e6b2959d08b8cadb93853cb3620681f6f05e64 /tests | |
parent | 59af2a8499160a369aceed1bd5cb32109fb5e77c (diff) | |
parent | 700332fac498169927ced24731ce1278369b1425 (diff) |
Merge branch 'experimental' into cleaning-commenting
Conflicts:
src/callbacks.c
src/uzbl-core.c
src/uzbl-core.h
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-command.c | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/tests/test-command.c b/tests/test-command.c index 7b33405..d07bf79 100644 --- a/tests/test-command.c +++ b/tests/test-command.c @@ -263,11 +263,12 @@ test_toggle_status (void) { void test_sync_sh (void) { - parse_cmd_line("sync_sh 'echo Test echo.'", NULL); - g_assert_cmpstr("Test echo.\n", ==, uzbl.comm.sync_stdout); + GString *result = g_string_new(""); + + parse_cmd_line("sync_sh 'echo Test echo.'", result); + g_assert_cmpstr("Test echo.\n", ==, result->str); - /* clean up after ourselves */ - uzbl.comm.sync_stdout = strfree(uzbl.comm.sync_stdout); + g_string_free(result, TRUE); } void @@ -282,26 +283,18 @@ test_js (void) { } void -test_run_handler_arg_order (void) { - run_handler("sync_spawn echo uvw xyz", "abc def"); - - assert(uzbl.comm.sync_stdout); - - /* 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", ==, uzbl.comm.sync_stdout); -} +test_last_result (void) { + GString *result = g_string_new(""); -void -test_run_handler_expand (void) { - uzbl.net.useragent = "Test uzbl uzr agent"; - run_handler("sync_spawn echo @useragent", "result:"); + /* the last result gets set */ + parse_cmd_line("js -1", result); + g_assert_cmpstr("-1", ==, uzbl.state.last_result); - assert(uzbl.comm.sync_stdout); + /* 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); - /* the user-specified arguments to the handler should have been expanded */ - g_assert_cmpstr("result: Test uzbl uzr agent\n", ==, uzbl.comm.sync_stdout); + g_string_free(result, TRUE); } int @@ -320,10 +313,7 @@ main (int argc, char *argv[]) { g_test_add_func("/test-command/js", test_js); - /* 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); - g_test_add_func("/test-command/run_handler/expand", test_run_handler_expand); + g_test_add_func("/test-command/last-result", test_last_result); /* set up uzbl */ initialize(argc, argv); |