Commit cd901665 authored by David Gibson's avatar David Gibson

rfc822: Rename bad-header test

The run-bad-header.c test in the rfc822 module is actually testing handling
of one specific sort of bad header - a header field which contains no
colon character.  Rename the test and its internal variables to better
reflect this.
Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
parent 786fd5a1
...@@ -14,16 +14,16 @@ ...@@ -14,16 +14,16 @@
#include "testdata.h" #include "testdata.h"
#include "helper.h" #include "helper.h"
#define BAD_HEADER_STR "This is a bad header\n" #define NO_COLON_STR "This is a bad header\n"
const char bad_header[] = const char no_colon_msg[] =
"Date: Tue, 22 Feb 2011 00:15:59 +1100\n" "Date: Tue, 22 Feb 2011 00:15:59 +1100\n"
BAD_HEADER_STR NO_COLON_STR
"From: Mister From <from@example.com>\n" "From: Mister From <from@example.com>\n"
"To: Mizz To <to@example.org>\n" "To: Mizz To <to@example.org>\n"
"Subject: Some subject\n" "Subject: Some subject\n"
"Message-ID: <20110221131559.GA28327@example>\n"; "Message-ID: <20110221131559.GA28327@example>\n";
static void test_bad_header(const char *buf, size_t len) static void test_no_colon(const char *buf, size_t len)
{ {
struct rfc822_msg *msg; struct rfc822_msg *msg;
struct rfc822_header *hdr; struct rfc822_header *hdr;
...@@ -50,7 +50,7 @@ static void test_bad_header(const char *buf, size_t len) ...@@ -50,7 +50,7 @@ static void test_bad_header(const char *buf, size_t len)
hfull = rfc822_header_raw_content(msg, hdr); hfull = rfc822_header_raw_content(msg, hdr);
allocation_failure_check(); allocation_failure_check();
ok(bytestring_eq(hfull, BYTESTRING(BAD_HEADER_STR)), ok(bytestring_eq(hfull, BYTESTRING(NO_COLON_STR)),
"Invalid header content"); "Invalid header content");
rfc822_free(msg); rfc822_free(msg);
...@@ -61,7 +61,7 @@ int main(int argc, char *argv[]) ...@@ -61,7 +61,7 @@ int main(int argc, char *argv[])
{ {
failtest_setup(argc, argv); failtest_setup(argc, argv);
test_bad_header(bad_header, sizeof(bad_header)); test_no_colon(no_colon_msg, sizeof(no_colon_msg));
/* This exits depending on whether all tests passed */ /* This exits depending on whether all tests passed */
failtest_exit(exit_status()); failtest_exit(exit_status());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment