/* Copyright (c) 2015-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "str.h"
#include "rfc822-parser.h"
#include "test-common.h"
static void test_rfc822_parse_quoted_string(void)
{
static const struct {
int ret;
} tests[] = {
{ "\"", "", -1 },
{ "\"\"", "", 0 },
{ "\"foo\"", "foo", 0 },
{ "\"\"foo", "", 1 },
{ "\"\"\"", "", 1 },
{ "\"\\\"\"", "\"", 0 },
{ "\"\\\\\"", "\\", 0 },
{ "\"\\\\foo\\\\foo\\\\\"", "\\foo\\foo\\", 0 }
};
unsigned int i = 0;
test_begin("rfc822 parse quoted string");
for (i = 0; i < N_ELEMENTS(tests); i++) {
str_truncate(str, 0);
}
test_end();
}
static void test_rfc822_parse_content_param(void)
{
const char *input =
"; key1=value1#$!%&'*+-.^_`{|}~"
"; key2=\" \\\"(),/:;<=>?@[\\\\]\"";
const struct {
} output[] = {
{ "key1", "value1#$!%&'*+-.^_`{|}~" },
{ "key2", " \"(),/:;<=>?@[\\]" }
};
unsigned int i = 0;
int ret;
test_begin("rfc822 parse content param");
i < N_ELEMENTS(output)) {
i++;
}
test_assert(ret == 0);
test_end();
}
int main(void)
{
static void (*const test_functions[])(void) = {
};
return test_run(test_functions);
}