Don't use newer C syntax for declaration in tests

parent e8bc8558
...@@ -36,79 +36,96 @@ static void assert_trailers(const char *message, struct trailer *trailers) ...@@ -36,79 +36,96 @@ static void assert_trailers(const char *message, struct trailer *trailers)
void test_message_trailer__simple(void) void test_message_trailer__simple(void)
{ {
struct trailer trailers[3];
trailers[0].key = "Signed-off-by";
trailers[0].value = "foo@bar.com";
trailers[1].key = "Signed-off-by";
trailers[1].value = "someone@else.com";
trailers[2].key = NULL;
trailers[2].value = NULL;
assert_trailers( assert_trailers(
"Message\n" "Message\n"
"\n" "\n"
"Signed-off-by: foo@bar.com\n" "Signed-off-by: foo@bar.com\n"
"Signed-off-by: someone@else.com\n" "Signed-off-by: someone@else.com\n"
, , trailers);
(struct trailer[]){
{ "Signed-off-by", "foo@bar.com" },
{ "Signed-off-by", "someone@else.com" },
{ NULL, NULL },
}
);
} }
void test_message_trailer__no_whitespace(void) void test_message_trailer__no_whitespace(void)
{ {
struct trailer trailers[2];
trailers[0].key = "Key";
trailers[0].value = "value";
trailers[1].key = NULL;
trailers[1].value = NULL;
assert_trailers( assert_trailers(
"Message\n" "Message\n"
"\n" "\n"
"Key:value\n" "Key:value\n"
, , trailers);
(struct trailer[]){
{ "Key", "value" },
{ NULL, NULL },
}
);
} }
void test_message_trailer__extra_whitespace(void) void test_message_trailer__extra_whitespace(void)
{ {
struct trailer trailers[2];
trailers[0].key = "Key";
trailers[0].value = "value";
trailers[1].key = NULL;
trailers[1].value = NULL;
assert_trailers( assert_trailers(
"Message\n" "Message\n"
"\n" "\n"
"Key : value\n" "Key : value\n"
, , trailers);
(struct trailer[]){
{ "Key", "value" },
{ NULL, NULL },
}
);
} }
void test_message_trailer__no_newline(void) void test_message_trailer__no_newline(void)
{ {
struct trailer trailers[2];
trailers[0].key = "Key";
trailers[0].value = "value";
trailers[1].key = NULL;
trailers[1].value = NULL;
assert_trailers( assert_trailers(
"Message\n" "Message\n"
"\n" "\n"
"Key: value" "Key: value"
, , trailers);
(struct trailer[]){
{ "Key", "value" },
{ NULL, NULL },
}
);
} }
void test_message_trailer__not_last_paragraph(void) void test_message_trailer__not_last_paragraph(void)
{ {
struct trailer trailers;
trailers.key = NULL;
trailers.value = NULL;
assert_trailers( assert_trailers(
"Message\n" "Message\n"
"\n" "\n"
"Key: value\n" "Key: value\n"
"\n" "\n"
"More stuff\n" "More stuff\n"
, , &trailers);
(struct trailer[]){
{ NULL, NULL },
}
);
} }
void test_message_trailer__conflicts(void) void test_message_trailer__conflicts(void)
{ {
struct trailer trailers[2];
trailers[0].key = "Key";
trailers[0].value = "value";
trailers[1].key = NULL;
trailers[1].value = NULL;
assert_trailers( assert_trailers(
"Message\n" "Message\n"
"\n" "\n"
...@@ -116,16 +133,18 @@ void test_message_trailer__conflicts(void) ...@@ -116,16 +133,18 @@ void test_message_trailer__conflicts(void)
"\n" "\n"
"Conflicts:\n" "Conflicts:\n"
"\tfoo.c\n" "\tfoo.c\n"
, , trailers);
(struct trailer[]){
{ "Key", "value" },
{ NULL, NULL },
}
);
} }
void test_message_trailer__patch(void) void test_message_trailer__patch(void)
{ {
struct trailer trailers[2];
trailers[0].key = "Key";
trailers[0].value = "value";
trailers[1].key = NULL;
trailers[1].value = NULL;
assert_trailers( assert_trailers(
"Message\n" "Message\n"
"\n" "\n"
...@@ -133,16 +152,22 @@ void test_message_trailer__patch(void) ...@@ -133,16 +152,22 @@ void test_message_trailer__patch(void)
"\n" "\n"
"---\n" "---\n"
"More: stuff\n" "More: stuff\n"
, , trailers);
(struct trailer[]){
{ "Key", "value" },
{ NULL, NULL },
}
);
} }
void test_message_trailer__continuation(void) void test_message_trailer__continuation(void)
{ {
struct trailer trailers[4];
trailers[0].key = "A";
trailers[0].value = "b\n c";
trailers[1].key = "D";
trailers[1].value = "e\n f: g h";
trailers[2].key = "I";
trailers[2].value = "j";
trailers[3].key = NULL;
trailers[3].value = NULL;
assert_trailers( assert_trailers(
"Message\n" "Message\n"
"\n" "\n"
...@@ -151,29 +176,25 @@ void test_message_trailer__continuation(void) ...@@ -151,29 +176,25 @@ void test_message_trailer__continuation(void)
"D: e\n" "D: e\n"
" f: g h\n" " f: g h\n"
"I: j\n" "I: j\n"
, , trailers);
(struct trailer[]){
{ "A", "b\n c" },
{ "D", "e\n f: g h" },
{ "I", "j" },
{ NULL, NULL },
}
);
} }
void test_message_trailer__invalid(void) void test_message_trailer__invalid(void)
{ {
struct trailer trailers[3];
trailers[0].key = "Signed-off-by";
trailers[0].value = "some@one.com";
trailers[1].key = "Another";
trailers[1].value = "trailer";
trailers[2].key = NULL;
trailers[2].value = NULL;
assert_trailers( assert_trailers(
"Message\n" "Message\n"
"\n" "\n"
"Signed-off-by: some@one.com\n" "Signed-off-by: some@one.com\n"
"Not a trailer\n" "Not a trailer\n"
"Another: trailer\n" "Another: trailer\n"
, , trailers);
(struct trailer[]){
{ "Signed-off-by", "some@one.com" },
{ "Another", "trailer" },
{ NULL, NULL },
}
);
} }
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