Skip to content

Commit 50c3efe

Browse files
committed
Fix idna tests
1 parent 7371286 commit 50c3efe

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

idna/tests/unit.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
extern crate idna;
22
extern crate unicode_normalization;
33

4-
use idna::uts46;
54
use unicode_normalization::char::is_combining_mark;
65

7-
fn _to_ascii(domain: &str) -> Result<String, uts46::Errors> {
8-
uts46::to_ascii(
9-
domain,
10-
uts46::Flags {
11-
transitional_processing: false,
12-
use_std3_ascii_rules: true,
13-
verify_dns_length: true,
14-
},
15-
)
6+
fn _to_ascii(domain: &str) -> Result<String, idna::Errors> {
7+
idna::Config::default()
8+
.verify_dns_length(true)
9+
.use_std3_ascii_rules(true)
10+
.to_ascii(domain)
1611
}
1712

1813
#[test]

idna/tests/uts46.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// option. This file may not be copied, modified, or distributed
77
// except according to those terms.
88

9-
use idna::uts46;
109
use std::char;
1110
use test::TestFn;
1211

@@ -49,14 +48,12 @@ pub fn collect_tests<F: FnMut(String, TestFn)>(add_test: &mut F) {
4948
add_test(
5049
test_name,
5150
TestFn::dyn_test_fn(move || {
52-
let result = uts46::to_ascii(
53-
&source,
54-
uts46::Flags {
55-
use_std3_ascii_rules: true,
56-
transitional_processing: test_type == "T",
57-
verify_dns_length: true,
58-
},
59-
);
51+
let result = idna::Config::default()
52+
.use_std3_ascii_rules(true)
53+
.verify_dns_length(true)
54+
.check_hyphens(true)
55+
.transitional_processing(test_type == "T")
56+
.to_ascii(&source);
6057

6158
if to_ascii.starts_with("[") {
6259
if to_ascii.starts_with("[C") {

0 commit comments

Comments
 (0)