diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/functionaltests/proftest.c | 27 | ||||
-rwxr-xr-x | tests/functionaltests/start_profanity.sh | 2 | ||||
-rw-r--r-- | tests/unittests/test_cmd_roster.c | 3 |
3 files changed, 22 insertions, 10 deletions
diff --git a/tests/functionaltests/proftest.c b/tests/functionaltests/proftest.c index 78a82c11..613c2c7a 100644 --- a/tests/functionaltests/proftest.c +++ b/tests/functionaltests/proftest.c @@ -123,12 +123,16 @@ _cleanup_dirs(void) void prof_start(void) { - fd = exp_spawnl("./profanity", "./profanity", "-l", "DEBUG", NULL); + // helper script sets terminal columns, avoids assertions failing + // based on the test runner terminal size + fd = exp_spawnl("sh", + "sh", + "-c", + "./tests/functionaltests/start_profanity.sh", + NULL); FILE *fp = fdopen(fd, "r+"); - if (fp == NULL) { - assert_true(FALSE); - } + assert_true(fp != NULL); setbuf(fp, (char *)0); } @@ -155,15 +159,20 @@ init_prof_test(void **state) _create_logs_dir(); prof_start(); - prof_output_exact("Profanity"); + assert_true(prof_output_exact("Profanity")); + // set UI options to make expect assertions faster and more reliable prof_input("/inpblock timeout 5"); - prof_output_exact("Input blocking set to 5 milliseconds"); + assert_true(prof_output_exact("Input blocking set to 5 milliseconds")); prof_input("/inpblock dynamic off"); - prof_output_exact("Dynamic input blocking disabled"); - + assert_true(prof_output_exact("Dynamic input blocking disabled")); prof_input("/notify message off"); - prof_output_exact("Message notifications disabled"); + assert_true(prof_output_exact("Message notifications disabled")); + prof_input("/wrap off"); + assert_true(prof_output_exact("Word wrap disabled")); + prof_input("/roster hide"); + assert_true(prof_output_exact("Roster disabled")); + prof_input("/time off"); } void diff --git a/tests/functionaltests/start_profanity.sh b/tests/functionaltests/start_profanity.sh new file mode 100755 index 00000000..58ceadd7 --- /dev/null +++ b/tests/functionaltests/start_profanity.sh @@ -0,0 +1,2 @@ +export COLUMNS=300 +./profanity -l DEBUG diff --git a/tests/unittests/test_cmd_roster.c b/tests/unittests/test_cmd_roster.c index a7160cf5..dc1b612e 100644 --- a/tests/unittests/test_cmd_roster.c +++ b/tests/unittests/test_cmd_roster.c @@ -16,12 +16,13 @@ static void test_with_connection_status(jabber_conn_status_t status) { CommandHelp *help = malloc(sizeof(CommandHelp)); + gchar *args[] = { NULL }; will_return(jabber_get_connection_status, status); expect_cons_show("You are not currently connected."); - gboolean result = cmd_roster(NULL, *help); + gboolean result = cmd_roster(args, *help); assert_true(result); free(help); |