#[allow(dead_code)] pub fn hint_same_type(_lhs: &T, _rhs: &T) {} #[macro_export] macro_rules! assert_decode { ($input:literal, $output:expr) => { let node = kfl::decode("", $input).unwrap(); let output = $output; common::hint_same_type(&node, &output); assert_eq!(node, output); }; } #[macro_export] macro_rules! assert_decode_error { ($ty:ty, $input:literal, $output:literal) => { let err = kfl::decode::<$ty>("", $input).unwrap_err(); let err = ::related(&err) .unwrap() .map(|e| e.to_string()) .collect::>() .join("\n"); assert_eq!(err, $output); }; } #[macro_export] macro_rules! assert_decode_children { ($input:literal, $output:expr) => { let node = kfl::decode_children("", $input).unwrap(); let output = $output; common::hint_same_type(&node, &output); assert_eq!(node, output); }; } #[macro_export] macro_rules! assert_decode_children_error { ($ty:ty, $input:literal, $output:literal) => { let err = kfl::decode_children::<$ty>("", $input).unwrap_err(); let err = ::related(&err) .unwrap() .map(|e| e.to_string()) .collect::>() .join("\n"); assert_eq!(err, $output); }; } #[macro_export] macro_rules! assert_encode { ($input:expr, $output:literal) => { let input = kfl::encode("", &$input).unwrap(); let output = $output.to_owned(); // common::hint_same_type(&input, &output); assert_eq!(input, output); }; } // #[macro_export] // macro_rules! assert_encode_error { // ($ty:ty, $input:literal, $output:literal) => { // let err = kfl::eecode::<$ty>("", $input).unwrap_err(); // let err = ::related(&err).unwrap() // .map(|e| e.to_string()).collect::>() // .join("\n"); // assert_eq!(err, $output); // } // } #[macro_export] macro_rules! assert_encode_children { ($input:expr, $output:literal) => { let input = kfl::encode_children("", &$input).unwrap(); let output = $output.to_owned(); // common::hint_same_type(&input, &output); assert_eq!(input, output); }; }