Skip to content

Commit

Permalink
include decode_to_string in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bishopcheckmate committed Jan 9, 2024
1 parent d318128 commit a5ff8fa
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion idna/tests/punycode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// except according to those terms.

use crate::test::TestFn;
use idna::punycode::{decode, encode_str};
use idna::punycode::{decode, decode_to_string, encode_str};
use serde_json::map::Map;
use serde_json::Value;
use std::panic::catch_unwind;
Expand All @@ -28,6 +28,17 @@ fn one_test(decoded: &str, encoded: &str) {
}
}

match decode_to_string(encoded) {
None => panic!("Decoding {} failed.", encoded),
Some(result) => assert!(
result == decoded,
"Incorrect decoding of \"{}\":\n \"{}\"\n!= \"{}\"\n",
encoded,
result,
decoded
),
}

match encode_str(decoded) {
None => panic!("Encoding {} failed.", decoded),
Some(result) => assert!(
Expand Down

0 comments on commit a5ff8fa

Please sign in to comment.