add start line test for string conversion
This commit is contained in:
		
							parent
							
								
									48da068f31
								
							
						
					
					
						commit
						9332ae0d5d
					
				| @ -47,8 +47,15 @@ impl<'a> HTTPStartLine<'a> { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| impl<'a> Into<String> for HTTPStartLine<'a> { | ||||
|     fn into(self) -> String { | ||||
|         let version: String = self.version.into(); | ||||
|         return format!("{} {} {}", self.method, self.target, version); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| #[test] | ||||
| fn test_start_line() { | ||||
| fn test_parse() { | ||||
|     struct Expect<'a> { | ||||
|         method: &'a str, | ||||
|         target: &'a str, | ||||
| @ -89,3 +96,9 @@ fn test_start_line() { | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| #[test] | ||||
| fn test_into_string() { | ||||
|     let sl: String = HTTPStartLine::new("POST", "/health", HTTPVersion::Http2).into(); | ||||
|     assert_eq!("POST /health HTTP/2".to_string(), sl); | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user