1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-26 21:06:38 +02:00

tests: add tests of functions string_is_command_char and string_input_for_buffer

This commit is contained in:
Sébastien Helleu
2014-08-02 16:55:49 +02:00
parent 28cb1ae6f5
commit 1aa8fd09ef
+21 -9
View File
@@ -823,17 +823,29 @@ TEST(String, BaseN)
TEST(String, Input)
{
/* TODO: write tests */
}
char *str;
/*
* Tests functions:
* string_is_command_char
*/
/* string_is_command_char */
LONGS_EQUAL(0, string_is_command_char (NULL));
LONGS_EQUAL(0, string_is_command_char (""));
LONGS_EQUAL(0, string_is_command_char ("abc"));
LONGS_EQUAL(1, string_is_command_char ("/"));
LONGS_EQUAL(1, string_is_command_char ("/abc"));
LONGS_EQUAL(1, string_is_command_char ("//abc"));
TEST(String, CommandChar)
{
/* TODO: write tests */
/* string_input_for_buffer */
POINTERS_EQUAL(NULL, string_input_for_buffer (NULL));
POINTERS_EQUAL(NULL, string_input_for_buffer ("/"));
POINTERS_EQUAL(NULL, string_input_for_buffer ("/abc"));
str = strdup ("");
STRCMP_EQUAL(str, string_input_for_buffer (str));
free (str);
str = strdup ("abc");
STRCMP_EQUAL(str, string_input_for_buffer (str));
free (str);
str = strdup ("//abc");
STRCMP_EQUAL(str + 1, string_input_for_buffer (str));
free (str);
}
/*