File tree Expand file tree Collapse file tree 3 files changed +15
-0
lines changed
Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ use thiserror::Error;
33
44use crate :: message_head:: info_line:: error:: InfoLineError ;
55
6+ #[ cfg_attr( any( test, debug_assertions) , derive( PartialEq ) ) ]
67#[ derive( Debug , Error ) ]
78pub enum HeaderReadError {
89 #[ error( "infoline| {0}" ) ]
Original file line number Diff line number Diff line change 11use thiserror:: Error ;
22
3+ #[ cfg_attr( any( test, debug_assertions) , derive( PartialEq ) ) ]
34#[ derive( Debug , Error ) ]
45pub enum InfoLineError {
56 #[ error( "first ows| {0}" ) ]
Original file line number Diff line number Diff line change @@ -73,4 +73,17 @@ mod tests {
7373 assert_eq ! ( verify, input) ;
7474 assert_eq ! ( verify. as_ptr_range( ) , org) ;
7575 }
76+
77+ #[ test]
78+ fn test_message_header_error ( ) {
79+ let input = "This is not a valid message" ;
80+ let buf = BytesMut :: from ( input) ;
81+ let result = MessageHead :: < Request > :: try_from ( buf) ;
82+ if let Err ( e) = result {
83+ let err = HeaderReadError :: HeaderStruct ( input. to_string ( ) ) ;
84+ assert_eq ! ( e, err) ;
85+ } else {
86+ panic ! ( "Expected error" ) ;
87+ }
88+ }
7689}
You can’t perform that action at this time.
0 commit comments