summaryrefslogtreecommitdiffstats
path: root/vendor/idna/tests
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/idna/tests')
-rw-r--r--vendor/idna/tests/punycode.rs4
-rw-r--r--vendor/idna/tests/tests.rs12
-rw-r--r--vendor/idna/tests/uts46.rs13
3 files changed, 18 insertions, 11 deletions
diff --git a/vendor/idna/tests/punycode.rs b/vendor/idna/tests/punycode.rs
index c0123c639..1a51cbc92 100644
--- a/vendor/idna/tests/punycode.rs
+++ b/vendor/idna/tests/punycode.rs
@@ -63,9 +63,9 @@ pub fn collect_tests<F: FnMut(String, TestFn)>(add_test: &mut F) {
};
add_test(
test_name,
- TestFn::dyn_test_fn(move || {
+ TestFn::DynTestFn(Box::new(move || {
one_test(get_string(&o, "decoded"), get_string(&o, "encoded"))
- }),
+ })),
)
}
_ => panic!(),
diff --git a/vendor/idna/tests/tests.rs b/vendor/idna/tests/tests.rs
index 5f0f8cde3..0704c81c1 100644
--- a/vendor/idna/tests/tests.rs
+++ b/vendor/idna/tests/tests.rs
@@ -1,4 +1,4 @@
-use rustc_test as test;
+use tester as test;
mod punycode;
mod uts46;
@@ -8,12 +8,18 @@ fn main() {
{
let mut add_test = |name, run| {
tests.push(test::TestDescAndFn {
- desc: test::TestDesc::new(test::DynTestName(name)),
+ desc: test::TestDesc {
+ name: test::DynTestName(name),
+ ignore: false,
+ should_panic: test::ShouldPanic::No,
+ allow_fail: false,
+ test_type: test::TestType::Unknown,
+ },
testfn: run,
})
};
punycode::collect_tests(&mut add_test);
uts46::collect_tests(&mut add_test);
}
- test::test_main(&std::env::args().collect::<Vec<_>>(), tests)
+ test::test_main(&std::env::args().collect::<Vec<_>>(), tests, None)
}
diff --git a/vendor/idna/tests/uts46.rs b/vendor/idna/tests/uts46.rs
index 72b5bcec7..bd402ce97 100644
--- a/vendor/idna/tests/uts46.rs
+++ b/vendor/idna/tests/uts46.rs
@@ -8,6 +8,7 @@
use crate::test::TestFn;
use std::char;
+use std::fmt::Write;
use idna::Errors;
@@ -25,10 +26,10 @@ pub fn collect_tests<F: FnMut(String, TestFn)>(add_test: &mut F) {
};
let mut pieces = line.split(';').map(|x| x.trim()).collect::<Vec<&str>>();
- let source = unescape(&pieces.remove(0));
+ let source = unescape(pieces.remove(0));
// ToUnicode
- let mut to_unicode = unescape(&pieces.remove(0));
+ let mut to_unicode = unescape(pieces.remove(0));
if to_unicode.is_empty() {
to_unicode = source.clone();
}
@@ -65,7 +66,7 @@ pub fn collect_tests<F: FnMut(String, TestFn)>(add_test: &mut F) {
let test_name = format!("UTS #46 line {}", i + 1);
add_test(
test_name,
- TestFn::dyn_test_fn(move || {
+ TestFn::DynTestFn(Box::new(move || {
let config = idna::Config::default()
.use_std3_ascii_rules(true)
.verify_dns_length(true)
@@ -109,7 +110,7 @@ pub fn collect_tests<F: FnMut(String, TestFn)>(add_test: &mut F) {
to_ascii_t_result,
|e| e.starts_with('C') || e == "V2",
);
- }),
+ })),
)
}
}
@@ -160,8 +161,8 @@ fn unescape(input: &str) -> String {
match char::from_u32(((c1 * 16 + c2) * 16 + c3) * 16 + c4) {
Some(c) => output.push(c),
None => {
- output
- .push_str(&format!("\\u{:X}{:X}{:X}{:X}", c1, c2, c3, c4));
+ write!(&mut output, "\\u{:X}{:X}{:X}{:X}", c1, c2, c3, c4)
+ .expect("Could not write to output");
}
};
}