about summary refs log tree commit diff stats
path: root/doc/aerc-imap.5.scd
diff options
context:
space:
mode:
authorRay Ganardi <ray@ganardi.xyz>2020-04-24 11:36:16 +0200
committerDrew DeVault <sir@cmpwn.com>2020-04-24 12:59:21 -0400
commit447e662057c663f47f5c8a490543b1a52b26bc86 (patch)
tree6c44b7234a43b0da25bb448b93bfca8014d864a6 /doc/aerc-imap.5.scd
parentacf69b7490f4848066f2df4b3c2f675a8d57661a (diff)
downloadaerc-447e662057c663f47f5c8a490543b1a52b26bc86.tar.gz
Add :choose command
Usage:
	*choose* -o <key> <text> <command> [-o <key> <text> <command>]...

Prompts the user to choose from various options.
Diffstat (limited to 'doc/aerc-imap.5.scd')
0 files changed, 0 insertions, 0 deletions
ommands on quit' href='/danisanti/profani-tty/commit/tests/unittests/test_callbacks.c?id=71879a3f64f5f04cdceeedf0317175b2bab1701c'>71879a3f ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57





















                                                  
 






























                                                            
 
                                                                 
 
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>

#include "plugins/callbacks.h"
#include "plugins/plugins.h"

void returns_no_commands(void **state)
{
    callbacks_init();
    GList *commands = plugins_get_command_names();

    assert_true(commands == NULL);
}

void returns_commands(void **state)
{
    callbacks_init();

    PluginCommand *command1 = malloc(sizeof(PluginCommand));
    command1->command_name = strdup("command1");
    callbacks_add_command("plugin1", command1);

    PluginCommand *command2 = malloc(sizeof(PluginCommand));
    command2->command_name = strdup("command2");
    callbacks_add_command("plugin1", command2);

    PluginCommand *command3 = malloc(sizeof(PluginCommand));
    command3->command_name = strdup("command3");
    callbacks_add_command("plugin2", command3);

    GList *names = plugins_get_command_names();
    assert_true(g_list_length(names) == 3);

    gboolean foundCommand1 = FALSE;
    gboolean foundCommand2 = FALSE;
    gboolean foundCommand3 = FALSE;
    GList *curr = names;
    while (curr) {
        if (g_strcmp0(curr->data, "command1") == 0) {
            foundCommand1 = TRUE;
        }
        if (g_strcmp0(curr->data, "command2") == 0) {
            foundCommand2 = TRUE;
        }
        if (g_strcmp0(curr->data, "command3") == 0) {
            foundCommand3 = TRUE;
        }
        curr = g_list_next(curr);
    }

    assert_true(foundCommand1 && foundCommand2 && foundCommand3);
}