"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/lib/test-strescape.c" between
dovecot-2.3.16.tar.gz and dovecot-2.3.17.tar.gz

About: Dovecot is an IMAP and POP3 server, written with security primarily in mind.

test-strescape.c  (dovecot-2.3.16):test-strescape.c  (dovecot-2.3.17)
skipping to change at line 13 skipping to change at line 13
#include "test-lib.h" #include "test-lib.h"
#include "str.h" #include "str.h"
#include "strescape.h" #include "strescape.h"
struct strinput { struct strinput {
const char *input; const char *input;
const char *output; const char *output;
}; };
static const char tabescaped_input[] = "\0011\001t\001r\001nplip\001n"; static const char tabescaped_input[] = "\0011\001t\001r\001nplip\001n";
static const char tabescaped_input_with_nul[] = "\0011\001t\001r\001nplip\001n\0 010";
static const char tabunescaped_input[] = "\001\t\r\nplip\n"; static const char tabunescaped_input[] = "\001\t\r\nplip\n";
static const char *wrong_tabescaped_input = "a\001\001b\001\nc\0011\001t\001r\00 1nplip\001n"; static const char *wrong_tabescaped_input = "a\001\001b\001\nc\0011\001t\001r\00 1nplip\001n";
static const char *wrong_tabescaped_output = "a\001b\nc\001\t\r\nplip\n"; static const char *wrong_tabescaped_output = "a\001b\nc\001\t\r\nplip\n";
static struct { static struct {
const char *input; const char *input;
const char *const *output; const char *const *output;
} strsplit_tests[] = { } strsplit_tests[] = {
{ /*tabescaped_input3*/NULL, (const char *const []) { { /*tabescaped_input3*/NULL, (const char *const []) {
skipping to change at line 136 skipping to change at line 137
static void test_tabescape(void) static void test_tabescape(void)
{ {
string_t *str = t_str_new(128); string_t *str = t_str_new(128);
test_begin("string tabescaping"); test_begin("string tabescaping");
test_assert(strcmp(str_tabescape(tabunescaped_input), tabescaped_input) = = 0); test_assert(strcmp(str_tabescape(tabunescaped_input), tabescaped_input) = = 0);
str_append_tabescaped(str, tabunescaped_input); str_append_tabescaped(str, tabunescaped_input);
test_assert(strcmp(str_c(str), tabescaped_input) == 0); test_assert(strcmp(str_c(str), tabescaped_input) == 0);
/* test escaping the trailing NUL as well */
str_truncate(str, 0);
str_append_tabescaped_n(str, (const unsigned char *)tabunescaped_input,
strlen(tabunescaped_input)+1);
test_assert_strcmp(str_c(str), tabescaped_input_with_nul);
/* unescaping */ /* unescaping */
str_truncate(str, 0); str_truncate(str, 0);
str_append_tabunescaped(str, tabescaped_input, strlen(tabescaped_input)); str_append_tabunescaped(str, tabescaped_input, strlen(tabescaped_input));
test_assert(strcmp(str_c(str), tabunescaped_input) == 0); test_assert(strcmp(str_c(str), tabunescaped_input) == 0);
test_assert(strcmp(str_tabunescape(t_strdup_noconst(tabescaped_input)), t abunescaped_input) == 0); test_assert(strcmp(str_tabunescape(t_strdup_noconst(tabescaped_input)), t abunescaped_input) == 0);
test_assert(strcmp(t_str_tabunescape(tabescaped_input), tabunescaped_inpu t) == 0); test_assert(strcmp(t_str_tabunescape(tabescaped_input), tabunescaped_inpu t) == 0);
/* unescaping with wrongly written tabescape-input */ /* unescaping with wrongly written tabescape-input */
str_truncate(str, 0); str_truncate(str, 0);
 End of changes. 2 change blocks. 
0 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)