mirror of
https://github.com/openharmony/third_party_rust_unicode-normalization.git
synced 2026-07-21 02:15:27 -04:00
Use method syntax in tests.
This commit is contained in:
@@ -14,7 +14,7 @@ fn main() {
|
||||
assert_eq!(compose('A','\u{30a}'), Some('Å'));
|
||||
|
||||
let s = "ÅΩ";
|
||||
let c = UnicodeNormalization::nfc(s).collect::<String>();
|
||||
let c = s.nfc().collect::<String>();
|
||||
assert_eq!(c, "ÅΩ");
|
||||
}
|
||||
```
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
//! assert_eq!(compose('A','\u{30a}'), Some('Å'));
|
||||
//!
|
||||
//! let s = "ÅΩ";
|
||||
//! let c = UnicodeNormalization::nfc(s).collect::<String>();
|
||||
//! let c = s.nfc().collect::<String>();
|
||||
//! assert_eq!(c, "ÅΩ");
|
||||
//! }
|
||||
//! ```
|
||||
|
||||
+5
-5
@@ -14,7 +14,7 @@ use super::str::UnicodeNormalization;
|
||||
fn test_nfd() {
|
||||
macro_rules! t {
|
||||
($input: expr, $expected: expr) => {
|
||||
assert_eq!(UnicodeNormalization::nfd($input).collect::<String>(), $expected);
|
||||
assert_eq!($input.nfd().collect::<String>(), $expected);
|
||||
}
|
||||
}
|
||||
t!("abc", "abc");
|
||||
@@ -33,7 +33,7 @@ fn test_nfd() {
|
||||
fn test_nfkd() {
|
||||
macro_rules! t {
|
||||
($input: expr, $expected: expr) => {
|
||||
assert_eq!(UnicodeNormalization::nfkd($input).collect::<String>(), $expected);
|
||||
assert_eq!($input.nfkd().collect::<String>(), $expected);
|
||||
}
|
||||
}
|
||||
t!("abc", "abc");
|
||||
@@ -52,7 +52,7 @@ fn test_nfkd() {
|
||||
fn test_nfc() {
|
||||
macro_rules! t {
|
||||
($input: expr, $expected: expr) => {
|
||||
assert_eq!(UnicodeNormalization::nfc($input).collect::<String>(), $expected);
|
||||
assert_eq!($input.nfc().collect::<String>(), $expected);
|
||||
}
|
||||
}
|
||||
t!("abc", "abc");
|
||||
@@ -72,7 +72,7 @@ fn test_nfc() {
|
||||
fn test_nfkc() {
|
||||
macro_rules! t {
|
||||
($input: expr, $expected: expr) => {
|
||||
assert_eq!(UnicodeNormalization::nfkc($input).collect::<String>(), $expected);
|
||||
assert_eq!($input.nfkc().collect::<String>(), $expected);
|
||||
}
|
||||
}
|
||||
t!("abc", "abc");
|
||||
@@ -92,7 +92,7 @@ fn test_nfkc() {
|
||||
fn test_official() {
|
||||
use testdata::TEST_NORM;
|
||||
macro_rules! normString {
|
||||
($fun: ident, $input: expr) => { UnicodeNormalization::$fun($input).collect::<String>() }
|
||||
($method: ident, $input: expr) => { $input.$method().collect::<String>() }
|
||||
}
|
||||
|
||||
for &(s1, s2, s3, s4, s5) in TEST_NORM {
|
||||
|
||||
Reference in New Issue
Block a user