summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-05-28 14:56:56 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-05-29 17:10:25 +0200
commit6f3a67fdc111fa661198df917971aeb36a605186 (patch)
treeae2634b7720a20bb10ad248c4c362bc59b6a45a0 /tests
parent96f41ce4bfdbd57aee7103479faff54d7093e087 (diff)
downloadweechat-6f3a67fdc111fa661198df917971aeb36a605186.zip
core: set word_end_offset to character after word
It seemed strange to me to have word_end_offset point to the last character in the word, rather than the character after the word, especially now with the word stopping before a newline character which meant word_end_offset would be -1 if there was no characters before the newline character.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/gui/test-gui-chat.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/tests/unit/gui/test-gui-chat.cpp b/tests/unit/gui/test-gui-chat.cpp
index a9a46569c..354271c5a 100644
--- a/tests/unit/gui/test-gui-chat.cpp
+++ b/tests/unit/gui/test-gui-chat.cpp
@@ -339,31 +339,31 @@ TEST(GuiChat, GetWordInfo)
WEE_GET_WORD_INFO (0, 0, 0, -1, NULL);
WEE_GET_WORD_INFO (0, 0, 0, -1, "");
- WEE_GET_WORD_INFO (0, 0, 1, 1, "a");
- WEE_GET_WORD_INFO (0, 2, 3, 3, "abc");
- WEE_GET_WORD_INFO (2, 4, 5, 3, " abc");
- WEE_GET_WORD_INFO (2, 4, 5, 3, " abc ");
- WEE_GET_WORD_INFO (0, 4, 5, 5, "first second");
- WEE_GET_WORD_INFO (1, 5, 6, 5, " first second");
-
- WEE_GET_WORD_INFO (0, -1, 0, 0, "\nabc");
- WEE_GET_WORD_INFO (0, 0, 1, 0, " \nabc");
- WEE_GET_WORD_INFO (0, 1, 2, 0, " \nabc");
- WEE_GET_WORD_INFO (0, 4, 5, 5, "first\nsecond");
+ WEE_GET_WORD_INFO (0, 1, 1, 1, "a");
+ WEE_GET_WORD_INFO (0, 3, 3, 3, "abc");
+ WEE_GET_WORD_INFO (2, 5, 5, 3, " abc");
+ WEE_GET_WORD_INFO (2, 5, 5, 3, " abc ");
+ WEE_GET_WORD_INFO (0, 5, 5, 5, "first second");
+ WEE_GET_WORD_INFO (1, 6, 6, 5, " first second");
+
+ WEE_GET_WORD_INFO (0, 0, 0, 0, "\nabc");
+ WEE_GET_WORD_INFO (0, 1, 1, 0, " \nabc");
+ WEE_GET_WORD_INFO (0, 2, 2, 0, " \nabc");
+ WEE_GET_WORD_INFO (0, 5, 5, 5, "first\nsecond");
snprintf (string, sizeof (string), "%c%c01abc", GUI_COLOR_COLOR_CHAR, GUI_COLOR_FG_CHAR);
- WEE_GET_WORD_INFO (4, 6, 3, 3, string);
+ WEE_GET_WORD_INFO (4, 7, 3, 3, string);
snprintf (string, sizeof (string), "abc%c%c01", GUI_COLOR_COLOR_CHAR, GUI_COLOR_FG_CHAR);
- WEE_GET_WORD_INFO (0, 6, 3, 3, string);
+ WEE_GET_WORD_INFO (0, 7, 3, 3, string);
snprintf (string, sizeof (string), " %c%c01 abc", GUI_COLOR_COLOR_CHAR, GUI_COLOR_FG_CHAR);
- WEE_GET_WORD_INFO (6, 8, 5, 3, string);
+ WEE_GET_WORD_INFO (6, 9, 5, 3, string);
snprintf (string, sizeof (string), "\n%c%c01abc", GUI_COLOR_COLOR_CHAR, GUI_COLOR_FG_CHAR);
- WEE_GET_WORD_INFO (0, -1, 0, 0, string);
+ WEE_GET_WORD_INFO (0, 0, 0, 0, string);
snprintf (string, sizeof (string), "%c%c01\nabc", GUI_COLOR_COLOR_CHAR, GUI_COLOR_FG_CHAR);
- WEE_GET_WORD_INFO (0, 3, 0, 0, string);
+ WEE_GET_WORD_INFO (0, 4, 0, 0, string);
snprintf (string, sizeof (string), " %c%c01 \nabc", GUI_COLOR_COLOR_CHAR, GUI_COLOR_FG_CHAR);
- WEE_GET_WORD_INFO (0, 5, 2, 0, string);
+ WEE_GET_WORD_INFO (0, 6, 2, 0, string);
}
/*