Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
6bc7301e
Unverified
Commit
6bc7301e
authored
Jan 03, 2018
by
Brian Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't use newer C syntax for declaration in tests
parent
e8bc8558
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
57 deletions
+78
-57
tests/message/trailer.c
+78
-57
No files found.
tests/message/trailer.c
View file @
6bc7301e
...
...
@@ -36,79 +36,96 @@ static void assert_trailers(const char *message, struct trailer *trailers)
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
(
"Message
\n
"
"
\n
"
"Signed-off-by: foo@bar.com
\n
"
"Signed-off-by: someone@else.com
\n
"
,
(
struct
trailer
[]){
{
"Signed-off-by"
,
"foo@bar.com"
},
{
"Signed-off-by"
,
"someone@else.com"
},
{
NULL
,
NULL
},
}
);
,
trailers
);
}
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
(
"Message
\n
"
"
\n
"
"Key:value
\n
"
,
(
struct
trailer
[]){
{
"Key"
,
"value"
},
{
NULL
,
NULL
},
}
);
,
trailers
);
}
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
(
"Message
\n
"
"
\n
"
"Key : value
\n
"
,
(
struct
trailer
[]){
{
"Key"
,
"value"
},
{
NULL
,
NULL
},
}
);
,
trailers
);
}
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
(
"Message
\n
"
"
\n
"
"Key: value"
,
(
struct
trailer
[]){
{
"Key"
,
"value"
},
{
NULL
,
NULL
},
}
);
,
trailers
);
}
void
test_message_trailer__not_last_paragraph
(
void
)
{
struct
trailer
trailers
;
trailers
.
key
=
NULL
;
trailers
.
value
=
NULL
;
assert_trailers
(
"Message
\n
"
"
\n
"
"Key: value
\n
"
"
\n
"
"More stuff
\n
"
,
(
struct
trailer
[]){
{
NULL
,
NULL
},
}
);
,
&
trailers
);
}
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
(
"Message
\n
"
"
\n
"
...
...
@@ -116,16 +133,18 @@ void test_message_trailer__conflicts(void)
"
\n
"
"Conflicts:
\n
"
"
\t
foo.c
\n
"
,
(
struct
trailer
[]){
{
"Key"
,
"value"
},
{
NULL
,
NULL
},
}
);
,
trailers
);
}
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
(
"Message
\n
"
"
\n
"
...
...
@@ -133,16 +152,22 @@ void test_message_trailer__patch(void)
"
\n
"
"---
\n
"
"More: stuff
\n
"
,
(
struct
trailer
[]){
{
"Key"
,
"value"
},
{
NULL
,
NULL
},
}
);
,
trailers
);
}
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
(
"Message
\n
"
"
\n
"
...
...
@@ -151,29 +176,25 @@ void test_message_trailer__continuation(void)
"D: e
\n
"
" f: g h
\n
"
"I: j
\n
"
,
(
struct
trailer
[]){
{
"A"
,
"b
\n
c"
},
{
"D"
,
"e
\n
f: g h"
},
{
"I"
,
"j"
},
{
NULL
,
NULL
},
}
);
,
trailers
);
}
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
(
"Message
\n
"
"
\n
"
"Signed-off-by: some@one.com
\n
"
"Not a trailer
\n
"
"Another: trailer
\n
"
,
(
struct
trailer
[]){
{
"Signed-off-by"
,
"some@one.com"
},
{
"Another"
,
"trailer"
},
{
NULL
,
NULL
},
}
);
,
trailers
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment