test(headers): Add tests for possibly empty list headers.

This commit is contained in:
Pyfisch
2015-04-26 14:32:10 +02:00
parent 18f717fcf1
commit 76a4a01348
7 changed files with 53 additions and 19 deletions

View File

@@ -125,7 +125,7 @@ macro_rules! header {
// $nn:expr: Nice name of the header
// List header, zero or more items
($(#[$a:meta])*($id:ident, $n:expr) => ($item:ty)*) => {
($(#[$a:meta])*($id:ident, $n:expr) => ($item:ty)* $tm:ident{$($tf:item)*}) => {
$(#[$a])*
#[derive(Clone, Debug, PartialEq)]
pub struct $id(pub Vec<$item>);
@@ -149,6 +149,14 @@ macro_rules! header {
self.fmt_header(f)
}
}
#[allow(unused_imports)]
mod $tm{
use $crate::header::*;
use $crate::mime::*;
use $crate::method::Method;
use super::$id as HeaderField;
$($tf)*
}
};
// List header, one or more items
@@ -180,6 +188,7 @@ macro_rules! header {
mod $tm{
use $crate::header::*;
use $crate::mime::*;
use $crate::method::Method;
use super::$id as HeaderField;
$($tf)*
}
@@ -253,6 +262,7 @@ macro_rules! header {
mod $tm{
use $crate::header::*;
use $crate::mime::*;
use $crate::method::Method;
use super::$id as HeaderField;
$($tf)*
}