Files
profanity/tests/unittests/test_common.h
jabber.developer2 4401e817d0 refactor: address PR #105 review feedback
Apply fixes, refactors and test additions requested by reviewer on PR #105.

Fixes:
- database: warn and notify user on duplicate archive_id instead of
  silently debug-logging it (R05).
- database: add missing '[' in "[DB Migration]" log prefix (R06).
- xmpp/resource: NULL-out name/status after g_free to avoid double-free
  via roster_list.c cleanup path (R09, R23).
- common: widen strtoi_range internal storage from int to long so that
  values in (INT_MAX, LONG_MAX] are rejected as out-of-range instead of
  being silently truncated on 64-bit platforms (R25).

Refactors:
- xmpp/message: extract _receive_omemo helper, removing three copies of
  the OMEMO receive block in groupchat / MUC-PM / chat handlers (R04).
- omemo: flatten deeply nested device-list processing via guard-clause
  continues (R11).
- tools/autocomplete: merge two nested ifs into a single && condition
  (R13).
- ui/titlebar: extract _show_trust_indicator and inline _wprintw_withattr
  wrapper, collapsing three near-identical trust-indicator blocks (R22).
- config/tlscerts: drop _checked_g_strdup wrapper; g_strdup is
  NULL-safe per glib documentation (R19).
- ui/inputwin: use auto_gchar for spellcheck word instead of manual
  g_free (R20).
- tools/editor: drop outdated "Deprecated synchronous" comment that
  no longer matches the callback-based implementation (R28).

Tests:
- tests/command/cmd_ac: rename segfaults_when_empty ->
  no_segfault_when_empty; expand cycling coverage to three files plus
  backward SHIFT-TAB traversal (R16, R17).
- tests/common: add strtoi_range overflow/underflow and strtol-parsing
  consistency tests (R25).
- tests/xmpp/jid: add test for '@' inside resourcepart per RFC 6122
  section 2.4 (R26).

Misc:
- xmpp/omemo: change omemo_error_to_string return type from char* to
  gchar* for glib consistency (R01).
- subprojects/libstrophe: point wrap-git at our fork at
  git.jabber.space/devs/libstrophe-gh (R24).
- RELEASE_GUIDE: drop "Updating website" section referring to an
  upstream site that is not ours (R18).
2026-04-24 15:13:38 +03:00

69 lines
3.4 KiB
C

/*
* test_common.h
*
* Copyright (C) 2015 - 2016 James Booth <boothj5@gmail.com>
* Copyright (C) 2018 - 2026 Michael Vetter <jubalh@iodoru.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifndef TESTS_TEST_COMMON_H
#define TESTS_TEST_COMMON_H
void str_replace__returns__one_substr(void** state);
void str_replace__returns__one_substr_beginning(void** state);
void str_replace__returns__one_substr_end(void** state);
void str_replace__returns__two_substr(void** state);
void str_replace__returns__char(void** state);
void str_replace__returns__original_when_none(void** state);
void str_replace__returns__replaced_when_match(void** state);
void str_replace__returns__empty_when_string_empty(void** state);
void str_replace__returns__null_when_string_null(void** state);
void str_replace__returns__original_when_sub_empty(void** state);
void str_replace__returns__original_when_sub_null(void** state);
void str_replace__returns__empty_when_new_empty(void** state);
void str_replace__returns__original_when_new_null(void** state);
void valid_resource_presence_string__is__true_for_online(void** state);
void valid_resource_presence_string__is__true_for_chat(void** state);
void valid_resource_presence_string__is__true_for_away(void** state);
void valid_resource_presence_string__is__true_for_xa(void** state);
void valid_resource_presence_string__is__true_for_dnd(void** state);
void valid_resource_presence_string__is__false_for_available(void** state);
void valid_resource_presence_string__is__false_for_unavailable(void** state);
void valid_resource_presence_string__is__false_for_blah(void** state);
void utf8_display_len__returns__0_for_null(void** state);
void utf8_display_len__returns__1_for_non_wide(void** state);
void utf8_display_len__returns__2_for_wide(void** state);
void utf8_display_len__returns__correct_for_non_wide(void** state);
void utf8_display_len__returns__correct_for_wide(void** state);
void utf8_display_len__returns__correct_for_all_wide(void** state);
void strip_arg_quotes__returns__original_when_no_quotes(void** state);
void strip_arg_quotes__returns__stripped_first(void** state);
void strip_arg_quotes__returns__stripped_last(void** state);
void strip_arg_quotes__returns__stripped_both(void** state);
void strip_arg_quotes__unescapes(void** state);
void prof_occurrences__tests__partial(void** state);
void prof_occurrences__tests__whole(void** state);
void prof_occurrences__tests__large_message(void** state);
void unique_filename_from_url__tests__table_driven(void** state);
void format_call_external_argv__tests__table_driven(void** state);
void get_expanded_path__returns__expanded(void** state);
void string_to_verbosity__returns__correct_values(void** state);
void strtoi_range__returns__true_for_valid_input(void** state);
void strtoi_range__returns__false_for_out_of_range(void** state);
void strtoi_range__returns__false_for_invalid_input(void** state);
void strtoi_range__returns__false_for_null_empty_input(void** state);
void strtoi_range__returns__correct_values_when_err_msg_null(void** state);
void strtoi_range__returns__false_for_integer_overflow_underflow(void** state);
void strtoi_range__returns_consistent_with_strtol_parsing(void** state);
void string_matches_one_of__tests__edge_cases(void** state);
void valid_tls_policy_option__is__correct_for_various_inputs(void** state);
void get_mentions__tests__various(void** state);
void release_is_new__tests__various(void** state);
void str_xml_sanitize__strips_illegal_characters(void** state);
#endif