| 
						
						
						
					 | 
					@ -1,5 +1,6 @@ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					use crate::convert::to_json; | 
					 | 
					 | 
					use crate::convert::to_json; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					#[allow(dead_code)] | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					const JSON_TEST_CONTENT: &str = r#" | 
					 | 
					 | 
					const JSON_TEST_CONTENT: &str = r#" | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					{ | 
					 | 
					 | 
					{ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  "int": 123, | 
					 | 
					 | 
					  "int": 123, | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -13,6 +14,7 @@ const JSON_TEST_CONTENT: &str = r#" | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					} | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					"#; | 
					 | 
					 | 
					"#; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					#[allow(dead_code)] | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					const YAML_TEST_CONTENT: &str = r#" | 
					 | 
					 | 
					const YAML_TEST_CONTENT: &str = r#" | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					int: 123 | 
					 | 
					 | 
					int: 123 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					bool: true | 
					 | 
					 | 
					bool: true | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -28,6 +30,7 @@ object: | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  sub: test | 
					 | 
					 | 
					  sub: test | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					"#; | 
					 | 
					 | 
					"#; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					#[allow(dead_code)] | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					const TOML_TEST_CONTENT: &str = r#" | 
					 | 
					 | 
					const TOML_TEST_CONTENT: &str = r#" | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					int = 123 | 
					 | 
					 | 
					int = 123 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					bool = true | 
					 | 
					 | 
					bool = true | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -39,33 +42,39 @@ array = [ 1, 2, 3, 4, 5 ] | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					sub = "test" | 
					 | 
					 | 
					sub = "test" | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					"#; | 
					 | 
					 | 
					"#; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					fn format_json(raw: &str) -> String { | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					mod tests { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    use super::*; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    #[allow(dead_code)] | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    fn format_json(raw: &str) -> String { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        match to_json(raw) { | 
					 | 
					 | 
					        match to_json(raw) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            Some(data) => data, | 
					 | 
					 | 
					            Some(data) => data, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            None => panic!("JSON format error"), | 
					 | 
					 | 
					            None => panic!("JSON format error"), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					} | 
					 | 
					 | 
					    } | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					#[test] | 
					 | 
					 | 
					    #[test] | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					fn json_to_json() { | 
					 | 
					 | 
					    fn json_to_json() { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        assert_eq!( | 
					 | 
					 | 
					        assert_eq!( | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            format_json(JSON_TEST_CONTENT), | 
					 | 
					 | 
					            format_json(JSON_TEST_CONTENT), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            format_json(&to_json(JSON_TEST_CONTENT).unwrap()), | 
					 | 
					 | 
					            format_json(&to_json(JSON_TEST_CONTENT).unwrap()), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        ); | 
					 | 
					 | 
					        ); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					} | 
					 | 
					 | 
					    } | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					#[test] | 
					 | 
					 | 
					    #[test] | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					fn yaml_to_json() { | 
					 | 
					 | 
					    fn yaml_to_json() { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        assert_eq!( | 
					 | 
					 | 
					        assert_eq!( | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            format_json(JSON_TEST_CONTENT), | 
					 | 
					 | 
					            format_json(JSON_TEST_CONTENT), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            format_json(&to_json(YAML_TEST_CONTENT).unwrap()), | 
					 | 
					 | 
					            format_json(&to_json(YAML_TEST_CONTENT).unwrap()), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        ); | 
					 | 
					 | 
					        ); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					} | 
					 | 
					 | 
					    } | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					#[test] | 
					 | 
					 | 
					    #[test] | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					fn toml_to_json() { | 
					 | 
					 | 
					    fn toml_to_json() { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        assert_eq!( | 
					 | 
					 | 
					        assert_eq!( | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            format_json(JSON_TEST_CONTENT), | 
					 | 
					 | 
					            format_json(JSON_TEST_CONTENT), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            format_json(&to_json(TOML_TEST_CONTENT).unwrap()), | 
					 | 
					 | 
					            format_json(&to_json(TOML_TEST_CONTENT).unwrap()), | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        ); | 
					 | 
					 | 
					        ); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					} | 
					 | 
					 | 
					} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					
  |