test(headers): Add tests for single value headers.

This commit is contained in:
Pyfisch
2015-04-26 19:16:44 +02:00
parent 6d34448043
commit a27e6812b9
16 changed files with 79 additions and 16 deletions

View File

@@ -202,7 +202,7 @@ macro_rules! header {
}
};
// Single value header
($(#[$a:meta])*($id:ident, $n:expr) => [$value:ty]) => {
($(#[$a:meta])*($id:ident, $n:expr) => [$value:ty] $tm:ident{$($tf:item)*}) => {
$(#[$a])*
#[derive(Clone, Debug, PartialEq)]
pub struct $id(pub $value);
@@ -225,6 +225,15 @@ macro_rules! header {
::std::fmt::Display::fmt(&**self, f)
}
}
#[allow(unused_imports)]
mod $tm{
use std::str;
use $crate::header::*;
use $crate::mime::*;
use $crate::method::Method;
use super::$id as HeaderField;
$($tf)*
}
};
// List header, one or more items with "*" option
($(#[$a:meta])*($id:ident, $n:expr) => {Any / ($item:ty)+} $tm:ident{$($tf:item)*}) => {