~ubuntu-branches/ubuntu/trusty/apr-util/trusty

« back to all changes in this revision

Viewing changes to test/testuri.c

  • Committer: Bazaar Package Importer
  • Author(s): Ryan Niebur
  • Date: 2009-03-26 22:25:48 UTC
  • mto: (4.1.1 squeeze) (20.1.2 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20090326222548-v103269kb84vo0ub
Tags: upstream-1.3.4+dfsg
ImportĀ upstreamĀ versionĀ 1.3.4+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
95
95
        "//www.apache.org/",
96
96
        0, NULL, "www.apache.org", NULL, NULL, "www.apache.org", NULL, "/", NULL, NULL, 0
97
97
    },
 
98
    {
 
99
        "file:image.jpg",
 
100
        0, "file", NULL, NULL, NULL, NULL, NULL, "image.jpg", NULL, NULL, 0
 
101
    },
 
102
    {
 
103
        "file:/image.jpg",
 
104
        0, "file", NULL, NULL, NULL, NULL, NULL, "/image.jpg", NULL, NULL, 0
 
105
    },
 
106
    {
 
107
        "file:///image.jpg",
 
108
        0, "file", "", NULL, NULL, "", NULL, "/image.jpg", NULL, NULL, 0
 
109
    },
 
110
    {
 
111
        "file:///tmp/photos/image.jpg",
 
112
        0, "file", "", NULL, NULL, "", NULL, "/tmp/photos/image.jpg", NULL, NULL, 0
 
113
    },
 
114
    {
 
115
        "file:./image.jpg",
 
116
        0, "file", NULL, NULL, NULL, NULL, NULL, "./image.jpg", NULL, NULL, 0
 
117
    },
 
118
    {
 
119
        "file:../photos/image.jpg",
 
120
        0, "file", NULL, NULL, NULL, NULL, NULL, "../photos/image.jpg", NULL, NULL, 0
 
121
    },
98
122
};
99
123
 
100
124
struct uph_test {
181
205
                     rv, t->rv);
182
206
        ABTS_ASSERT(tc, msg, rv == t->rv);
183
207
        if (t->rv == APR_SUCCESS) {
184
 
            ABTS_STR_EQUAL(tc, info.scheme, t->scheme);
185
 
            ABTS_STR_EQUAL(tc, info.hostinfo, t->hostinfo);
186
 
            ABTS_STR_EQUAL(tc, info.user, t->user);
187
 
            ABTS_STR_EQUAL(tc, info.password, t->password);
188
 
            ABTS_STR_EQUAL(tc, info.hostname, t->hostname);
189
 
            ABTS_STR_EQUAL(tc, info.port_str, t->port_str);
 
208
            ABTS_STR_EQUAL(tc, t->scheme, info.scheme);
 
209
            ABTS_STR_EQUAL(tc, t->hostinfo, info.hostinfo);
 
210
            ABTS_STR_EQUAL(tc, t->user, info.user);
 
211
            ABTS_STR_EQUAL(tc, t->password, info.password);
 
212
            ABTS_STR_EQUAL(tc, t->hostname, info.hostname);
 
213
            ABTS_STR_EQUAL(tc, t->port_str, info.port_str);
 
214
            ABTS_STR_EQUAL(tc, t->path, info.path);
 
215
            ABTS_STR_EQUAL(tc, t->query, info.query);
 
216
            ABTS_STR_EQUAL(tc, t->user, info.user);
 
217
            ABTS_INT_EQUAL(tc, t->port, info.port);
 
218
 
 
219
            s = apr_uri_unparse(p, &info, APR_URI_UNP_REVEALPASSWORD);
 
220
            ABTS_STR_EQUAL(tc, t->uri, s);
 
221
 
 
222
            s = apr_uri_unparse(p, &info, APR_URI_UNP_OMITSITEPART);
 
223
            rv = apr_uri_parse(p, s, &info);
 
224
            ABTS_STR_EQUAL(tc, info.scheme, NULL);
 
225
            ABTS_STR_EQUAL(tc, info.hostinfo, NULL);
 
226
            ABTS_STR_EQUAL(tc, info.user, NULL);
 
227
            ABTS_STR_EQUAL(tc, info.password, NULL);
 
228
            ABTS_STR_EQUAL(tc, info.hostname, NULL);
 
229
            ABTS_STR_EQUAL(tc, info.port_str, NULL);
190
230
            ABTS_STR_EQUAL(tc, info.path, t->path);
191
231
            ABTS_STR_EQUAL(tc, info.query, t->query);
192
 
            ABTS_STR_EQUAL(tc, info.user, t->user);
193
 
            ABTS_INT_EQUAL(tc, info.port, t->port);
194
 
 
195
 
            s = apr_uri_unparse(p, &info, APR_URI_UNP_REVEALPASSWORD);
196
 
            ABTS_STR_EQUAL(tc, s, t->uri);
 
232
            ABTS_STR_EQUAL(tc, info.user, NULL);
 
233
            ABTS_INT_EQUAL(tc, info.port, 0);
197
234
        }
198
235
    }
199
236
}
209
246
        memset(&info, 0, sizeof(info));
210
247
        t = &uph_tests[i];
211
248
        rv = apr_uri_parse_hostinfo(p, t->hostinfo, &info);
212
 
        ABTS_INT_EQUAL(tc, rv, t->rv);
 
249
        ABTS_INT_EQUAL(tc, t->rv, rv);
213
250
        if (t->rv == APR_SUCCESS) {
214
 
            ABTS_STR_EQUAL(tc, info.hostname, t->hostname);
215
 
            ABTS_STR_EQUAL(tc, info.port_str, t->port_str);
216
 
            ABTS_INT_EQUAL(tc, info.port, t->port);
 
251
            ABTS_STR_EQUAL(tc, t->hostname, info.hostname);
 
252
            ABTS_STR_EQUAL(tc, t->port_str, info.port_str);
 
253
            ABTS_INT_EQUAL(tc, t->port, info.port);
217
254
        }
218
255
    }
219
256
}