diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 5361cdb..57492f1 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -7,7 +7,11 @@ on: branches: [ master ] env: + CARGO_INCREMENTAL: 0 CARGO_TERM_COLOR: always + RUST_BACKTRACE: 1 + RUSTFLAGS: -D warnings + RUSTDOCFLAGS: -D warnings --cfg docsrs jobs: build: @@ -20,28 +24,50 @@ jobs: - nightly steps: - uses: actions/checkout@v2 - - name: Install latest nightly + - name: Install toolchain uses: actions-rs/toolchain@v1 with: toolchain: ${{ matrix.rust }} override: true - name: Build run: cargo build --verbose - - name: Run tests - run: cargo test --verbose + - name: Run tests with all features + run: cargo test --all-features --verbose - name: Run tests without features - run: cargo test --verbose --no-default-features + run: cargo test --no-default-features --verbose - name: Package run: cargo package - name: Test package run: cd $(find target/package/ -maxdepth 1 -mindepth 1 -type d) && cargo test - name: Test package without features run: cd $(find target/package/ -maxdepth 1 -mindepth 1 -type d) && cargo test --no-default-features + - name: Build docs + if: matrix.rust == 'nightly' + run: cargo doc --all-features --verbose + - name: Check formatting + if: matrix.rust == 'stable' + run: cargo fmt --all --check + - name: Check clippy + if: matrix.rust == 'stable' + run: cargo clippy --all-features --all --verbose + msrv: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install msrv toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: 1.36 + override: true + - name: Build + run: cargo build --verbose --all-features regen: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Regen run: cd scripts && python3 unicode.py - - name: Diff + - name: Diff tables run: diff src/tables.rs scripts/tables.rs + - name: Diff tests + run: diff tests/data/normalization_tests.rs scripts/normalization_tests.rs diff --git a/Cargo.toml b/Cargo.toml index 392bc7f..3545601 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,14 +2,23 @@ name = "unicode-normalization" version = "0.1.23" -authors = ["kwantam ", "Manish Goregaokar "] +authors = [ + "kwantam ", + "Manish Goregaokar ", +] homepage = "https://github.com/unicode-rs/unicode-normalization" repository = "https://github.com/unicode-rs/unicode-normalization" documentation = "https://docs.rs/unicode-normalization/" license = "MIT/Apache-2.0" -keywords = ["text", "unicode", "normalization", "decomposition", "recomposition"] +keywords = [ + "text", + "unicode", + "normalization", + "decomposition", + "recomposition", +] readme = "README.md" description = """ This crate provides functions for normalization of @@ -18,9 +27,11 @@ Decomposition and Recomposition, as described in Unicode Standard Annex #15. """ +rust-version = "1.36" + edition = "2018" -exclude = [ "target/*", "Cargo.lock", "scripts/tmp", "*.txt", "tests/*" ] +exclude = ["target/*", "Cargo.lock", "scripts/tmp", "*.txt", "tests/*"] [dependencies.tinyvec] version = "1" diff --git a/scripts/unicode.py b/scripts/unicode.py old mode 100644 new mode 100755 index 6c1bd3a..f40e411 --- a/scripts/unicode.py +++ b/scripts/unicode.py @@ -579,6 +579,7 @@ def minimal_perfect_hash(d): data = UnicodeData() with open("tables.rs", "w", newline = "\n") as out: out.write(PREAMBLE) + out.write("#![cfg_attr(rustfmt, rustfmt::skip)]\n") out.write("use crate::quick_check::IsNormalized;\n") out.write("use crate::quick_check::IsNormalized::*;\n") out.write("\n") diff --git a/src/__test_api.rs b/src/__test_api.rs index f1a3f92..6f6f35e 100644 --- a/src/__test_api.rs +++ b/src/__test_api.rs @@ -5,7 +5,7 @@ // If you're caught using this outside this crates tests/, you get to clean up the mess. #[cfg(not(feature = "std"))] -use crate::no_std_prelude::*; +use alloc::string::String; use crate::stream_safe::StreamSafe; diff --git a/src/lib.rs b/src/lib.rs index 21c3bf1..8cf4c4a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -62,12 +62,7 @@ pub use crate::recompose::Recompositions; pub use crate::replace::Replacements; pub use crate::stream_safe::StreamSafe; pub use crate::tables::UNICODE_VERSION; -use core::{ - str::Chars, - option, -}; - -mod no_std_prelude; +use core::{option, str::Chars}; mod decompose; mod lookups; @@ -169,7 +164,6 @@ impl<'a> UnicodeNormalization> for &'a str { } } - impl UnicodeNormalization> for char { #[inline] fn nfd(self) -> Decompositions> { diff --git a/src/no_std_prelude.rs b/src/no_std_prelude.rs deleted file mode 100755 index 838d122..0000000 --- a/src/no_std_prelude.rs +++ /dev/null @@ -1,6 +0,0 @@ -#[cfg(not(feature = "std"))] -pub use alloc::{ - str::Chars, - string::{String, ToString}, - vec::Vec, -}; diff --git a/src/normalize.rs b/src/normalize.rs index b144bd7..3d64a12 100644 --- a/src/normalize.rs +++ b/src/normalize.rs @@ -14,7 +14,7 @@ use crate::lookups::{ compatibility_fully_decomposed, composition_table, }; -use core::{char, ops::FnMut}; +use core::char; /// Compute canonical Unicode decomposition for character. /// See [Unicode Standard Annex #15](http://www.unicode.org/reports/tr15/) diff --git a/src/stream_safe.rs b/src/stream_safe.rs index 30fe810..8385cd2 100644 --- a/src/stream_safe.rs +++ b/src/stream_safe.rs @@ -110,7 +110,7 @@ mod tests { use crate::normalize::decompose_compatible; #[cfg(not(feature = "std"))] - use crate::no_std_prelude::*; + use alloc::{string::String, vec::Vec}; use core::char; diff --git a/src/tables.rs b/src/tables.rs index fd6d991..6c00bee 100644 --- a/src/tables.rs +++ b/src/tables.rs @@ -11,6 +11,7 @@ // NOTE: The following code was generated by "scripts/unicode.py", do not edit directly #![allow(missing_docs)] +#![cfg_attr(rustfmt, rustfmt::skip)] use crate::quick_check::IsNormalized; use crate::quick_check::IsNormalized::*; diff --git a/src/test.rs b/src/test.rs index 4c37149..cd1d958 100644 --- a/src/test.rs +++ b/src/test.rs @@ -13,7 +13,7 @@ use super::UnicodeNormalization; use core::char; #[cfg(not(feature = "std"))] -use crate::no_std_prelude::*; +use alloc::string::{String, ToString}; #[test] fn test_nfd() { diff --git a/tests/data/normalization_tests.rs b/tests/data/normalization_tests.rs index 2d19f6e..f569876 100644 --- a/tests/data/normalization_tests.rs +++ b/tests/data/normalization_tests.rs @@ -113162,6 +113162,440 @@ pub const NORMALIZATION_TESTS: &[NormalizationTest] = &[ nfkc: "\u{0039}", nfkd: "\u{0039}", }, + NormalizationTest { + source: "\u{1E030}", + nfc: "\u{1E030}", + nfd: "\u{1E030}", + nfkc: "\u{0430}", + nfkd: "\u{0430}", + }, + NormalizationTest { + source: "\u{1E031}", + nfc: "\u{1E031}", + nfd: "\u{1E031}", + nfkc: "\u{0431}", + nfkd: "\u{0431}", + }, + NormalizationTest { + source: "\u{1E032}", + nfc: "\u{1E032}", + nfd: "\u{1E032}", + nfkc: "\u{0432}", + nfkd: "\u{0432}", + }, + NormalizationTest { + source: "\u{1E033}", + nfc: "\u{1E033}", + nfd: "\u{1E033}", + nfkc: "\u{0433}", + nfkd: "\u{0433}", + }, + NormalizationTest { + source: "\u{1E034}", + nfc: "\u{1E034}", + nfd: "\u{1E034}", + nfkc: "\u{0434}", + nfkd: "\u{0434}", + }, + NormalizationTest { + source: "\u{1E035}", + nfc: "\u{1E035}", + nfd: "\u{1E035}", + nfkc: "\u{0435}", + nfkd: "\u{0435}", + }, + NormalizationTest { + source: "\u{1E036}", + nfc: "\u{1E036}", + nfd: "\u{1E036}", + nfkc: "\u{0436}", + nfkd: "\u{0436}", + }, + NormalizationTest { + source: "\u{1E037}", + nfc: "\u{1E037}", + nfd: "\u{1E037}", + nfkc: "\u{0437}", + nfkd: "\u{0437}", + }, + NormalizationTest { + source: "\u{1E038}", + nfc: "\u{1E038}", + nfd: "\u{1E038}", + nfkc: "\u{0438}", + nfkd: "\u{0438}", + }, + NormalizationTest { + source: "\u{1E039}", + nfc: "\u{1E039}", + nfd: "\u{1E039}", + nfkc: "\u{043A}", + nfkd: "\u{043A}", + }, + NormalizationTest { + source: "\u{1E03A}", + nfc: "\u{1E03A}", + nfd: "\u{1E03A}", + nfkc: "\u{043B}", + nfkd: "\u{043B}", + }, + NormalizationTest { + source: "\u{1E03B}", + nfc: "\u{1E03B}", + nfd: "\u{1E03B}", + nfkc: "\u{043C}", + nfkd: "\u{043C}", + }, + NormalizationTest { + source: "\u{1E03C}", + nfc: "\u{1E03C}", + nfd: "\u{1E03C}", + nfkc: "\u{043E}", + nfkd: "\u{043E}", + }, + NormalizationTest { + source: "\u{1E03D}", + nfc: "\u{1E03D}", + nfd: "\u{1E03D}", + nfkc: "\u{043F}", + nfkd: "\u{043F}", + }, + NormalizationTest { + source: "\u{1E03E}", + nfc: "\u{1E03E}", + nfd: "\u{1E03E}", + nfkc: "\u{0440}", + nfkd: "\u{0440}", + }, + NormalizationTest { + source: "\u{1E03F}", + nfc: "\u{1E03F}", + nfd: "\u{1E03F}", + nfkc: "\u{0441}", + nfkd: "\u{0441}", + }, + NormalizationTest { + source: "\u{1E040}", + nfc: "\u{1E040}", + nfd: "\u{1E040}", + nfkc: "\u{0442}", + nfkd: "\u{0442}", + }, + NormalizationTest { + source: "\u{1E041}", + nfc: "\u{1E041}", + nfd: "\u{1E041}", + nfkc: "\u{0443}", + nfkd: "\u{0443}", + }, + NormalizationTest { + source: "\u{1E042}", + nfc: "\u{1E042}", + nfd: "\u{1E042}", + nfkc: "\u{0444}", + nfkd: "\u{0444}", + }, + NormalizationTest { + source: "\u{1E043}", + nfc: "\u{1E043}", + nfd: "\u{1E043}", + nfkc: "\u{0445}", + nfkd: "\u{0445}", + }, + NormalizationTest { + source: "\u{1E044}", + nfc: "\u{1E044}", + nfd: "\u{1E044}", + nfkc: "\u{0446}", + nfkd: "\u{0446}", + }, + NormalizationTest { + source: "\u{1E045}", + nfc: "\u{1E045}", + nfd: "\u{1E045}", + nfkc: "\u{0447}", + nfkd: "\u{0447}", + }, + NormalizationTest { + source: "\u{1E046}", + nfc: "\u{1E046}", + nfd: "\u{1E046}", + nfkc: "\u{0448}", + nfkd: "\u{0448}", + }, + NormalizationTest { + source: "\u{1E047}", + nfc: "\u{1E047}", + nfd: "\u{1E047}", + nfkc: "\u{044B}", + nfkd: "\u{044B}", + }, + NormalizationTest { + source: "\u{1E048}", + nfc: "\u{1E048}", + nfd: "\u{1E048}", + nfkc: "\u{044D}", + nfkd: "\u{044D}", + }, + NormalizationTest { + source: "\u{1E049}", + nfc: "\u{1E049}", + nfd: "\u{1E049}", + nfkc: "\u{044E}", + nfkd: "\u{044E}", + }, + NormalizationTest { + source: "\u{1E04A}", + nfc: "\u{1E04A}", + nfd: "\u{1E04A}", + nfkc: "\u{A689}", + nfkd: "\u{A689}", + }, + NormalizationTest { + source: "\u{1E04B}", + nfc: "\u{1E04B}", + nfd: "\u{1E04B}", + nfkc: "\u{04D9}", + nfkd: "\u{04D9}", + }, + NormalizationTest { + source: "\u{1E04C}", + nfc: "\u{1E04C}", + nfd: "\u{1E04C}", + nfkc: "\u{0456}", + nfkd: "\u{0456}", + }, + NormalizationTest { + source: "\u{1E04D}", + nfc: "\u{1E04D}", + nfd: "\u{1E04D}", + nfkc: "\u{0458}", + nfkd: "\u{0458}", + }, + NormalizationTest { + source: "\u{1E04E}", + nfc: "\u{1E04E}", + nfd: "\u{1E04E}", + nfkc: "\u{04E9}", + nfkd: "\u{04E9}", + }, + NormalizationTest { + source: "\u{1E04F}", + nfc: "\u{1E04F}", + nfd: "\u{1E04F}", + nfkc: "\u{04AF}", + nfkd: "\u{04AF}", + }, + NormalizationTest { + source: "\u{1E050}", + nfc: "\u{1E050}", + nfd: "\u{1E050}", + nfkc: "\u{04CF}", + nfkd: "\u{04CF}", + }, + NormalizationTest { + source: "\u{1E051}", + nfc: "\u{1E051}", + nfd: "\u{1E051}", + nfkc: "\u{0430}", + nfkd: "\u{0430}", + }, + NormalizationTest { + source: "\u{1E052}", + nfc: "\u{1E052}", + nfd: "\u{1E052}", + nfkc: "\u{0431}", + nfkd: "\u{0431}", + }, + NormalizationTest { + source: "\u{1E053}", + nfc: "\u{1E053}", + nfd: "\u{1E053}", + nfkc: "\u{0432}", + nfkd: "\u{0432}", + }, + NormalizationTest { + source: "\u{1E054}", + nfc: "\u{1E054}", + nfd: "\u{1E054}", + nfkc: "\u{0433}", + nfkd: "\u{0433}", + }, + NormalizationTest { + source: "\u{1E055}", + nfc: "\u{1E055}", + nfd: "\u{1E055}", + nfkc: "\u{0434}", + nfkd: "\u{0434}", + }, + NormalizationTest { + source: "\u{1E056}", + nfc: "\u{1E056}", + nfd: "\u{1E056}", + nfkc: "\u{0435}", + nfkd: "\u{0435}", + }, + NormalizationTest { + source: "\u{1E057}", + nfc: "\u{1E057}", + nfd: "\u{1E057}", + nfkc: "\u{0436}", + nfkd: "\u{0436}", + }, + NormalizationTest { + source: "\u{1E058}", + nfc: "\u{1E058}", + nfd: "\u{1E058}", + nfkc: "\u{0437}", + nfkd: "\u{0437}", + }, + NormalizationTest { + source: "\u{1E059}", + nfc: "\u{1E059}", + nfd: "\u{1E059}", + nfkc: "\u{0438}", + nfkd: "\u{0438}", + }, + NormalizationTest { + source: "\u{1E05A}", + nfc: "\u{1E05A}", + nfd: "\u{1E05A}", + nfkc: "\u{043A}", + nfkd: "\u{043A}", + }, + NormalizationTest { + source: "\u{1E05B}", + nfc: "\u{1E05B}", + nfd: "\u{1E05B}", + nfkc: "\u{043B}", + nfkd: "\u{043B}", + }, + NormalizationTest { + source: "\u{1E05C}", + nfc: "\u{1E05C}", + nfd: "\u{1E05C}", + nfkc: "\u{043E}", + nfkd: "\u{043E}", + }, + NormalizationTest { + source: "\u{1E05D}", + nfc: "\u{1E05D}", + nfd: "\u{1E05D}", + nfkc: "\u{043F}", + nfkd: "\u{043F}", + }, + NormalizationTest { + source: "\u{1E05E}", + nfc: "\u{1E05E}", + nfd: "\u{1E05E}", + nfkc: "\u{0441}", + nfkd: "\u{0441}", + }, + NormalizationTest { + source: "\u{1E05F}", + nfc: "\u{1E05F}", + nfd: "\u{1E05F}", + nfkc: "\u{0443}", + nfkd: "\u{0443}", + }, + NormalizationTest { + source: "\u{1E060}", + nfc: "\u{1E060}", + nfd: "\u{1E060}", + nfkc: "\u{0444}", + nfkd: "\u{0444}", + }, + NormalizationTest { + source: "\u{1E061}", + nfc: "\u{1E061}", + nfd: "\u{1E061}", + nfkc: "\u{0445}", + nfkd: "\u{0445}", + }, + NormalizationTest { + source: "\u{1E062}", + nfc: "\u{1E062}", + nfd: "\u{1E062}", + nfkc: "\u{0446}", + nfkd: "\u{0446}", + }, + NormalizationTest { + source: "\u{1E063}", + nfc: "\u{1E063}", + nfd: "\u{1E063}", + nfkc: "\u{0447}", + nfkd: "\u{0447}", + }, + NormalizationTest { + source: "\u{1E064}", + nfc: "\u{1E064}", + nfd: "\u{1E064}", + nfkc: "\u{0448}", + nfkd: "\u{0448}", + }, + NormalizationTest { + source: "\u{1E065}", + nfc: "\u{1E065}", + nfd: "\u{1E065}", + nfkc: "\u{044A}", + nfkd: "\u{044A}", + }, + NormalizationTest { + source: "\u{1E066}", + nfc: "\u{1E066}", + nfd: "\u{1E066}", + nfkc: "\u{044B}", + nfkd: "\u{044B}", + }, + NormalizationTest { + source: "\u{1E067}", + nfc: "\u{1E067}", + nfd: "\u{1E067}", + nfkc: "\u{0491}", + nfkd: "\u{0491}", + }, + NormalizationTest { + source: "\u{1E068}", + nfc: "\u{1E068}", + nfd: "\u{1E068}", + nfkc: "\u{0456}", + nfkd: "\u{0456}", + }, + NormalizationTest { + source: "\u{1E069}", + nfc: "\u{1E069}", + nfd: "\u{1E069}", + nfkc: "\u{0455}", + nfkd: "\u{0455}", + }, + NormalizationTest { + source: "\u{1E06A}", + nfc: "\u{1E06A}", + nfd: "\u{1E06A}", + nfkc: "\u{045F}", + nfkd: "\u{045F}", + }, + NormalizationTest { + source: "\u{1E06B}", + nfc: "\u{1E06B}", + nfd: "\u{1E06B}", + nfkc: "\u{04AB}", + nfkd: "\u{04AB}", + }, + NormalizationTest { + source: "\u{1E06C}", + nfc: "\u{1E06C}", + nfd: "\u{1E06C}", + nfkc: "\u{A651}", + nfkd: "\u{A651}", + }, + NormalizationTest { + source: "\u{1E06D}", + nfc: "\u{1E06D}", + nfd: "\u{1E06D}", + nfkc: "\u{04B1}", + nfkd: "\u{04B1}", + }, NormalizationTest { source: "\u{1EE00}", nfc: "\u{1EE00}", @@ -129157,6 +129591,48 @@ pub const NORMALIZATION_TESTS: &[NormalizationTest] = &[ nfkc: "\u{0061}\u{05AE}\u{10EAC}\u{0300}\u{0315}\u{0062}", nfkd: "\u{0061}\u{05AE}\u{10EAC}\u{0300}\u{0315}\u{0062}", }, + NormalizationTest { + source: "\u{0061}\u{059A}\u{0316}\u{1DFA}\u{10EFD}\u{0062}", + nfc: "\u{0061}\u{1DFA}\u{0316}\u{10EFD}\u{059A}\u{0062}", + nfd: "\u{0061}\u{1DFA}\u{0316}\u{10EFD}\u{059A}\u{0062}", + nfkc: "\u{0061}\u{1DFA}\u{0316}\u{10EFD}\u{059A}\u{0062}", + nfkd: "\u{0061}\u{1DFA}\u{0316}\u{10EFD}\u{059A}\u{0062}", + }, + NormalizationTest { + source: "\u{0061}\u{10EFD}\u{059A}\u{0316}\u{1DFA}\u{0062}", + nfc: "\u{0061}\u{1DFA}\u{10EFD}\u{0316}\u{059A}\u{0062}", + nfd: "\u{0061}\u{1DFA}\u{10EFD}\u{0316}\u{059A}\u{0062}", + nfkc: "\u{0061}\u{1DFA}\u{10EFD}\u{0316}\u{059A}\u{0062}", + nfkd: "\u{0061}\u{1DFA}\u{10EFD}\u{0316}\u{059A}\u{0062}", + }, + NormalizationTest { + source: "\u{0061}\u{059A}\u{0316}\u{1DFA}\u{10EFE}\u{0062}", + nfc: "\u{0061}\u{1DFA}\u{0316}\u{10EFE}\u{059A}\u{0062}", + nfd: "\u{0061}\u{1DFA}\u{0316}\u{10EFE}\u{059A}\u{0062}", + nfkc: "\u{0061}\u{1DFA}\u{0316}\u{10EFE}\u{059A}\u{0062}", + nfkd: "\u{0061}\u{1DFA}\u{0316}\u{10EFE}\u{059A}\u{0062}", + }, + NormalizationTest { + source: "\u{0061}\u{10EFE}\u{059A}\u{0316}\u{1DFA}\u{0062}", + nfc: "\u{0061}\u{1DFA}\u{10EFE}\u{0316}\u{059A}\u{0062}", + nfd: "\u{0061}\u{1DFA}\u{10EFE}\u{0316}\u{059A}\u{0062}", + nfkc: "\u{0061}\u{1DFA}\u{10EFE}\u{0316}\u{059A}\u{0062}", + nfkd: "\u{0061}\u{1DFA}\u{10EFE}\u{0316}\u{059A}\u{0062}", + }, + NormalizationTest { + source: "\u{0061}\u{059A}\u{0316}\u{1DFA}\u{10EFF}\u{0062}", + nfc: "\u{0061}\u{1DFA}\u{0316}\u{10EFF}\u{059A}\u{0062}", + nfd: "\u{0061}\u{1DFA}\u{0316}\u{10EFF}\u{059A}\u{0062}", + nfkc: "\u{0061}\u{1DFA}\u{0316}\u{10EFF}\u{059A}\u{0062}", + nfkd: "\u{0061}\u{1DFA}\u{0316}\u{10EFF}\u{059A}\u{0062}", + }, + NormalizationTest { + source: "\u{0061}\u{10EFF}\u{059A}\u{0316}\u{1DFA}\u{0062}", + nfc: "\u{0061}\u{1DFA}\u{10EFF}\u{0316}\u{059A}\u{0062}", + nfd: "\u{0061}\u{1DFA}\u{10EFF}\u{0316}\u{059A}\u{0062}", + nfkc: "\u{0061}\u{1DFA}\u{10EFF}\u{0316}\u{059A}\u{0062}", + nfkd: "\u{0061}\u{1DFA}\u{10EFF}\u{0316}\u{059A}\u{0062}", + }, NormalizationTest { source: "\u{0061}\u{059A}\u{0316}\u{1DFA}\u{10F46}\u{0062}", nfc: "\u{0061}\u{1DFA}\u{0316}\u{10F46}\u{059A}\u{0062}", @@ -130165,6 +130641,34 @@ pub const NORMALIZATION_TESTS: &[NormalizationTest] = &[ nfkc: "\u{0061}\u{3099}\u{11D97}\u{094D}\u{05B0}\u{0062}", nfkd: "\u{0061}\u{3099}\u{11D97}\u{094D}\u{05B0}\u{0062}", }, + NormalizationTest { + source: "\u{0061}\u{05B0}\u{094D}\u{3099}\u{11F41}\u{0062}", + nfc: "\u{0061}\u{3099}\u{094D}\u{11F41}\u{05B0}\u{0062}", + nfd: "\u{0061}\u{3099}\u{094D}\u{11F41}\u{05B0}\u{0062}", + nfkc: "\u{0061}\u{3099}\u{094D}\u{11F41}\u{05B0}\u{0062}", + nfkd: "\u{0061}\u{3099}\u{094D}\u{11F41}\u{05B0}\u{0062}", + }, + NormalizationTest { + source: "\u{0061}\u{11F41}\u{05B0}\u{094D}\u{3099}\u{0062}", + nfc: "\u{0061}\u{3099}\u{11F41}\u{094D}\u{05B0}\u{0062}", + nfd: "\u{0061}\u{3099}\u{11F41}\u{094D}\u{05B0}\u{0062}", + nfkc: "\u{0061}\u{3099}\u{11F41}\u{094D}\u{05B0}\u{0062}", + nfkd: "\u{0061}\u{3099}\u{11F41}\u{094D}\u{05B0}\u{0062}", + }, + NormalizationTest { + source: "\u{0061}\u{05B0}\u{094D}\u{3099}\u{11F42}\u{0062}", + nfc: "\u{0061}\u{3099}\u{094D}\u{11F42}\u{05B0}\u{0062}", + nfd: "\u{0061}\u{3099}\u{094D}\u{11F42}\u{05B0}\u{0062}", + nfkc: "\u{0061}\u{3099}\u{094D}\u{11F42}\u{05B0}\u{0062}", + nfkd: "\u{0061}\u{3099}\u{094D}\u{11F42}\u{05B0}\u{0062}", + }, + NormalizationTest { + source: "\u{0061}\u{11F42}\u{05B0}\u{094D}\u{3099}\u{0062}", + nfc: "\u{0061}\u{3099}\u{11F42}\u{094D}\u{05B0}\u{0062}", + nfd: "\u{0061}\u{3099}\u{11F42}\u{094D}\u{05B0}\u{0062}", + nfkc: "\u{0061}\u{3099}\u{11F42}\u{094D}\u{05B0}\u{0062}", + nfkd: "\u{0061}\u{3099}\u{11F42}\u{094D}\u{05B0}\u{0062}", + }, NormalizationTest { source: "\u{0061}\u{16FF0}\u{0334}\u{16AF0}\u{0062}", nfc: "\u{0061}\u{0334}\u{16AF0}\u{16FF0}\u{0062}", @@ -131369,6 +131873,20 @@ pub const NORMALIZATION_TESTS: &[NormalizationTest] = &[ nfkc: "\u{0061}\u{05AE}\u{1E02A}\u{0300}\u{0315}\u{0062}", nfkd: "\u{0061}\u{05AE}\u{1E02A}\u{0300}\u{0315}\u{0062}", }, + NormalizationTest { + source: "\u{0061}\u{0315}\u{0300}\u{05AE}\u{1E08F}\u{0062}", + nfc: "\u{00E0}\u{05AE}\u{1E08F}\u{0315}\u{0062}", + nfd: "\u{0061}\u{05AE}\u{0300}\u{1E08F}\u{0315}\u{0062}", + nfkc: "\u{00E0}\u{05AE}\u{1E08F}\u{0315}\u{0062}", + nfkd: "\u{0061}\u{05AE}\u{0300}\u{1E08F}\u{0315}\u{0062}", + }, + NormalizationTest { + source: "\u{0061}\u{1E08F}\u{0315}\u{0300}\u{05AE}\u{0062}", + nfc: "\u{0061}\u{05AE}\u{1E08F}\u{0300}\u{0315}\u{0062}", + nfd: "\u{0061}\u{05AE}\u{1E08F}\u{0300}\u{0315}\u{0062}", + nfkc: "\u{0061}\u{05AE}\u{1E08F}\u{0300}\u{0315}\u{0062}", + nfkd: "\u{0061}\u{05AE}\u{1E08F}\u{0300}\u{0315}\u{0062}", + }, NormalizationTest { source: "\u{0061}\u{0315}\u{0300}\u{05AE}\u{1E130}\u{0062}", nfc: "\u{00E0}\u{05AE}\u{1E130}\u{0315}\u{0062}", @@ -131537,6 +132055,62 @@ pub const NORMALIZATION_TESTS: &[NormalizationTest] = &[ nfkc: "\u{0061}\u{05AE}\u{1E2EF}\u{0300}\u{0315}\u{0062}", nfkd: "\u{0061}\u{05AE}\u{1E2EF}\u{0300}\u{0315}\u{0062}", }, + NormalizationTest { + source: "\u{0061}\u{035C}\u{0315}\u{0300}\u{1E4EC}\u{0062}", + nfc: "\u{00E0}\u{0315}\u{1E4EC}\u{035C}\u{0062}", + nfd: "\u{0061}\u{0300}\u{0315}\u{1E4EC}\u{035C}\u{0062}", + nfkc: "\u{00E0}\u{0315}\u{1E4EC}\u{035C}\u{0062}", + nfkd: "\u{0061}\u{0300}\u{0315}\u{1E4EC}\u{035C}\u{0062}", + }, + NormalizationTest { + source: "\u{0061}\u{1E4EC}\u{035C}\u{0315}\u{0300}\u{0062}", + nfc: "\u{00E0}\u{1E4EC}\u{0315}\u{035C}\u{0062}", + nfd: "\u{0061}\u{0300}\u{1E4EC}\u{0315}\u{035C}\u{0062}", + nfkc: "\u{00E0}\u{1E4EC}\u{0315}\u{035C}\u{0062}", + nfkd: "\u{0061}\u{0300}\u{1E4EC}\u{0315}\u{035C}\u{0062}", + }, + NormalizationTest { + source: "\u{0061}\u{035C}\u{0315}\u{0300}\u{1E4ED}\u{0062}", + nfc: "\u{00E0}\u{0315}\u{1E4ED}\u{035C}\u{0062}", + nfd: "\u{0061}\u{0300}\u{0315}\u{1E4ED}\u{035C}\u{0062}", + nfkc: "\u{00E0}\u{0315}\u{1E4ED}\u{035C}\u{0062}", + nfkd: "\u{0061}\u{0300}\u{0315}\u{1E4ED}\u{035C}\u{0062}", + }, + NormalizationTest { + source: "\u{0061}\u{1E4ED}\u{035C}\u{0315}\u{0300}\u{0062}", + nfc: "\u{00E0}\u{1E4ED}\u{0315}\u{035C}\u{0062}", + nfd: "\u{0061}\u{0300}\u{1E4ED}\u{0315}\u{035C}\u{0062}", + nfkc: "\u{00E0}\u{1E4ED}\u{0315}\u{035C}\u{0062}", + nfkd: "\u{0061}\u{0300}\u{1E4ED}\u{0315}\u{035C}\u{0062}", + }, + NormalizationTest { + source: "\u{0061}\u{059A}\u{0316}\u{1DFA}\u{1E4EE}\u{0062}", + nfc: "\u{0061}\u{1DFA}\u{0316}\u{1E4EE}\u{059A}\u{0062}", + nfd: "\u{0061}\u{1DFA}\u{0316}\u{1E4EE}\u{059A}\u{0062}", + nfkc: "\u{0061}\u{1DFA}\u{0316}\u{1E4EE}\u{059A}\u{0062}", + nfkd: "\u{0061}\u{1DFA}\u{0316}\u{1E4EE}\u{059A}\u{0062}", + }, + NormalizationTest { + source: "\u{0061}\u{1E4EE}\u{059A}\u{0316}\u{1DFA}\u{0062}", + nfc: "\u{0061}\u{1DFA}\u{1E4EE}\u{0316}\u{059A}\u{0062}", + nfd: "\u{0061}\u{1DFA}\u{1E4EE}\u{0316}\u{059A}\u{0062}", + nfkc: "\u{0061}\u{1DFA}\u{1E4EE}\u{0316}\u{059A}\u{0062}", + nfkd: "\u{0061}\u{1DFA}\u{1E4EE}\u{0316}\u{059A}\u{0062}", + }, + NormalizationTest { + source: "\u{0061}\u{0315}\u{0300}\u{05AE}\u{1E4EF}\u{0062}", + nfc: "\u{00E0}\u{05AE}\u{1E4EF}\u{0315}\u{0062}", + nfd: "\u{0061}\u{05AE}\u{0300}\u{1E4EF}\u{0315}\u{0062}", + nfkc: "\u{00E0}\u{05AE}\u{1E4EF}\u{0315}\u{0062}", + nfkd: "\u{0061}\u{05AE}\u{0300}\u{1E4EF}\u{0315}\u{0062}", + }, + NormalizationTest { + source: "\u{0061}\u{1E4EF}\u{0315}\u{0300}\u{05AE}\u{0062}", + nfc: "\u{0061}\u{05AE}\u{1E4EF}\u{0300}\u{0315}\u{0062}", + nfd: "\u{0061}\u{05AE}\u{1E4EF}\u{0300}\u{0315}\u{0062}", + nfkc: "\u{0061}\u{05AE}\u{1E4EF}\u{0300}\u{0315}\u{0062}", + nfkd: "\u{0061}\u{05AE}\u{1E4EF}\u{0300}\u{0315}\u{0062}", + }, NormalizationTest { source: "\u{0061}\u{059A}\u{0316}\u{1DFA}\u{1E8D0}\u{0062}", nfc: "\u{0061}\u{1DFA}\u{0316}\u{1E8D0}\u{059A}\u{0062}", diff --git a/tests/test_streamsafe_regression.rs b/tests/test_streamsafe_regression.rs index d29cf52..cb95a67 100644 --- a/tests/test_streamsafe_regression.rs +++ b/tests/test_streamsafe_regression.rs @@ -1,14 +1,12 @@ -use unicode_normalization::{ - is_nfc, is_nfc_stream_safe, UnicodeNormalization, -}; - -#[test] -fn test_streamsafe_regression(){ - let input = "\u{342}".repeat(55) + &"\u{344}".repeat(3); - let nfc_ss = input.chars().nfc().stream_safe().collect::(); - - // The result should be NFC: - assert!(is_nfc(&nfc_ss)); - // and should be stream-safe: - assert!(is_nfc_stream_safe(&nfc_ss)) -} +use unicode_normalization::{is_nfc, is_nfc_stream_safe, UnicodeNormalization}; + +#[test] +fn test_streamsafe_regression() { + let input = "\u{342}".repeat(55) + &"\u{344}".repeat(3); + let nfc_ss = input.chars().nfc().stream_safe().collect::(); + + // The result should be NFC: + assert!(is_nfc(&nfc_ss)); + // and should be stream-safe: + assert!(is_nfc_stream_safe(&nfc_ss)) +}