about summary refs log tree commit diff stats
path: root/termbox
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2018-09-24 18:48:41 -0700
committerKartik Agaram <vc@akkartik.com>2018-09-24 22:55:37 -0700
commitc5d9a32fe6add8c986942261dd22377f911d1ca0 (patch)
treeb963fff418cc486cd3a7c1bf1b5d1c036a938045 /termbox
parent9353569934e08c4ba531da5b64aeb4ae08ac2aae (diff)
downloadmu-c5d9a32fe6add8c986942261dd22377f911d1ca0.tar.gz
4516
More calling convention tweaks.

Use EBP to get consistently at parameters and locals.
Always put the first function argument closest to EBP.
Diffstat (limited to 'termbox')
0 files changed, 0 insertions, 0 deletions
f='/danisanti/profani-tty/blame/tests/test_command.c?id=3a403046ff241381e0f9750dfe39f1e05c73fd63'>^
b27c5d0f ^
9b55f2de ^
a4cadf78 ^
b27c5d0f ^
9b55f2de ^
a4cadf78 ^
71577c1f ^
81190251 ^

a2726b6a ^

71577c1f ^
3bb1f124 ^
7db1bcee ^
d56f6dc3 ^
5c65599e ^
81190251 ^
447d2358 ^
447d2358 ^

a2726b6a ^

447d2358 ^



a2726b6a ^

447d2358 ^



a2726b6a ^

447d2358 ^



a2726b6a ^

447d2358 ^
a2726b6a ^
49661625 ^
a2726b6a ^
e4e53d6e ^
447d2358 ^
3bb1f124 ^
88f423af ^
7db1bcee ^

00a475cf ^
8db2389d ^


7db1bcee ^
e571ccd8 ^
5c65599e ^
81190251 ^
3e3786eb ^
71577c1f ^

a2726b6a ^

447d2358 ^
a2726b6a ^
447d2358 ^
3bb1f124 ^
00a475cf ^
8db2389d ^


7db1bcee ^
e571ccd8 ^





a2726b6a ^

e571ccd8 ^
a2726b6a ^
a4cadf78 ^
a2726b6a ^
e4e53d6e ^
e571ccd8 ^





8db2389d ^


e571ccd8 ^

5c65599e ^
81190251 ^
447d2358 ^
447d2358 ^
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109

                   

                   
                   
                   
                 

                      
 
                  
                       
 
                            
                              
 

                          

                                                        
 
                                               
 
                                                         
 
                                                       
                        

 

                                                       



                                                     

                                                        



                                                      

                                                     



                                                   

                                                        
 
                             
 
                                                                                                        
                                                                                                                                                                       
 
                                                         
                                                          

                                               
 


                                                                    
                                                                              
                                             
 
                                                       
                        

 

                                                    
 
                                                           
 
                                                         
 


                                                                
                                                                          





                                                       

                                                   
 
                                               
 
                                                                                                        
                                                                                                                                                                       





                                                          


                                                                                    

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

#include "xmpp/xmpp.h"

#include "ui/ui.h"
#include "ui/stub_ui.h"

#include "config/accounts.h"
#include "command/cmd_funcs.h"

#define CMD_ROOMS "/rooms"

static void
test_with_connection_status(jabber_conn_status_t status)
{
    will_return(connection_get_status, status);

    expect_cons_show("You are not currently connected.");

    gboolean result = cmd_rooms(NULL, CMD_ROOMS, NULL);
    assert_true(result);
}

void
cmd_rooms_shows_message_when_disconnected(void** state)
{
    test_with_connection_status(JABBER_DISCONNECTED);
}

void
cmd_rooms_shows_message_when_disconnecting(void** state)
{
    test_with_connection_status(JABBER_DISCONNECTING);
}

void
cmd_rooms_shows_message_when_connecting(void** state)
{
    test_with_connection_status(JABBER_CONNECTING);
}

void
cmd_rooms_uses_account_default_when_no_arg(void** state)
{
    gchar* args[] = { NULL };

    ProfAccount* account = account_new("testaccount", NULL, NULL, NULL, TRUE, NULL, 0, NULL, NULL, NULL,
                                       0, 0, 0, 0, 0, "default_conf_server", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

    will_return(connection_get_status, JABBER_CONNECTED);
    will_return(session_get_account_name, "account_name");
    expect_any(accounts_get_account, name);
    will_return(accounts_get_account, account);

    expect_cons_show("");
    expect_cons_show("Room list request sent: default_conf_server");

    expect_string(iq_room_list_request, conferencejid, "default_conf_server");
    expect_any(iq_room_list_request, filter);

    gboolean result = cmd_rooms(NULL, CMD_ROOMS, args);
    assert_true(result);
}

void
cmd_rooms_service_arg_used_when_passed(void** state)
{
    gchar* args[] = { "service", "conf_server_arg", NULL };

    will_return(connection_get_status, JABBER_CONNECTED);

    expect_cons_show("");
    expect_cons_show("Room list request sent: conf_server_arg");

    expect_string(iq_room_list_request, conferencejid, "conf_server_arg");
    expect_any(iq_room_list_request, filter);

    gboolean result = cmd_rooms(NULL, CMD_ROOMS, args);
    assert_true(result);
}

void
cmd_rooms_filter_arg_used_when_passed(void** state)
{
    gchar* args[] = { "filter", "text", NULL };

    ProfAccount* account = account_new("testaccount", NULL, NULL, NULL, TRUE, NULL, 0, NULL, NULL, NULL,
                                       0, 0, 0, 0, 0, "default_conf_server", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

    will_return(connection_get_status, JABBER_CONNECTED);
    will_return(session_get_account_name, "account_name");
    expect_any(accounts_get_account, name);
    will_return(accounts_get_account, account);

    expect_cons_show("");
    expect_cons_show("Room list request sent: default_conf_server, filter: 'text'");

    expect_any(iq_room_list_request, conferencejid);
    expect_string(iq_room_list_request, filter, "text");

    gboolean result = cmd_rooms(NULL, CMD_ROOMS, args);
    assert_true(result);
}