about summary refs log tree commit diff stats
path: root/061text.mu
Commit message (Collapse)AuthorAgeFilesLines
* 4262 - literal 'null'Kartik Agaram2018-06-171-6/+6
|
* 4261 - start using literals for 'true' and 'false'Kartik Agaram2018-06-171-10/+10
| | | | | | | | | They uncovered one bug: in edit/003-shortcuts.mu <scroll-down> was returning 0 for an address in one place where I thought it was returning 0 for a boolean. Now we've eliminated this bad interaction between tangling and punning literals.
* 4260 - make address coercions explicitKartik Agaram2018-06-161-1/+1
| | | | | 'deaddress' is a terrible name. Hopefully I'll come up with something better.
* 4134 - 'input' = 'ingredient'Kartik K. Agaram2017-12-031-31/+31
|
* 4121Kartik K. Agaram2017-11-151-0/+8
|
* 4098Kartik K. Agaram2017-10-301-3/+3
| | | | | | | | | Finally, make the seemingly-trivial change to buffer methods that I was envisioning 2 days ago. I still have zero confidence in our heuristic for picking the generic method to specialize for a call-site. Waiting for issues to reveal themselves.
* 4004Kartik K. Agaram2017-09-231-1/+1
|
* 4002Kartik K. Agaram2017-09-231-28/+13
|
* 3901Kartik K. Agaram2017-06-091-10/+1
|
* 3833Kartik K. Agaram2017-04-181-0/+6
| | | | Loosen type-checking slightly to accomodate type abbreviations.
* 3832Kartik K. Agaram2017-04-181-8/+27
| | | | | More fixes for commit 3828 (supporting buffers of something other than characters).
* 3828 - make buffers shape-shifting (generic)Kartik K. Agaram2017-04-181-17/+16
|
* 3787Kartik K. Agaram2017-03-121-6/+6
|
* 3699Kartik K. Agaram2016-11-281-1/+1
| | | | | Delete some obsolete /same-as-ingredient attributes. We should always let Mu deduce those at this point.
* 3688Kartik K. Agaram2016-11-251-0/+1
| | | | | | | Move my todos over the past couple of years into the codebase now that it might be going dormant. Surprising how few todos left undone!
* 3683Kartik K. Agaram2016-11-231-0/+26
|
* 3674Kartik K. Agaram2016-11-131-1/+1
|
* 3672Kartik K. Agaram2016-11-131-3/+3
|
* 3670 - parsing whole numbers from textKartik K. Agaram2016-11-111-0/+83
| | | | Thanks Ella Couch for contributing this function.
* 3552Kartik K. Agaram2016-10-221-1/+1
| | | | | | | | | | | | | | | | | | Stop requiring jump instructions to explicitly provide a ':label' type for jump targets. This has been a source of repeated confusion for my students: a) They'd add the ':label' to the label definition rather than the jump target (label use) b) They'd spend time thinking about whether the initial '+' prefix was part of the label name. In the process I cleaned up a couple of things: - the space of names is more cleanly partitioned into labels and non-labels (clarifying that '_' and '-' are non-label prefixes) - you can't use label names as regular variables anymore - you can infer the type of a label just from its name
* 3429 - standardize Mu scenariosKartik K. Agaram2016-09-281-158/+182
| | | | | | | | | | | | | A long-standing problem has been that I couldn't spread code across 'run' blocks because they were separate scopes, so I've ended up making them effectively comments. Running code inside a 'run' block is identical in every way to simply running the code directly. The 'run' block is merely a visual aid to separate setup from the component under test. In the process I've also standardized all Mu scenarios to always run in a local scope, and only use (raw) numeric addresses for values they want to check later.
* 3390Kartik K. Agaram2016-09-171-41/+41
|
* 3389Kartik K. Agaram2016-09-171-17/+17
|
* 3386Kartik K. Agaram2016-09-171-56/+56
|
* 3385Kartik K. Agaram2016-09-171-72/+72
|
* 3379Kartik K. Agaram2016-09-171-67/+67
| | | | Can't use type abbreviations inside 'memory-should-contain'.
* 3368Kartik K. Agaram2016-09-151-13/+0
| | | | Decouple layer 61 test from layer 62 dependency.
* 3365 - create strings out of arbitrary typesKartik K. Agaram2016-09-151-1/+28
| | | | | The implementation is quite hacky. Let's see how future needs develop before we try to clean it up.
* 3357 - multi-ary 'append'Kartik K. Agaram2016-09-151-33/+36
|
* 3356Kartik K. Agaram2016-09-151-10/+10
|
* 3344Kartik K. Agaram2016-09-121-1/+0
|
* 3343Kartik K. Agaram2016-09-121-15/+0
| | | | | Reorganize layers a bit so I can add a couple of scenarios testing static dispatch *before* I add `stash` into the mix.
* 3341Kartik K. Agaram2016-09-121-13/+13
| | | | | | | Process type abbreviations in function headers. Still a couple of places where doing this causes strange errors. We'll track those down next.
* 3338Kartik K. Agaram2016-09-121-1/+1
| | | | Process type abbreviations in container definitions.
* 3337 - first use of type abbreviations: textKartik K. Agaram2016-09-121-123/+123
| | | | | In the process I've uncover a couple of situations we don't support type abbreviations yet. They're next.
* 3324 - completely redo type abbreviationsKartik K. Agaram2016-09-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The old approach with '&' and '@' modifiers turned out to be a bad idea because it introduces notions of precedence. Worse, it turns out you want different precedence rules at different times as the old test alluded: x:@number:3 # we want this to mean (address number 3) x:address:@number # we want this to mean (address array number) Instead we'll give up and focus on a single extensible mechanism that allows us to say this instead: x:@:number:3 x:address:@:number In addition it allows us to shorten other types as well: x:&:@:num type board = &:@:&:@:char # for tic-tac-toe Hmm, that last example reminds me that we don't handle abbreviations inside type abbreviation definitions so far..
* 3186 - handle 'new-buffer' without ingredientsKartik K. Agaram2016-08-141-0/+14
|
* 3155Kartik K. Agaram2016-07-271-2/+2
|
* 3055Kartik K. Agaram2016-06-131-0/+1269
PREF_OTR_LOG); assert_true(result); assert_string_equal("on", pref_otr_log); } void cmd_otr_log_on_shows_warning_when_chlog_disabled(void **state) { gchar *args[] = { "log", "on", NULL }; prefs_set_string(PREF_OTR_LOG, "off"); prefs_set_boolean(PREF_CHLOG, FALSE); expect_cons_show("OTR messages will be logged as plaintext."); expect_cons_show("Chat logging is currently disabled, use '/chlog on' to enable."); gboolean result = cmd_otr_log(NULL, CMD_OTR, args); assert_true(result); } void cmd_otr_log_off_disables_logging(void **state) { gchar *args[] = { "log", "off", NULL }; prefs_set_string(PREF_OTR_LOG, "on"); prefs_set_boolean(PREF_CHLOG, TRUE); expect_cons_show("OTR message logging disabled."); gboolean result = cmd_otr_log(NULL, CMD_OTR, args); char *pref_otr_log = prefs_get_string(PREF_OTR_LOG); assert_true(result); assert_string_equal("off", pref_otr_log); } void cmd_otr_redact_redacts_logging(void **state) { gchar *args[] = { "log", "redact", NULL }; prefs_set_string(PREF_OTR_LOG, "on"); prefs_set_boolean(PREF_CHLOG, TRUE); expect_cons_show("OTR messages will be logged as '[redacted]'."); gboolean result = cmd_otr_log(NULL, CMD_OTR, args); char *pref_otr_log = prefs_get_string(PREF_OTR_LOG); assert_true(result); assert_string_equal("redact", pref_otr_log); } void cmd_otr_log_redact_shows_warning_when_chlog_disabled(void **state) { gchar *args[] = { "log", "redact", NULL }; prefs_set_string(PREF_OTR_LOG, "off"); prefs_set_boolean(PREF_CHLOG, FALSE); expect_cons_show("OTR messages will be logged as '[redacted]'."); expect_cons_show("Chat logging is currently disabled, use '/chlog on' to enable."); gboolean result = cmd_otr_log(NULL, CMD_OTR, args); assert_true(result); } void cmd_otr_libver_shows_libotr_version(void **state) { gchar *args[] = { "libver", NULL }; char *version = "9.9.9"; GString *message = g_string_new("Using libotr version "); g_string_append(message, version); will_return(otr_libotr_version, version); expect_cons_show(message->str); gboolean result = cmd_otr_libver(NULL, CMD_OTR, args); assert_true(result); g_string_free(message, TRUE); } void cmd_otr_gen_shows_message_when_not_connected(void **state) { gchar *args[] = { "gen", NULL }; will_return(connection_get_status, JABBER_DISCONNECTED); expect_cons_show("You must be connected with an account to load OTR information."); gboolean result = cmd_otr_gen(NULL, CMD_OTR, args); assert_true(result); } static void test_with_command_and_connection_status(char *command, void *cmd_func, jabber_conn_status_t status) { gchar *args[] = { command, NULL }; will_return(connection_get_status, status); expect_cons_show("You must be connected with an account to load OTR information."); gboolean (*func)(ProfWin *window, const char *const command, gchar **args) = cmd_func; gboolean result = func(NULL, CMD_OTR, args); assert_true(result); } void cmd_otr_gen_shows_message_when_disconnected(void **state) { test_with_command_and_connection_status("gen", cmd_otr_gen, JABBER_DISCONNECTED); } void cmd_otr_gen_shows_message_when_connecting(void **state) { test_with_command_and_connection_status("gen", cmd_otr_gen, JABBER_CONNECTING); } void cmd_otr_gen_shows_message_when_disconnecting(void **state) { test_with_command_and_connection_status("gen", cmd_otr_gen, JABBER_DISCONNECTING); } void cmd_otr_gen_generates_key_for_connected_account(void **state) { gchar *args[] = { "gen", NULL }; char *account_name = "myaccount"; ProfAccount *account = account_new(account_name, "me@jabber.org", NULL, NULL, TRUE, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, 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_string(accounts_get_account, name, account_name); will_return(accounts_get_account, account); expect_memory(otr_keygen, account, account, sizeof(ProfAccount)); gboolean result = cmd_otr_gen(NULL, CMD_OTR, args); assert_true(result); } void cmd_otr_myfp_shows_message_when_disconnected(void **state) { test_with_command_and_connection_status("myfp", cmd_otr_myfp, JABBER_DISCONNECTED); } void cmd_otr_myfp_shows_message_when_connecting(void **state) { test_with_command_and_connection_status("myfp", cmd_otr_myfp, JABBER_CONNECTING); } void cmd_otr_myfp_shows_message_when_disconnecting(void **state) { test_with_command_and_connection_status("myfp", cmd_otr_myfp, JABBER_DISCONNECTING); } void cmd_otr_myfp_shows_message_when_no_key(void **state) { gchar *args[] = { "myfp", NULL }; will_return(connection_get_status, JABBER_CONNECTED); will_return(otr_key_loaded, FALSE); expect_ui_current_print_formatted_line('!', 0, "You have not generated or loaded a private key, use '/otr gen'"); gboolean result = cmd_otr_myfp(NULL, CMD_OTR, args); assert_true(result); } void cmd_otr_myfp_shows_my_fingerprint(void **state) { char *fingerprint = "AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD EEEEEEEE"; gchar *args[] = { "myfp", NULL }; GString *message = g_string_new("Your OTR fingerprint: "); g_string_append(message, fingerprint); will_return(connection_get_status, JABBER_CONNECTED); will_return(otr_key_loaded, TRUE); will_return(otr_get_my_fingerprint, strdup(fingerprint)); expect_ui_current_print_formatted_line('!', 0, message->str); gboolean result = cmd_otr_myfp(NULL, CMD_OTR, args); assert_true(result); g_string_free(message, TRUE); } static void test_cmd_otr_theirfp_from_wintype(win_type_t wintype) { gchar *args[] = { "theirfp", NULL }; ProfWin window; window.type = wintype; will_return(connection_get_status, JABBER_CONNECTED); expect_ui_current_print_line("You must be in a regular chat window to view a recipient's fingerprint."); gboolean result = cmd_otr_theirfp(&window, CMD_OTR, args); assert_true(result); } void cmd_otr_theirfp_shows_message_when_in_console(void **state) { test_cmd_otr_theirfp_from_wintype(WIN_CONSOLE); } void cmd_otr_theirfp_shows_message_when_in_muc(void **state) { test_cmd_otr_theirfp_from_wintype(WIN_MUC); } void cmd_otr_theirfp_shows_message_when_in_private(void **state) { test_cmd_otr_theirfp_from_wintype(WIN_PRIVATE); } void cmd_otr_theirfp_shows_message_when_non_otr_chat_window(void **state) { gchar *args[] = { "theirfp", NULL }; ProfWin window; window.type = WIN_CHAT; ProfChatWin chatwin; chatwin.window = window; chatwin.memcheck = PROFCHATWIN_MEMCHECK; chatwin.pgp_send = FALSE; chatwin.is_otr = FALSE; will_return(connection_get_status, JABBER_CONNECTED); expect_ui_current_print_formatted_line('!', 0, "You are not currently in an OTR session."); gboolean result = cmd_otr_theirfp((ProfWin*)&chatwin, CMD_OTR, args); assert_true(result); } void cmd_otr_theirfp_shows_fingerprint(void **state) { char *recipient = "someone@chat.com"; char *fingerprint = "AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD EEEEEEEE"; gchar *args[] = { "theirfp", NULL }; GString *message = g_string_new(recipient); g_string_append(message, "'s OTR fingerprint: "); g_string_append(message, fingerprint); ProfWin window; window.type = WIN_CHAT; ProfChatWin chatwin; chatwin.window = window; chatwin.barejid = recipient; chatwin.memcheck = PROFCHATWIN_MEMCHECK; chatwin.pgp_send = FALSE; chatwin.is_otr = TRUE; will_return(connection_get_status, JABBER_CONNECTED); expect_string(otr_get_their_fingerprint, recipient, recipient); will_return(otr_get_their_fingerprint, strdup(fingerprint)); expect_ui_current_print_formatted_line('!', 0, message->str); gboolean result = cmd_otr_theirfp((ProfWin*)&chatwin, CMD_OTR, args); assert_true(result); g_string_free(message, TRUE); } static void test_cmd_otr_start_from_wintype(win_type_t wintype) { gchar *args[] = { "start", NULL }; ProfWin window; window.type = wintype; will_return(connection_get_status, JABBER_CONNECTED); expect_ui_current_print_line("You must be in a regular chat window to start an OTR session."); gboolean result = cmd_otr_start(&window, CMD_OTR, args); assert_true(result); } void cmd_otr_start_shows_message_when_in_console(void **state) { test_cmd_otr_start_from_wintype(WIN_CONSOLE); } void cmd_otr_start_shows_message_when_in_muc(void **state) { test_cmd_otr_start_from_wintype(WIN_MUC); } void cmd_otr_start_shows_message_when_in_private(void **state) { test_cmd_otr_start_from_wintype(WIN_PRIVATE); } void cmd_otr_start_shows_message_when_already_started(void **state) { char *recipient = "someone@server.org"; gchar *args[] = { "start", NULL }; will_return(connection_get_status, JABBER_CONNECTED); ProfWin window; window.type = WIN_CHAT; ProfChatWin chatwin; chatwin.window = window; chatwin.barejid = recipient; chatwin.memcheck = PROFCHATWIN_MEMCHECK; chatwin.pgp_send = FALSE; chatwin.is_otr = TRUE; expect_ui_current_print_formatted_line('!', 0, "You are already in an OTR session."); gboolean result = cmd_otr_start((ProfWin*)&chatwin, CMD_OTR, args); assert_true(result); } void cmd_otr_start_shows_message_when_no_key(void **state) { char *recipient = "someone@server.org"; gchar *args[] = { "start", NULL }; will_return(connection_get_status, JABBER_CONNECTED); will_return(otr_key_loaded, FALSE); ProfWin window; window.type = WIN_CHAT; ProfChatWin chatwin; chatwin.window = window; chatwin.barejid = recipient; chatwin.memcheck = PROFCHATWIN_MEMCHECK; chatwin.pgp_send = FALSE; chatwin.is_otr = FALSE; expect_ui_current_print_formatted_line('!', 0, "You have not generated or loaded a private key, use '/otr gen'"); gboolean result = cmd_otr_start((ProfWin*)&chatwin, CMD_OTR, args); assert_true(result); } void cmd_otr_start_sends_otr_query_message_to_current_recipeint(void **state) { char *recipient = "buddy@chat.com"; char *query_message = "?OTR?"; gchar *args[] = { "start", NULL }; ProfWin window; window.type = WIN_CHAT; ProfChatWin chatwin; chatwin.window = window; chatwin.barejid = recipient; chatwin.memcheck = PROFCHATWIN_MEMCHECK; chatwin.pgp_send = FALSE; chatwin.is_otr = FALSE; will_return(connection_get_status, JABBER_CONNECTED); will_return(otr_key_loaded, TRUE); will_return(otr_start_query, query_message); expect_string(message_send_chat_otr, barejid, recipient); expect_string(message_send_chat_otr, msg, query_message); gboolean result = cmd_otr_start((ProfWin*)&chatwin, CMD_OTR, args); assert_true(result); } #else void cmd_otr_shows_message_when_otr_unsupported(void **state) { gchar *args[] = { "gen", NULL }; expect_cons_show("This version of Profanity has not been built with OTR support enabled"); gboolean result = cmd_otr_gen(NULL, CMD_OTR, args); assert_true(result); } #endif