Skip to content

Commit d632c9f

Browse files
committed
rustfmt
1 parent 7d89188 commit d632c9f

File tree

4 files changed

+50
-20
lines changed

4 files changed

+50
-20
lines changed

src/rfc3454.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1772,4 +1772,3 @@ pub const B_2: &[(char, &str)] = &[
17721772
('\u{1D7A8}', "\u{03C9}"),
17731773
('\u{1D7BB}', "\u{03C3}"),
17741774
];
1775-

tests/nameprep_tests.rs

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Integration tests from https://tools.ietf.org/html/draft-josefsson-idn-test-vectors-00
22
extern crate stringprep;
33

4-
use stringprep::{Error, nameprep};
4+
use stringprep::{nameprep, Error};
55

66
fn assert_prohibited_character<T>(result: Result<T, Error>) {
77
assert!(result.is_err());
@@ -14,25 +14,47 @@ fn assert_prohibited_bidirectional_text<T>(result: Result<T, Error>) {
1414
// Additional examples from http://josefsson.org/idn.php
1515
#[test]
1616
fn test_nameprep() {
17-
assert_eq!("安室奈美恵-with-super-monkeys", nameprep("安室奈美恵-with-SUPER-MONKEYS").unwrap());
18-
assert_eq!("미술", nameprep("미술").unwrap()); // Korean
19-
assert_eq!("ليهمابتكلموشعربي؟", nameprep("ليهمابتكلموشعربي؟").unwrap()); // Egyptian
20-
assert_eq!("他们为什么不说中文", nameprep("他们为什么不说中文").unwrap()); // Chinese
21-
assert_eq!("למההםפשוטלאמדבריםעברית", nameprep("למההםפשוטלאמדבריםעברית").unwrap()); // Hebrew
22-
assert_eq!("почемужеонинеговорятпорусски", nameprep("почемужеонинеговорятпорусски").unwrap()); // Russian
23-
assert_eq!("tạisaohọkhôngthểchỉnóitiếngviệt", nameprep("TạisaohọkhôngthểchỉnóitiếngViệt").unwrap()); // Vietnamese
24-
assert_eq!("ひとつ屋根の下2", nameprep("ひとつ屋根の下2").unwrap()); // Japanese
25-
assert_eq!("pročprostěnemluvíčesky", nameprep("Pročprostěnemluvíčesky").unwrap()); // Czech
26-
assert_eq!("यहलोगहिन्दीक्योंनहींबोलसकतेहैं", nameprep("यहलोगहिन्दीक्योंनहींबोलसकतेहैं").unwrap()); // Hindi
27-
assert_eq!("ພາສາລາວ", nameprep("ພາສາລາວ").unwrap()); // Lao
28-
assert_eq!("bonġusaħħa", nameprep("bonġusaħħa").unwrap()); // Maltese
29-
assert_eq!("ελληνικά", nameprep("ελληνικά").unwrap()); // Greek
17+
assert_eq!(
18+
"安室奈美恵-with-super-monkeys",
19+
nameprep("安室奈美恵-with-SUPER-MONKEYS").unwrap()
20+
);
21+
assert_eq!("미술", nameprep("미술").unwrap()); // Korean
22+
assert_eq!("ليهمابتكلموشعربي؟", nameprep("ليهمابتكلموشعربي؟").unwrap()); // Egyptian
23+
assert_eq!(
24+
"他们为什么不说中文",
25+
nameprep("他们为什么不说中文").unwrap()
26+
); // Chinese
27+
assert_eq!(
28+
"למההםפשוטלאמדבריםעברית",
29+
nameprep("למההםפשוטלאמדבריםעברית").unwrap()
30+
); // Hebrew
31+
assert_eq!(
32+
"почемужеонинеговорятпорусски",
33+
nameprep("почемужеонинеговорятпорусски").unwrap()
34+
); // Russian
35+
assert_eq!(
36+
"tạisaohọkhôngthểchỉnóitiếngviệt",
37+
nameprep("TạisaohọkhôngthểchỉnóitiếngViệt").unwrap()
38+
); // Vietnamese
39+
assert_eq!("ひとつ屋根の下2", nameprep("ひとつ屋根の下2").unwrap()); // Japanese
40+
assert_eq!(
41+
"pročprostěnemluvíčesky",
42+
nameprep("Pročprostěnemluvíčesky").unwrap()
43+
); // Czech
44+
assert_eq!(
45+
"यहलोगहिन्दीक्योंनहींबोलसकतेहैं",
46+
nameprep("यहलोगहिन्दीक्योंनहींबोलसकतेहैं").unwrap()
47+
); // Hindi
48+
assert_eq!("ພາສາລາວ", nameprep("ພາສາລາວ").unwrap()); // Lao
49+
assert_eq!("bonġusaħħa", nameprep("bonġusaħħa").unwrap()); // Maltese
50+
assert_eq!("ελληνικά", nameprep("ελληνικά").unwrap()); // Greek
3051
}
3152

3253
// 4.1 Map to nothing
3354
#[test]
3455
fn should_map_to_nothing() {
35-
let input = "foo\u{00ad}\u{034f}\u{1806}\u{180b}bar\u{200b}\u{2060}baz\u{fe00}\u{fe08}\u{fe0f}\u{feff}";
56+
let input =
57+
"foo\u{00ad}\u{034f}\u{1806}\u{180b}bar\u{200b}\u{2060}baz\u{fe00}\u{fe08}\u{fe0f}\u{feff}";
3658
assert_eq!("foobarbaz", nameprep(input).unwrap());
3759
}
3860

@@ -264,7 +286,10 @@ fn should_prohibit_mixed_randalcat() {
264286
// 4.42 Bidi: RandALCat character U+0627 U+0031 U+0628
265287
#[test]
266288
fn should_permit_randalcat2() {
267-
assert_eq!("\u{0627}\u{0031}\u{0628}", nameprep("\u{0627}\u{0031}\u{0628}").unwrap());
289+
assert_eq!(
290+
"\u{0627}\u{0031}\u{0628}",
291+
nameprep("\u{0627}\u{0031}\u{0628}").unwrap()
292+
);
268293
}
269294

270295
// 4.43 Unassigned code point U+E0002

tests/nodeprep_tests.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@ use stringprep::nodeprep;
55

66
#[test]
77
fn test_nodeprep() {
8-
assert_eq!("räksmörgås.josefsson.org", nodeprep("räksmörgås.josefßon.org").unwrap());
8+
assert_eq!(
9+
"räksmörgås.josefsson.org",
10+
nodeprep("räksmörgås.josefßon.org").unwrap()
11+
);
912
}

tests/saslprep_tests.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Integration tests from https://github.com/reklatsmasters/saslprep (MIT License)
22
extern crate stringprep;
33

4-
use stringprep::{Error, saslprep};
4+
use stringprep::{saslprep, Error};
55

66
fn assert_prohibited_character<T>(result: Result<T, Error>) {
77
assert!(result.is_err());
@@ -69,7 +69,10 @@ fn should_not_allow_prohibited_characters() {
6969

7070
#[test]
7171
fn randalcat_should_be_first_and_last() {
72-
assert_eq!(saslprep("\u{0627}\u{0031}\u{0628}").unwrap(), "\u{0627}\u{0031}\u{0628}");
72+
assert_eq!(
73+
saslprep("\u{0627}\u{0031}\u{0628}").unwrap(),
74+
"\u{0627}\u{0031}\u{0628}"
75+
);
7376
assert_prohibited_bidirectional_text(saslprep("\u{0627}\u{0031}"));
7477
}
7578

0 commit comments

Comments
 (0)