~ubuntu-branches/ubuntu/wily/dovecot/wily

« back to all changes in this revision

Viewing changes to src/lib-mail/test-istream-header-filter.c

  • Committer: Package Import Robot
  • Author(s): Jaldhar H. Vyas
  • Date: 2013-09-09 00:57:32 UTC
  • mfrom: (1.13.11)
  • mto: (4.8.5 experimental) (1.16.1)
  • mto: This revision was merged to the branch mainline in revision 97.
  • Revision ID: package-import@ubuntu.com-20130909005732-dn1eell8srqbhh0e
Tags: upstream-2.2.5
ImportĀ upstreamĀ versionĀ 2.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2007-2012 Dovecot authors, see the included COPYING file */
 
1
/* Copyright (c) 2007-2013 Dovecot authors, see the included COPYING file */
2
2
 
3
3
#include "lib.h"
4
4
#include "str.h"
7
7
#include "istream-header-filter.h"
8
8
#include "test-common.h"
9
9
 
10
 
static void filter_callback(struct message_header_line *hdr,
11
 
                            bool *matched, void *context ATTR_UNUSED)
 
10
static void ATTR_NULL(3)
 
11
filter_callback(struct header_filter_istream *input ATTR_UNUSED,
 
12
                struct message_header_line *hdr,
 
13
                bool *matched, void *context ATTR_UNUSED)
12
14
{
13
15
        if (hdr != NULL && hdr->name_offset == 0) {
14
16
                /* drop first header */
33
35
                                               HEADER_FILTER_EXCLUDE |
34
36
                                               HEADER_FILTER_NO_CR,
35
37
                                               exclude_headers, 2,
36
 
                                               filter_callback, NULL);
 
38
                                               filter_callback, (void *)NULL);
37
39
        filter2 = i_stream_create_header_filter(filter,
38
40
                                                HEADER_FILTER_EXCLUDE |
39
41
                                                HEADER_FILTER_NO_CR,
40
42
                                                exclude_headers, 2,
41
 
                                                null_header_filter_callback, NULL);
 
43
                                                *null_header_filter_callback,
 
44
                                                (void *)NULL);
42
45
        i_stream_unref(&filter);
43
46
        filter = filter2;
44
47
 
67
70
 
68
71
static void test_istream_end_body_with_lf(void)
69
72
{
 
73
        static const char *empty_strarray[] = { NULL };
70
74
        const char *input = "From: foo\n\nhello world";
71
75
        const char *output = "From: foo\n\nhello world\n";
72
76
        struct istream *istream, *filter;
82
86
                                               HEADER_FILTER_EXCLUDE |
83
87
                                               HEADER_FILTER_NO_CR |
84
88
                                               HEADER_FILTER_END_BODY_WITH_LF,
85
 
                                               NULL, 0,
86
 
                                               null_header_filter_callback, NULL);
 
89
                                               empty_strarray, 0,
 
90
                                               *null_header_filter_callback,
 
91
                                               (void *)NULL);
87
92
 
88
93
        for (i = 1; i < input_len; i++) {
89
94
                test_istream_set_size(istream, i);