diff --git a/src/client/result/ResultParser.rs b/src/client/result/ResultParser.rs index 8f136ff..a816e9a 100644 --- a/src/client/result/ResultParser.rs +++ b/src/client/result/ResultParser.rs @@ -422,3 +422,31 @@ pub fn match_single_do_co_mo_prefixed_field( ) -> Option { matchSinglePrefixedField(prefix, raw_text, ';', trim) } + +#[cfg(test)] +mod tests { + use crate::{ + client::result::{ParsedClientResult, TextParsedRXingResult}, + RXingResult, + }; + + use super::parse_result_with_parser; + + #[test] + fn test_single_parser() { + let result: RXingResult = RXingResult::new( + "text", + vec![12, 23, 54, 23], + Vec::new(), + crate::BarcodeFormat::EAN_13, + ); + let p_res = parse_result_with_parser(&result, |_| { + Some(ParsedClientResult::TextResult(TextParsedRXingResult::new( + String::from("parsed with parser"), + String::from("en/us"), + ))) + }) + .unwrap(); + assert_eq!(p_res.to_string(), "parsed with parser"); + } +} diff --git a/src/client/result/WifiResultParser.rs b/src/client/result/WifiResultParser.rs index 4c89a57..44eaaf5 100644 --- a/src/client/result/WifiResultParser.rs +++ b/src/client/result/WifiResultParser.rs @@ -51,11 +51,13 @@ pub fn parse(theRXingResult: &crate::RXingResult) -> Option Option