From 94148b36dd8306a765c7207fbaa1e8cf3e09c960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nadir=20Fejzi=C4=87?= Date: Sat, 30 Sep 2023 14:50:53 +0200 Subject: [PATCH] feat: run snapshot tests dynamically in unimarkup-core crate (#105) * fix: move functions for dynamic testing to test_runner * fix: remove unused test from core crate * fix: use macro to generate path to crate's integration tests folder * fix: run core snap tests dynamically using custom test harness * fix: correct documentation for test_runner helper functions * fix: format code * fix: auto-fix linter issues * fix: use array of custom tests instead of vec * fix: use resolver v2 for workspace * fix: update icu to resolve incompatibilities * fix: snapshot test blocks and provide better snapshot info * fix: rename core snapshot testing function * fix: remove dbg! call * fix: use better name to indicate clone of variable --- Cargo.toml | 1 + commons/Cargo.toml | 8 +- commons/src/config/locale.rs | 4 +- commons/src/config/mod.rs | 8 +- commons/src/config/preamble.rs | 18 +-- commons/src/scanner/icu_data/any.rs | 2 - .../icu_data/fallback/likelysubtags_v1/mod.rs | 2 - .../fallback/likelysubtags_v1/und.rs.data | 1 - commons/src/scanner/icu_data/fallback/mod.rs | 2 - .../icu_data/fallback/parents_v1/mod.rs | 2 - .../icu_data/fallback/parents_v1/und.rs.data | 1 - .../icu_data/fallback/supplement/co_v1/mod.rs | 2 - .../fallback/supplement/co_v1/und.rs.data | 1 - .../icu_data/fallback/supplement/mod.rs | 2 - commons/src/scanner/icu_data/mod.rs | 2 - .../icu_data/segmenter/grapheme_v1/mod.rs | 2 - .../segmenter/grapheme_v1/und.rs.data | 1 - commons/src/scanner/icu_data/segmenter/mod.rs | 2 - commons/src/scanner/mod.rs | 34 ++--- commons/src/test_runner/mod.rs | 139 +++++++++++++++++- commons/src/test_runner/snap_test_runner.rs | 89 +++-------- commons/src/test_runner/spec_test.rs | 30 ---- commons/src/test_runner/test_file.rs | 25 ++-- core/Cargo.toml | 6 + core/tests/elements/heading.rs | 1 - core/tests/elements/inline.rs | 1 - core/tests/general/metadata.rs | 3 +- core/tests/general/unimarkup.rs | 3 +- core/tests/runner/mod.rs | 94 ++++++++++++ core/tests/snapshot/mod.rs | 36 +++++ .../tests/{elements => snapshot}/paragraph.rs | 2 +- core/tests/spec/markup/blocks/enclosed.yml | 17 --- .../paragraph/paragraph-with-inlines.snap | 4 +- .../blocks/paragraph/simple-paragraph.snap | 4 +- core/tests/test_runner/mod.rs | 112 -------------- core/tests/tests.rs | 47 ++++-- inline/src/inlines/substitute.rs | 2 +- inline/tests/lexer/mod.rs | 23 ++- inline/tests/mod.rs | 129 ---------------- inline/tests/parser/mod.rs | 22 ++- .../snapshots/lexer/bold/bold-in-middle.snap | 2 +- .../snapshots/lexer/bold/bold-not-bold.snap | 2 +- .../snapshots/lexer/bold/escaped-bold.snap | 2 +- .../spec/snapshots/lexer/bold/not-bold.snap | 2 +- .../snapshots/lexer/bold/not-closed-bold.snap | 2 +- .../snapshots/lexer/bold/not-opened-bold.snap | 2 +- .../snapshots/lexer/bold/simple-bold.snap | 2 +- .../lexer/plain/breaking-unicode.snap | 2 +- .../snapshots/lexer/plain/simple-plain.snap | 2 +- .../lexer/verbatim/escaped-verbatim.snap | 2 +- .../lexer/verbatim/not-closed-verbatim.snap | 2 +- .../lexer/verbatim/not-opened-verbatim.snap | 2 +- .../lexer/verbatim/not-verbatim.snap | 2 +- .../lexer/verbatim/simple-verbatim.snap | 2 +- .../lexer/verbatim/verbatim-in-middle.snap | 2 +- .../lexer/verbatim/verbatim-not-verbatim.snap | 2 +- .../snapshots/parser/bold/bold-in-middle.snap | 2 +- .../snapshots/parser/bold/bold-not-bold.snap | 2 +- .../snapshots/parser/bold/escaped-bold.snap | 2 +- .../spec/snapshots/parser/bold/not-bold.snap | 2 +- .../parser/bold/not-closed-bold.snap | 2 +- .../parser/bold/not-opened-bold.snap | 2 +- .../snapshots/parser/bold/simple-bold.snap | 2 +- .../parser/plain/breaking-unicode.snap | 2 +- .../snapshots/parser/plain/simple-plain.snap | 2 +- .../parser/verbatim/escaped-verbatim.snap | 2 +- .../parser/verbatim/not-closed-verbatim.snap | 2 +- .../parser/verbatim/not-opened-verbatim.snap | 2 +- .../parser/verbatim/not-verbatim.snap | 2 +- .../parser/verbatim/simple-verbatim.snap | 2 +- .../parser/verbatim/verbatim-in-middle.snap | 2 +- .../verbatim/verbatim-not-verbatim.snap | 2 +- parser/src/elements/atomic/heading.rs | 8 +- parser/src/elements/enclosed/verbatim.rs | 8 +- parser/src/parser.rs | 4 +- render/src/render.rs | 2 +- 76 files changed, 446 insertions(+), 524 deletions(-) delete mode 100644 commons/src/scanner/icu_data/any.rs delete mode 100644 commons/src/scanner/icu_data/fallback/likelysubtags_v1/mod.rs delete mode 100644 commons/src/scanner/icu_data/fallback/likelysubtags_v1/und.rs.data delete mode 100644 commons/src/scanner/icu_data/fallback/mod.rs delete mode 100644 commons/src/scanner/icu_data/fallback/parents_v1/mod.rs delete mode 100644 commons/src/scanner/icu_data/fallback/parents_v1/und.rs.data delete mode 100644 commons/src/scanner/icu_data/fallback/supplement/co_v1/mod.rs delete mode 100644 commons/src/scanner/icu_data/fallback/supplement/co_v1/und.rs.data delete mode 100644 commons/src/scanner/icu_data/fallback/supplement/mod.rs delete mode 100644 commons/src/scanner/icu_data/mod.rs delete mode 100644 commons/src/scanner/icu_data/segmenter/grapheme_v1/mod.rs delete mode 100644 commons/src/scanner/icu_data/segmenter/grapheme_v1/und.rs.data delete mode 100644 commons/src/scanner/icu_data/segmenter/mod.rs delete mode 100644 core/tests/elements/heading.rs delete mode 100644 core/tests/elements/inline.rs create mode 100644 core/tests/runner/mod.rs create mode 100644 core/tests/snapshot/mod.rs rename core/tests/{elements => snapshot}/paragraph.rs (95%) delete mode 100644 core/tests/spec/markup/blocks/enclosed.yml delete mode 100644 core/tests/test_runner/mod.rs diff --git a/Cargo.toml b/Cargo.toml index 66960b0c..e1d6971a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ members = [ "parser", "render", ] +resolver = "2" # Compile snapshot testing library "insta" with "release" flag so that it runs # faster diff --git a/commons/Cargo.toml b/commons/Cargo.toml index e8c17433..2d07fb75 100644 --- a/commons/Cargo.toml +++ b/commons/Cargo.toml @@ -19,12 +19,10 @@ serde.workspace = true serde_json.workspace = true serde_yaml.workspace = true once_cell = { workspace = true, optional = true } -icu = "=1.2.0" -zerovec = "0.9.4" -icu_provider = "=1.2.0" -icu_provider_adapters = "=1.2.0" +icu_segmenter = "1.3.0" +icu_locid = "1.3.0" regex = { version = "1.8.1", optional = true } -insta = {version = "1.29.0", features = ["serde"], optional = true} +insta = { version = "1.29.0", features = ["serde"], optional = true } [features] test_runner = ["dep:regex", "dep:once_cell", "dep:insta"] diff --git a/commons/src/config/locale.rs b/commons/src/config/locale.rs index 190ea5f7..4208ca5e 100644 --- a/commons/src/config/locale.rs +++ b/commons/src/config/locale.rs @@ -1,5 +1,5 @@ pub mod serde { - use icu::locid::Locale; + use icu_locid::Locale; use serde::{Deserialize, Deserializer, Serializer}; pub mod single { @@ -70,7 +70,7 @@ pub mod serde { } pub mod clap { - pub fn parse_locale(input: &str) -> Result { + pub fn parse_locale(input: &str) -> Result { input.parse().map_err(|err| { clap::Error::raw( clap::error::ErrorKind::InvalidValue, diff --git a/commons/src/config/mod.rs b/commons/src/config/mod.rs index ae7a6853..839e0b21 100644 --- a/commons/src/config/mod.rs +++ b/commons/src/config/mod.rs @@ -1,12 +1,12 @@ use std::{collections::HashSet, path::PathBuf}; -use clap::{crate_authors, Args, Parser}; +use clap::{Args, Parser}; use logid::err; use serde::{Deserialize, Serialize}; use self::{log_id::ConfigErr, output::Output, preamble::Preamble}; -pub use icu::locid; +pub use icu_locid; pub mod locale; pub mod log_id; @@ -43,7 +43,7 @@ pub trait ConfigFns { } #[derive(Parser, Debug, PartialEq, Eq, Clone, Default, Serialize, Deserialize)] -#[command(name = UNIMARKUP_NAME, help_template = HELP_TEMPLATE, author = crate_authors!(", "), version, about = ABOUT, long_about = None)] +#[command(name = UNIMARKUP_NAME, help_template = HELP_TEMPLATE, author, version, about = ABOUT, long_about = None)] pub struct Config { #[command(flatten)] pub preamble: Preamble, @@ -112,7 +112,7 @@ where format!("HashSet conversion failed with: {:?}", err), ) }); - Ok(HashSet::from_iter(entries?.into_iter())) + Ok(HashSet::from_iter(entries?)) } // Define extension trait diff --git a/commons/src/config/preamble.rs b/commons/src/config/preamble.rs index a1671e18..5e644850 100644 --- a/commons/src/config/preamble.rs +++ b/commons/src/config/preamble.rs @@ -4,7 +4,7 @@ use std::{ }; use clap::Args; -use icu::locid::Locale; +use icu_locid::Locale; use logid::err; use serde::{Deserialize, Serialize}; @@ -55,7 +55,7 @@ pub struct I18n { impl ConfigFns for I18n { fn merge(&mut self, other: Self) { - self.output_langs.extend(other.output_langs.into_iter()); + self.output_langs.extend(other.output_langs); } fn validate(&self) -> Result<(), ConfigErr> { @@ -79,8 +79,8 @@ pub struct RenderConfig { impl ConfigFns for RenderConfig { fn merge(&mut self, other: Self) { - self.ignore.extend(other.ignore.into_iter()); - self.parameter.extend(other.parameter.into_iter()); + self.ignore.extend(other.ignore); + self.parameter.extend(other.parameter); } fn validate(&self) -> Result<(), ConfigErr> { @@ -103,7 +103,7 @@ pub struct Citedata { impl ConfigFns for Citedata { fn merge(&mut self, other: Self) { self.style.replace_none(other.style); - self.references.extend(other.references.into_iter()); + self.references.extend(other.references); } fn validate(&self) -> Result<(), ConfigErr> { @@ -146,8 +146,8 @@ pub struct Metadata { impl ConfigFns for Metadata { fn merge(&mut self, other: Self) { self.title.replace_none(other.title); - self.authors.extend(other.authors.into_iter()); - self.fonts.extend(other.fonts.into_iter()); + self.authors.extend(other.authors); + self.fonts.extend(other.fonts); // Note: `base` and `description` must not be merged with sub-configs according to specification. } @@ -184,8 +184,8 @@ pub struct HtmlSpecificParameter { impl ConfigFns for HtmlSpecificParameter { fn merge(&mut self, other: Self) { - self.favicons.extend(other.favicons.into_iter()); - self.keywords.extend(other.keywords.into_iter()); + self.favicons.extend(other.favicons); + self.keywords.extend(other.keywords); } fn validate(&self) -> Result<(), ConfigErr> { diff --git a/commons/src/scanner/icu_data/any.rs b/commons/src/scanner/icu_data/any.rs deleted file mode 100644 index 6fedf866..00000000 --- a/commons/src/scanner/icu_data/any.rs +++ /dev/null @@ -1,2 +0,0 @@ -// @generated -impl_any_provider ! (BakedDataProvider) ; \ No newline at end of file diff --git a/commons/src/scanner/icu_data/fallback/likelysubtags_v1/mod.rs b/commons/src/scanner/icu_data/fallback/likelysubtags_v1/mod.rs deleted file mode 100644 index 02592b80..00000000 --- a/commons/src/scanner/icu_data/fallback/likelysubtags_v1/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -// @generated -type DataStruct = < :: icu_provider_adapters :: fallback :: provider :: LocaleFallbackLikelySubtagsV1Marker as :: icu_provider :: DataMarker > :: Yokeable ; pub fn lookup (locale : & icu_provider :: DataLocale) -> Option < & 'static DataStruct > { locale . is_empty () . then (|| & UND) } static UND : DataStruct = include ! ("und.rs.data") ; \ No newline at end of file diff --git a/commons/src/scanner/icu_data/fallback/likelysubtags_v1/und.rs.data b/commons/src/scanner/icu_data/fallback/likelysubtags_v1/und.rs.data deleted file mode 100644 index 5dfb677f..00000000 --- a/commons/src/scanner/icu_data/fallback/likelysubtags_v1/und.rs.data +++ /dev/null @@ -1 +0,0 @@ -:: icu_provider_adapters :: fallback :: provider :: LocaleFallbackLikelySubtagsV1 { l2s : unsafe { # [allow (unused_unsafe)] :: zerovec :: ZeroMap :: from_parts_unchecked (unsafe { :: zerovec :: ZeroVec :: from_bytes_unchecked (b"am\0ar\0as\0be\0bg\0bgcbhobn\0brxchrcv\0doiel\0fa\0gu\0he\0hi\0hy\0ja\0ka\0kk\0km\0kn\0ko\0kokks\0ky\0lo\0maimk\0ml\0mn\0mnimr\0my\0ne\0or\0pa\0ps\0rajru\0sa\0satsd\0si\0sr\0ta\0te\0tg\0th\0ti\0tt\0uk\0ur\0yuezh\0") } , unsafe { :: zerovec :: ZeroVec :: from_bytes_unchecked (b"EthiArabBengCyrlCyrlDevaDevaBengDevaCherCyrlDevaGrekArabGujrHebrDevaArmnJpanGeorCyrlKhmrKndaKoreDevaArabCyrlLaooDevaCyrlMlymCyrlBengDevaMymrDevaOryaGuruArabDevaCyrlDevaOlckArabSinhCyrlTamlTeluCyrlThaiEthiCyrlCyrlArabHantHans") }) } , lr2s : unsafe { # [allow (unused_unsafe)] :: zerovec :: ZeroMap2d :: from_parts_unchecked (unsafe { :: zerovec :: ZeroVec :: from_bytes_unchecked (b"az\0ha\0kk\0ky\0mn\0ms\0pa\0sd\0sr\0tg\0uz\0yuezh\0") } , unsafe { :: zerovec :: ZeroVec :: from_bytes_unchecked (b"\x03\0\0\0\x05\0\0\0\t\0\0\0\x0B\0\0\0\x0C\0\0\0\r\0\0\0\x0E\0\0\0\x0F\0\0\0\x13\0\0\0\x14\0\0\0\x16\0\0\0\x17\0\0\0&\0\0\0") } , unsafe { :: zerovec :: ZeroVec :: from_bytes_unchecked (b"IQ\0IR\0RU\0CM\0SD\0AF\0CN\0IR\0MN\0CN\0TR\0CN\0CC\0PK\0IN\0ME\0RO\0RU\0TR\0PK\0AF\0CN\0CN\0AU\0BN\0GB\0GF\0HK\0ID\0MO\0PA\0PF\0PH\0SR\0TH\0TW\0US\0VN\0") } , unsafe { :: zerovec :: ZeroVec :: from_bytes_unchecked (b"ArabArabCyrlArabArabArabArabArabArabArabLatnMongArabArabDevaLatnLatnLatnLatnArabArabCyrlHansHantHantHantHantHantHantHantHantHantHantHantHantHantHantHant") }) } , l2r : unsafe { # [allow (unused_unsafe)] :: zerovec :: ZeroMap :: from_parts_unchecked (unsafe { :: zerovec :: ZeroVec :: from_bytes_unchecked (b"af\0am\0ar\0as\0astaz\0be\0bg\0bgcbhobn\0br\0brxbs\0ca\0cebchrcs\0cv\0cy\0da\0de\0doidsbel\0en\0es\0et\0eu\0fa\0ff\0fi\0filfo\0fr\0ga\0gd\0gl\0gu\0ha\0he\0hi\0hr\0hsbhu\0hy\0ia\0id\0ig\0is\0it\0ja\0jv\0ka\0keakgpkk\0km\0kn\0ko\0kokks\0ky\0lo\0lt\0lv\0maimi\0mk\0ml\0mn\0mnimr\0ms\0my\0ne\0nl\0nn\0no\0or\0pa\0pcmpl\0ps\0pt\0qu\0rajrm\0ro\0ru\0sa\0satsc\0sd\0si\0sk\0sl\0so\0sq\0sr\0su\0sv\0sw\0ta\0te\0tg\0th\0ti\0tk\0to\0tr\0tt\0uk\0ur\0uz\0vi\0wo\0xh\0yo\0yrlyuezh\0zu\0") } , unsafe { :: zerovec :: ZeroVec :: from_bytes_unchecked (b"ZA\0ET\0EG\0IN\0ES\0AZ\0BY\0BG\0IN\0IN\0BD\0FR\0IN\0BA\0ES\0PH\0US\0CZ\0RU\0GB\0DK\0DE\0IN\0DE\0GR\0US\0ES\0EE\0ES\0IR\0SN\0FI\0PH\0FO\0FR\0IE\0GB\0ES\0IN\0NG\0IL\0IN\0HR\0DE\0HU\0AM\x00001ID\0NG\0IS\0IT\0JP\0ID\0GE\0CV\0BR\0KZ\0KH\0IN\0KR\0IN\0IN\0KG\0LA\0LT\0LV\0IN\0NZ\0MK\0IN\0MN\0IN\0IN\0MY\0MM\0NP\0NL\0NO\0NO\0IN\0IN\0NG\0PL\0AF\0BR\0PE\0IN\0CH\0RO\0RU\0IN\0IN\0IT\0PK\0LK\0SK\0SI\0SO\0AL\0RS\0ID\0SE\0TZ\0IN\0IN\0TJ\0TH\0ET\0TM\0TO\0TR\0RU\0UA\0PK\0UZ\0VN\0SN\0ZA\0NG\0BR\0HK\0CN\0ZA\0") }) } , ls2r : unsafe { # [allow (unused_unsafe)] :: zerovec :: ZeroMap2d :: from_parts_unchecked (unsafe { :: zerovec :: ZeroVec :: from_bytes_unchecked (b"az\0en\0ff\0kk\0ky\0mn\0pa\0sd\0tg\0uz\0yuezh\0") } , unsafe { :: zerovec :: ZeroVec :: from_bytes_unchecked (b"\x01\0\0\0\x02\0\0\0\x03\0\0\0\x04\0\0\0\x06\0\0\0\x07\0\0\0\x08\0\0\0\x0B\0\0\0\x0C\0\0\0\r\0\0\0\x0E\0\0\0\x11\0\0\0") } , unsafe { :: zerovec :: ZeroVec :: from_bytes_unchecked (b"ArabShawAdlmArabArabLatnMongArabDevaKhojSindArabArabHansBopoHanbHant") } , unsafe { :: zerovec :: ZeroVec :: from_bytes_unchecked (b"IR\0GB\0GN\0CN\0CN\0TR\0CN\0PK\0IN\0IN\0IN\0PK\0AF\0CN\0TW\0TW\0TW\0") }) } , } \ No newline at end of file diff --git a/commons/src/scanner/icu_data/fallback/mod.rs b/commons/src/scanner/icu_data/fallback/mod.rs deleted file mode 100644 index 46529525..00000000 --- a/commons/src/scanner/icu_data/fallback/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -// @generated -pub mod likelysubtags_v1 ; pub mod parents_v1 ; pub mod supplement ; \ No newline at end of file diff --git a/commons/src/scanner/icu_data/fallback/parents_v1/mod.rs b/commons/src/scanner/icu_data/fallback/parents_v1/mod.rs deleted file mode 100644 index 7d2b4206..00000000 --- a/commons/src/scanner/icu_data/fallback/parents_v1/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -// @generated -type DataStruct = < :: icu_provider_adapters :: fallback :: provider :: LocaleFallbackParentsV1Marker as :: icu_provider :: DataMarker > :: Yokeable ; pub fn lookup (locale : & icu_provider :: DataLocale) -> Option < & 'static DataStruct > { locale . is_empty () . then (|| & UND) } static UND : DataStruct = include ! ("und.rs.data") ; \ No newline at end of file diff --git a/commons/src/scanner/icu_data/fallback/parents_v1/und.rs.data b/commons/src/scanner/icu_data/fallback/parents_v1/und.rs.data deleted file mode 100644 index 817c1dd1..00000000 --- a/commons/src/scanner/icu_data/fallback/parents_v1/und.rs.data +++ /dev/null @@ -1 +0,0 @@ -:: icu_provider_adapters :: fallback :: provider :: LocaleFallbackParentsV1 { parents : unsafe { # [allow (unused_unsafe)] :: zerovec :: ZeroMap :: from_parts_unchecked (unsafe { :: zerovec :: VarZeroVec :: from_bytes_unchecked (b"\x84\0\0\0\0\0\x06\0\x0B\0\x10\0\x15\0\x1A\0\x1F\0$\0)\0.\x003\08\0=\0B\0G\0L\0Q\0V\0[\0`\0e\0j\0o\0t\0y\0~\0\x83\0\x88\0\x8D\0\x92\0\x97\0\x9C\0\xA1\0\xA6\0\xAB\0\xB0\0\xB5\0\xBA\0\xBF\0\xC4\0\xC9\0\xCE\0\xD3\0\xD8\0\xDD\0\xE2\0\xE7\0\xEC\0\xF1\0\xF6\0\xFB\0\0\x01\x05\x01\n\x01\x0F\x01\x14\x01\x19\x01\x1E\x01#\x01(\x01-\x012\x017\x01<\x01A\x01F\x01K\x01P\x01U\x01Z\x01_\x01d\x01i\x01n\x01s\x01x\x01}\x01\x82\x01\x87\x01\x8C\x01\x91\x01\x96\x01\x9B\x01\xA0\x01\xA5\x01\xAA\x01\xAF\x01\xB4\x01\xB9\x01\xBE\x01\xC3\x01\xC8\x01\xCD\x01\xD2\x01\xD7\x01\xDC\x01\xE1\x01\xE6\x01\xEB\x01\xF0\x01\xF5\x01\xFA\x01\xFF\x01\x04\x02\t\x02\x0E\x02\x13\x02\x18\x02\x1D\x02\"\x02'\x02,\x021\x026\x02;\x02@\x02G\x02I\x02K\x02M\x02R\x02W\x02\\\x02a\x02f\x02k\x02p\x02u\x02z\x02\x7F\x02\x84\x02\x89\x02en-150en-AGen-AIen-ATen-AUen-BBen-BEen-BMen-BSen-BWen-BZen-CCen-CHen-CKen-CMen-CXen-CYen-DEen-DGen-DKen-DMen-ERen-FIen-FJen-FKen-FMen-GBen-GDen-GGen-GHen-GIen-GMen-GYen-HKen-IEen-ILen-IMen-INen-IOen-JEen-JMen-KEen-KIen-KNen-KYen-LCen-LRen-LSen-MGen-MOen-MSen-MTen-MUen-MVen-MWen-MYen-NAen-NFen-NGen-NLen-NRen-NUen-NZen-PGen-PKen-PNen-PWen-RWen-SBen-SCen-SDen-SEen-SGen-SHen-SIen-SLen-SSen-SXen-SZen-TCen-TKen-TOen-TTen-TVen-TZen-UGen-VCen-VGen-VUen-WSen-ZAen-ZMen-ZWes-ARes-BOes-BRes-BZes-CLes-COes-CRes-CUes-DOes-ECes-GTes-HNes-MXes-NIes-PAes-PEes-PRes-PYes-SVes-USes-UYes-VEhi-Latnhtnbnnno-NOpt-AOpt-CHpt-CVpt-FRpt-GQpt-GWpt-LUpt-MOpt-MZpt-STpt-TLzh-Hant-MO") } , unsafe { :: zerovec :: ZeroVec :: from_bytes_unchecked (b"en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01150en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01150en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01150en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01150en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01150en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01150en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01150en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01150en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01150en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001en\0\0\0\0\0\0\x01001es\0\0\0\0\0\0\x01419es\0\0\0\0\0\0\x01419es\0\0\0\0\0\0\x01419es\0\0\0\0\0\0\x01419es\0\0\0\0\0\0\x01419es\0\0\0\0\0\0\x01419es\0\0\0\0\0\0\x01419es\0\0\0\0\0\0\x01419es\0\0\0\0\0\0\x01419es\0\0\0\0\0\0\x01419es\0\0\0\0\0\0\x01419es\0\0\0\0\0\0\x01419es\0\0\0\0\0\0\x01419es\0\0\0\0\0\0\x01419es\0\0\0\0\0\0\x01419es\0\0\0\0\0\0\x01419es\0\0\0\0\0\0\x01419es\0\0\0\0\0\0\x01419es\0\0\0\0\0\0\x01419es\0\0\0\0\0\0\x01419es\0\0\0\0\0\0\x01419es\0\0\0\0\0\0\x01419en\0\0\0\0\0\0\x01IN\0fr\0\0\0\0\0\0\x01HT\0no\0\0\0\0\0\0\0\0\0\0no\0\0\0\0\0\0\0\0\0\0no\0\0\0\0\0\0\0\0\0\0pt\0\0\0\0\0\0\x01PT\0pt\0\0\0\0\0\0\x01PT\0pt\0\0\0\0\0\0\x01PT\0pt\0\0\0\0\0\0\x01PT\0pt\0\0\0\0\0\0\x01PT\0pt\0\0\0\0\0\0\x01PT\0pt\0\0\0\0\0\0\x01PT\0pt\0\0\0\0\0\0\x01PT\0pt\0\0\0\0\0\0\x01PT\0pt\0\0\0\0\0\0\x01PT\0pt\0\0\0\0\0\0\x01PT\0zh\0\x01Hant\x01HK\0") }) } , } \ No newline at end of file diff --git a/commons/src/scanner/icu_data/fallback/supplement/co_v1/mod.rs b/commons/src/scanner/icu_data/fallback/supplement/co_v1/mod.rs deleted file mode 100644 index abf03206..00000000 --- a/commons/src/scanner/icu_data/fallback/supplement/co_v1/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -// @generated -type DataStruct = < :: icu_provider_adapters :: fallback :: provider :: CollationFallbackSupplementV1Marker as :: icu_provider :: DataMarker > :: Yokeable ; pub fn lookup (locale : & icu_provider :: DataLocale) -> Option < & 'static DataStruct > { locale . is_empty () . then (|| & UND) } static UND : DataStruct = include ! ("und.rs.data") ; \ No newline at end of file diff --git a/commons/src/scanner/icu_data/fallback/supplement/co_v1/und.rs.data b/commons/src/scanner/icu_data/fallback/supplement/co_v1/und.rs.data deleted file mode 100644 index 61e586d3..00000000 --- a/commons/src/scanner/icu_data/fallback/supplement/co_v1/und.rs.data +++ /dev/null @@ -1 +0,0 @@ -:: icu_provider_adapters :: fallback :: provider :: LocaleFallbackSupplementV1 { parents : unsafe { # [allow (unused_unsafe)] :: zerovec :: ZeroMap :: from_parts_unchecked (unsafe { :: zerovec :: VarZeroVec :: from_bytes_unchecked (b"\x01\0\0\0\0\0yue") } , unsafe { :: zerovec :: ZeroVec :: from_bytes_unchecked (b"zh\0\x01Hant\0\0\0\0") }) } , unicode_extension_defaults : unsafe { # [allow (unused_unsafe)] :: zerovec :: ZeroMap2d :: from_parts_unchecked (unsafe { :: zerovec :: ZeroVec :: from_bytes_unchecked (b"co") } , unsafe { :: zerovec :: ZeroVec :: from_bytes_unchecked (b"\x02\0\0\0") } , unsafe { :: zerovec :: VarZeroVec :: from_bytes_unchecked (b"\x02\0\0\0\0\0\x02\0zhzh-Hant") } , unsafe { :: zerovec :: VarZeroVec :: from_bytes_unchecked (b"\x02\0\0\0\0\0\x06\0pinyinstroke") }) } , } \ No newline at end of file diff --git a/commons/src/scanner/icu_data/fallback/supplement/mod.rs b/commons/src/scanner/icu_data/fallback/supplement/mod.rs deleted file mode 100644 index c48b8225..00000000 --- a/commons/src/scanner/icu_data/fallback/supplement/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -// @generated -pub mod co_v1 ; \ No newline at end of file diff --git a/commons/src/scanner/icu_data/mod.rs b/commons/src/scanner/icu_data/mod.rs deleted file mode 100644 index 4f6998a0..00000000 --- a/commons/src/scanner/icu_data/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -// @generated -# [clippy :: msrv = "1.61"] mod fallback ; # [clippy :: msrv = "1.61"] mod segmenter ; # [clippy :: msrv = "1.61"] use :: icu_provider :: prelude :: * ; # [doc = r" Implement [`DataProvider`] on the given struct using the data"] # [doc = r" hardcoded in this module. This allows the struct to be used with"] # [doc = r" `icu`'s `_unstable` constructors."] # [doc = r""] # [doc = r" This macro can only be called from its definition-site, i.e. right"] # [doc = r" after `include!`-ing the generated module."] # [doc = r""] # [doc = r" ```compile_fail"] # [doc = r" struct MyDataProvider;"] # [doc = r#" include!("/path/to/generated/mod.rs");"#] # [doc = r" impl_data_provider(MyDataProvider);"] # [doc = r" ```"] # [allow (unused_macros)] macro_rules ! impl_data_provider { ($ provider : path) => { # [clippy :: msrv = "1.61"] impl DataProvider < :: icu_provider_adapters :: fallback :: provider :: CollationFallbackSupplementV1Marker > for $ provider { fn load (& self , req : DataRequest ,) -> Result < DataResponse < :: icu_provider_adapters :: fallback :: provider :: CollationFallbackSupplementV1Marker > , DataError > { fallback :: supplement :: co_v1 :: lookup (& req . locale) . map (zerofrom :: ZeroFrom :: zero_from) . map (DataPayload :: from_owned) . map (| payload | { DataResponse { metadata : Default :: default () , payload : Some (payload) , } }) . ok_or_else (|| DataErrorKind :: MissingLocale . with_req (:: icu_provider_adapters :: fallback :: provider :: CollationFallbackSupplementV1Marker :: KEY , req)) } } # [clippy :: msrv = "1.61"] impl DataProvider < :: icu_provider_adapters :: fallback :: provider :: LocaleFallbackLikelySubtagsV1Marker > for $ provider { fn load (& self , req : DataRequest ,) -> Result < DataResponse < :: icu_provider_adapters :: fallback :: provider :: LocaleFallbackLikelySubtagsV1Marker > , DataError > { fallback :: likelysubtags_v1 :: lookup (& req . locale) . map (zerofrom :: ZeroFrom :: zero_from) . map (DataPayload :: from_owned) . map (| payload | { DataResponse { metadata : Default :: default () , payload : Some (payload) , } }) . ok_or_else (|| DataErrorKind :: MissingLocale . with_req (:: icu_provider_adapters :: fallback :: provider :: LocaleFallbackLikelySubtagsV1Marker :: KEY , req)) } } # [clippy :: msrv = "1.61"] impl DataProvider < :: icu_provider_adapters :: fallback :: provider :: LocaleFallbackParentsV1Marker > for $ provider { fn load (& self , req : DataRequest ,) -> Result < DataResponse < :: icu_provider_adapters :: fallback :: provider :: LocaleFallbackParentsV1Marker > , DataError > { fallback :: parents_v1 :: lookup (& req . locale) . map (zerofrom :: ZeroFrom :: zero_from) . map (DataPayload :: from_owned) . map (| payload | { DataResponse { metadata : Default :: default () , payload : Some (payload) , } }) . ok_or_else (|| DataErrorKind :: MissingLocale . with_req (:: icu_provider_adapters :: fallback :: provider :: LocaleFallbackParentsV1Marker :: KEY , req)) } } # [clippy :: msrv = "1.61"] impl DataProvider < :: icu::segmenter :: provider :: GraphemeClusterBreakDataV1Marker > for $ provider { fn load (& self , req : DataRequest ,) -> Result < DataResponse < :: icu::segmenter :: provider :: GraphemeClusterBreakDataV1Marker > , DataError > { segmenter :: grapheme_v1 :: lookup (& req . locale) . map (zerofrom :: ZeroFrom :: zero_from) . map (DataPayload :: from_owned) . map (| payload | { DataResponse { metadata : Default :: default () , payload : Some (payload) , } }) . ok_or_else (|| DataErrorKind :: MissingLocale . with_req (:: icu::segmenter :: provider :: GraphemeClusterBreakDataV1Marker :: KEY , req)) } } } } # [doc = r" Implement [`AnyProvider`] on the given struct using the data"] # [doc = r" hardcoded in this module. This allows the struct to be used with"] # [doc = r" `icu`'s `_any` constructors."] # [doc = r""] # [doc = r" This macro can only be called from its definition-site, i.e. right"] # [doc = r" after `include!`-ing the generated module."] # [doc = r" "] # [doc = r" ```compile_fail"] # [doc = r" struct MyAnyProvider;"] # [doc = r#" include!("/path/to/generated/mod.rs");"#] # [doc = r" impl_any_provider(MyAnyProvider);"] # [doc = r" ```"] # [allow (unused_macros)] macro_rules ! impl_any_provider { ($ provider : path) => { # [clippy :: msrv = "1.61"] impl AnyProvider for $ provider { fn load_any (& self , key : DataKey , req : DataRequest) -> Result < AnyResponse , DataError > { const COLLATIONFALLBACKSUPPLEMENTV1MARKER : :: icu_provider :: DataKeyHash = :: icu_provider_adapters :: fallback :: provider :: CollationFallbackSupplementV1Marker :: KEY . hashed () ; const LOCALEFALLBACKLIKELYSUBTAGSV1MARKER : :: icu_provider :: DataKeyHash = :: icu_provider_adapters :: fallback :: provider :: LocaleFallbackLikelySubtagsV1Marker :: KEY . hashed () ; const LOCALEFALLBACKPARENTSV1MARKER : :: icu_provider :: DataKeyHash = :: icu_provider_adapters :: fallback :: provider :: LocaleFallbackParentsV1Marker :: KEY . hashed () ; const GRAPHEMECLUSTERBREAKDATAV1MARKER : :: icu_provider :: DataKeyHash = :: icu::segmenter :: provider :: GraphemeClusterBreakDataV1Marker :: KEY . hashed () ; match key . hashed () { COLLATIONFALLBACKSUPPLEMENTV1MARKER => fallback :: supplement :: co_v1 :: lookup (& req . locale) . map (AnyPayload :: from_static_ref) , LOCALEFALLBACKLIKELYSUBTAGSV1MARKER => fallback :: likelysubtags_v1 :: lookup (& req . locale) . map (AnyPayload :: from_static_ref) , LOCALEFALLBACKPARENTSV1MARKER => fallback :: parents_v1 :: lookup (& req . locale) . map (AnyPayload :: from_static_ref) , GRAPHEMECLUSTERBREAKDATAV1MARKER => segmenter :: grapheme_v1 :: lookup (& req . locale) . map (AnyPayload :: from_static_ref) , _ => return Err (DataErrorKind :: MissingDataKey . with_req (key , req)) , } . map (| payload | AnyResponse { payload : Some (payload) , metadata : Default :: default () , }) . ok_or_else (|| DataErrorKind :: MissingLocale . with_req (key , req)) } } } } # [clippy :: msrv = "1.61"] pub struct BakedDataProvider ; impl_data_provider ! (BakedDataProvider) ; \ No newline at end of file diff --git a/commons/src/scanner/icu_data/segmenter/grapheme_v1/mod.rs b/commons/src/scanner/icu_data/segmenter/grapheme_v1/mod.rs deleted file mode 100644 index 2ed3b502..00000000 --- a/commons/src/scanner/icu_data/segmenter/grapheme_v1/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -// @generated -type DataStruct = < :: icu::segmenter :: provider :: GraphemeClusterBreakDataV1Marker as :: icu_provider :: DataMarker > :: Yokeable ; pub fn lookup (locale : & icu_provider :: DataLocale) -> Option < & 'static DataStruct > { locale . is_empty () . then (|| & UND) } static UND : DataStruct = include ! ("und.rs.data") ; \ No newline at end of file diff --git a/commons/src/scanner/icu_data/segmenter/grapheme_v1/und.rs.data b/commons/src/scanner/icu_data/segmenter/grapheme_v1/und.rs.data deleted file mode 100644 index 97d3187e..00000000 --- a/commons/src/scanner/icu_data/segmenter/grapheme_v1/und.rs.data +++ /dev/null @@ -1 +0,0 @@ -:: icu::segmenter :: provider :: RuleBreakDataV1 { property_table : :: icu::segmenter :: provider :: RuleBreakPropertyTable (:: icu::collections :: codepointtrie :: CodePointTrie :: from_parts (:: icu::collections :: codepointtrie :: CodePointTrieHeader { high_start : 921600u32 , shifted12_high_start : 225u16 , index3_null_offset : 407u16 , data_null_offset : 32u32 , null_value : 0u32 , trie_type : :: icu::collections :: codepointtrie :: TrieType :: Small , } , unsafe { :: zerovec :: ZeroVec :: from_bytes_unchecked (b"\0\0@\0\x7F\0 \0 \0 \0 \0 \0 \0 \0 \0 \0\xBF\0\xCF\0 \0 \0 \0 \0\x0C\x01 \0 \0 \0;\x01y\x01\xB9\x01\xEE\x01 \0\x1F\x02P\x02\x85\x02\x9F\x02\xD0\x02\x0E\x03<\x03l\x03\xA2\x03\xDF\x03\x1E\x04]\x04\x9C\x04\xDB\x04\x1A\x05\xDB\x04Z\x05\x9A\x05\xDA\x05\x18\x06V\x06\x96\x06\xD5\x06\x14\x07T\x07\x94\x07\xD3\x07\x12\x08H\x08|\x08\xB7\x08\xC6\x08\x07\x01\x03\tC\t\x83\t\x14\x06\x86\x07\xA0\x07\xAD\x07\xC6\x07\xE6\x07\x01\x08\x19\x088\x08\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07\xA0\x07X\x08\0\0\x10\0 \x000\0@\0P\0`\0p\0\x7F\0\x8F\0\x9F\0\xAF\0 \x000\0@\0P\0 \x000\0@\0P\0 \x000\0@\0P\0 \x000\0@\0P\0 \x000\0@\0P\0\xBF\0\xCF\0\xDF\0\xEF\0\xCF\0\xDF\0\xEF\0\xFF\0 \x000\0@\0P\0 \x000\0@\0P\0\x0C\x01\x1C\x01,\x01<\x01 \x000\0@\0P\0 \x000\0@\0P\0 \x000\0@\0P\0;\x01K\x01[\x01k\x01y\x01\x89\x01\x99\x01\xA9\x01\xB9\x01\xC9\x01\xD9\x01\xE9\x01\xEE\x01\xFE\x01\x0E\x02\x1E\x02 \x000\0@\0P\0\x1F\x02/\x02?\x02O\x02P\x02`\x02p\x02\x80\x02\x85\x02\x95\x02\xA5\x02\xB5\x02\x9F\x02\xAF\x02\xBF\x02\xCF\x02\xD0\x02\xE0\x02\xF0\x02\0\x03\x0E\x03\x1E\x03.\x03>\x03<\x03L\x03\\\x03l\x03l\x03|\x03\x8C\x03\x9C\x03\xA2\x03\xB2\x03\xC2\x03\xD2\x03\xDF\x03\xEF\x03\xFF\x03\x0F\x04\x1E\x04.\x04>\x04N\x04]\x04m\x04}\x04\x8D\x04\x9C\x04\xAC\x04\xBC\x04\xCC\x04\xDB\x04\xEB\x04\xFB\x04\x0B\x05\x1A\x05*\x05:\x05J\x05\xDB\x04\xEB\x04\xFB\x04\x0B\x05Z\x05j\x05z\x05\x8A\x05\x9A\x05\xAA\x05\xBA\x05\xCA\x05\xDA\x05\xEA\x05\xFA\x05\n\x06\x18\x06(\x068\x06H\x06V\x06f\x06v\x06\x86\x06\x96\x06\xA6\x06\xB6\x06\xC6\x06\xD5\x06\xE5\x06\xF5\x06\x05\x07\x14\x07$\x074\x07D\x07T\x07d\x07t\x07\x84\x07\x94\x07\xA4\x07\xB4\x07\xC4\x07\xD3\x07\xE3\x07\xF3\x07\x03\x08\x12\x08\"\x082\x08B\x08H\x08X\x08h\x08x\x08|\x08\x8C\x08\x9C\x08\xAC\x08\xB7\x08\xC7\x08\xD7\x08\xE7\x08\xC6\x08\xD6\x08\xE6\x08\xF6\x08\x07\x01\x17\x01'\x017\x01\x03\t\x13\t#\t3\tC\tS\tc\ts\t\x83\t\x93\t\xA3\t\xB3\t\x14\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BF\0\xBF\0\xBF\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\xBF\0\xBF\0\xBF\0\xBF\0\xBF\0\xBF\0\xBF\0\xBF\0\xBF\0\xBF\0\xBF\0\xBF\0\xBF\0\xBF\0\xBF\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0\x0E\0y\0\x89\0\xA1\0\xC1\0\xE1\0\x01\x01!\x01A\x01a\x01\x81\x01\x97\x01\xA6\x01\xC6\x01\xE5\x01\x05\x02\x97\x01%\x02@\x02`\x02\x80\x02\x9C\x02\xB0\x02\xC6\x02\x97\x01\xE6\x02\xFD\x02\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x17\x037\x03V\x03v\x03z\x03w\x03{\x03x\x03|\x03y\x03v\x03z\x03w\x03{\x03x\x03|\x03y\x03\x84\x03\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\xA4\x03\x97\x01\xC4\x03\xE4\x03\x04\x04\x97\x01\x97\x01\x97\x01$\x043\x04I\x04i\x04\x87\x04\xA4\x04\xC2\x04\xE0\x04\0\x05\x1E\x058\x05\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01U\x05\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01f\x05\x97\x01z\x05\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x9A\x05\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\x97\x01\xAA\x05\xBF\x05\xDB\x05\x97\x01\x97\x01\x97\x01\xFB\x05\x97\x01\x97\x01\x1B\x061\x06C\x06\x97\x01V\x06\x97\x01\x97\x01\x97\x01v\x06\x96\x06\xB6\x06\xD1\x06\xF1\x06\x06\x07&\x07'\x07G\x07f\x07f\x07f\x07f\x07f\x07f\x07f\x07") } , unsafe { :: zerovec :: ZeroVec :: from_bytes_unchecked (b"\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x02\x03\x03\x01\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\x03\0\0\0\0\0\0\0\0\0\x0E\0\0\0\x03\x0E\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x04\x04\x04\x04\x04\x04\x04\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\0\x04\x04\0\x04\x04\0\x04\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x07\x07\x07\x07\x07\x07\0\0\0\0\0\0\0\0\0\0\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\0\x03\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x04\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x04\x04\x04\x04\x04\x04\x04\x07\0\x04\x04\x04\x04\x04\x04\0\0\x04\x04\0\x04\x04\x04\x04\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x07\0\x04\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x04\x04\x04\x04\x04\x04\x04\x04\x04\0\0\0\0\0\0\0\0\0\x04\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x04\x04\x04\x04\0\x04\x04\x04\x04\x04\x04\x04\x04\x04\0\x04\x04\x04\0\x04\x04\x04\x04\x04\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x04\x04\x04\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x07\x07\0\0\0\0\0\0\x04\x04\x04\x04\x04\x04\x04\x04\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x07\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x08\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x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04\x04\x04\x04\x04\x04\x04\x04\0\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\0\0\0\x04\x08\x04\x04\x04\x04\x04\x04\0\x04\x04\x08\x08\x04\x04\0\0\0\0\0\0\x08\x08\x04\x04\0\0\0\0\x04\x04\0\0\x04\0\x08\x04\x04\0\0\0\0\0\0\x04\0\0\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\0\0\x04\x04\x04\x08\0\0\0\0\0\0\0\0\0\0\x04\x04\x08\0\0\0\0\0\0\0\0\0\0\0\x04\x04\x08\x04\x04\x04\x04\x04\x04\x04\x08\x08\x08\x08\x08\x08\x04\x08\x08\x04\x04\x04\x04\x04\x04\x04\0\0\0\0\0\0\0\0\0\0\0\x04\x04\x04\x03\x04\x04\x04\x08\x08\x08\x08\x04\x04\x08\x08\x08\0\0\0\0\x08\x08\x04\x08\x08\x08\x08\x08\x08\x04\x04\x04\0\0\0\0\0\0\0\x04\x04\x08\x08\x04\0\0\0\0\0\x08\x04\x08\x04\x04\x04\x04\x04\x04\x04\0\x04\0\0\x04\x04\x04\x04\x04\x04\x04\x04\x08\x08\x08\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\0\0\x04\0\0\0\0\x04\x04\x04\x04\x04\x04\x04\x08\x04\x08\x08\x08\x04\x08\x08\0\0\0\0\0\0\0\0\0\0\0\x08\x04\x04\x04\x04\x08\x08\x04\x04\x08\x04\x04\x04\0\0\0\0\0\0\x04\x08\x04\x04\x08\x08\x08\x04\x08\x04\0\0\0\0\x08\x08\x08\x08\x08\x08\x08\x08\x04\x04\x04\x04\x08\x08\x04\x04\0\0\0\0\0\0\0\0\x04\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\t\t\t\t\t\t\t\t\0\0\0\x04\x08\x08\x04\x04\x04\x04\x08\x08\x04\x04\x08\x08\0\0\0\0\0\0\0\0\0\x04\x04\x04\x04\x04\x04\x08\x04\x04\x08\x08\x04\x04\0\0\0\0\0\0\0\0\0\x04\0\0\0\0\0\0\0\0\x04\x08\0\0\x04\0\x04\x04\x04\0\0\x04\x04\0\0\0\0\0\x04\x04\0\0\0\0\0\0\0\0\0\0\0\x08\x04\x04\x08\x08\0\0\0\0\0\x08\x04\0\0\0\0\0\0\0\0\0\x08\x08\x04\x08\x08\x04\x08\x08\0\x08\x04\0\0\x0C\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\x0C\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\r\0\0\0\0\0\0\0\0\0\0\0\0\n\n\n\n\n\n\n\0\0\0\0\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\x0B\0\0\0\0\0\0\x04\x04\x04\x04\x04\0\0\0\0\0\x04\x04\x04\0\x04\x04\0\0\0\0\0\x04\x04\x04\x04\0\0\0\0\0\0\0\0\x04\x04\x04\0\0\0\0\x04\x04\x04\x04\0\0\0\0\0\0\0\0\0\0\x08\x04\x08\0\0\0\0\0\0\0\0\0\0\0\0\0\x04\0\0\x04\x04\0\0\0\0\0\0\0\0\0\0\x04\x08\x08\x08\x04\x04\x04\x04\x08\x08\x04\x04\0\0\x07\0\0\x04\0\0\0\0\0\0\0\0\0\0\x07\0\0\0\0\0\0\0\x04\x04\x04\x04\x04\x08\x04\x04\x04\0\0\0\x08\x08\x08\x04\x04\x04\x04\x04\x04\x04\x04\x04\x08\0\x07\x07\0\0\0\0\0\x04\x04\x04\x04\0\x08\x04\0\0\0\0\0\0\0\0\0\0\0\0\x08\x08\x08\x04\x04\x08\x08\x04\x08\x04\x04\0\0\0\0\0\0\x04\0\x08\x08\x08\x04\x04\x04\x04\x04\x04\x04\x04\0\0\0\0\0\x04\x08\x08\x08\x08\0\0\x08\x08\0\0\x08\x08\x08\0\0\x08\x08\0\0\x04\x04\x04\x04\x04\x04\x04\0\0\0\0\0\x08\x08\x08\x04\x04\x04\x04\x04\x04\x04\x04\x08\x08\x04\x04\x04\x08\x04\0\0\0\0\0\0\0\0\0\x04\x08\x08\x04\x04\x04\x04\x04\x04\x08\x04\x08\x08\x04\x08\x04\x04\0\0\0\0\0\0\0\0\0\0\0\0\x08\x08\x04\x04\x04\x04\0\0\x08\x08\x08\x08\x04\x04\x08\x04\x08\x08\x08\x04\x04\x04\x04\x04\x04\x04\x04\x08\x08\x04\x08\x04\0\0\0\0\0\0\0\0\0\0\0\x04\x08\x04\x08\x08\x04\x04\x04\x04\x04\x04\x08\x04\0\0\0\0\0\0\0\0\x04\x04\x04\x04\x08\x04\x04\x04\x04\x04\0\0\0\0\x04\x04\x04\x04\x04\x04\x04\x04\x08\x04\x04\0\0\0\0\0\x04\x08\x08\x08\x08\x08\0\x08\x08\0\0\x04\x04\x08\x04\x07\x08\x07\x08\x04\0\0\0\0\0\0\0\0\0\0\0\0\x08\x08\x08\x04\x04\x04\x04\0\0\x04\x04\x08\x08\x08\x08\x04\0\0\0\x08\0\0\0\0\0\0\0\0\0\0\0\x04\x04\x04\x04\x04\x04\x04\x04\x04\x04\0\0\0\0\0\x04\x04\x04\x04\x04\x04\x08\x07\x04\x04\x04\x04\0\x04\x04\x04\x04\x04\x04\x08\x08\x04\x04\x04\0\0\0\0\x07\x07\x07\x07\x07\x07\x04\x04\x04\x04\x04\x04\x04\x08\x04\x04\0\0\0\0\0\0\x04\x04\x04\x04\x04\x04\x04\0\x04\x04\x04\x04\x04\x04\x08\x04\x04\x04\x04\x04\x04\x04\x04\0\x08\x04\x04\x04\x04\x04\x04\x08\x04\x04\x08\x04\x04\0\0\0\0\0\0\0\0\0\x04\x04\x04\x04\x04\x04\0\0\0\x04\0\x04\x04\0\x04\x04\x04\x04\x04\x04\x07\x04\0\0\0\0\0\0\0\0\0\0\x08\x08\x08\x08\x08\0\x04\x04\0\x08\x08\x04\x08\x04\0\0\0\0\0\0\0\0\x04\x04\x07\x08\0\0\0\0\0\0\0\0\0\0\0\0\x08\x08\x04\x04\x04\x04\x04\0\0\0\x08\x08\x04\x08\x04\0\0\0\0\0\0\0\0\0\0\0\0\0\x04\0\0\0\0\0\0\x04\x04\x04\x04\x04\x04\x04\x04\x04\0\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\0\0\0\0\0\0\0\x04\x08\x04\x04\x04\0\0\0\x08\x04\x04\x04\x03\x03\x03\x03\x03\x03\x03\x03\x04\x04\x04\x04\x04\0\0\x04\x04\x04\x04\x04\x04\x04\0\0\0\0\0\0\0\0\0\0\x04\x04\x04\x04\0\0\x04\x04\x04\x04\x04\x04\x04\0\0\0\0\x04\x04\x04\x04\x04\x04\x04\x04\x04\0\0\x04\x04\x04\x04\x04\0\x04\x04\0\x04\x04\x04\x04\x04\0\0\0\0\0\x0E\x0E\0\0\0\0\0\0\0\0\0\0\0\0\x0E\x0E\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x0E\0\x0E\x0E\x0E\x0E\x0E\x0E\x0E\x0E\x0E\x0E\0\0\0\0\0\x0E\x0E\x0E\x0E\x0E\x0E\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\0\0\x0E\x0E\x0E\x0E\x0E\x0E\x0E\x0E\x0E\0\x0E\x0E\x0E\x0E\x0E\x0E\x0E\x0E\x0E\x0E\x0E\x04\x04\x04\x04\x04\0\0\0\0\0\0\x0E\x0E\x0E\x0E\x0E\x0E\x0E\x0E\x0E\x0E\x0E\x0E\0\0\0\0\0\0\0\0\x0E\x0E\x0E\x0E\x0E\x0E\x0E\x0E\x0E\x0E\x0E\0\x0E\x0E\x0E\x0E\0\0") } , 0u8) ,) , break_state_table : :: icu::segmenter :: provider :: RuleBreakStateTable (unsafe { :: zerovec :: ZeroVec :: from_bytes_unchecked (b"\x80\x80\x80\x80\xFF\xFF\x80\x80\xFF\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\xFF\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\xFF\xFF\x80\x80\xFF\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\xFF\xFF\x80\x80\xFF\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\xFF\xFF\x11\x80\xFF\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\xFF\x80\x80\x80\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x80\x80\x80\x80\x80\x80\x80\x80\x80\xFF\xFF\x80\x80\xFF\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\xFF\xFF\x80\x80\xFF\xFF\xFF\x80\xFF\xFF\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\xFF\xFF\x80\x80\xFF\x80\xFF\xFF\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\xFF\xFF\x80\x80\xFF\x80\x80\xFF\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\xFF\xFF\x80\x80\xFF\x80\xFF\xFF\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\xFF\xFF\x80\x80\xFF\x80\x80\xFF\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x0F\x10\x80\x80\xFF\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x0F\x10\x80\x80\xFF\x80\x80\x80\x80\x80\x80\xFE\xFE\xFE\xFE\x80\x80\x80\x80\x80\xFF\xFF\x80\x80\xFF\x80\x80\x80\x80\x80\xFF\xFE\xFE\xFE\xFE\x80\x80\xFE\xFE\xFE\xFF\xFF\x80\xFE\xFE\xFE\xFE\xFE\xFE\xFE\xFE\xFE\xFE\xFE\xFE\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80") } ,) , rule_status_table : :: icu::segmenter :: provider :: RuleStatusTable (:: zerovec :: ZeroVec :: new () ,) , property_count : 20u8 , last_codepoint_property : 14i8 , sot_property : 18u8 , eot_property : 19u8 , complex_property : 127u8 , } \ No newline at end of file diff --git a/commons/src/scanner/icu_data/segmenter/mod.rs b/commons/src/scanner/icu_data/segmenter/mod.rs deleted file mode 100644 index 08825d5f..00000000 --- a/commons/src/scanner/icu_data/segmenter/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -// @generated -pub mod grapheme_v1 ; \ No newline at end of file diff --git a/commons/src/scanner/mod.rs b/commons/src/scanner/mod.rs index 72372135..5033e96b 100644 --- a/commons/src/scanner/mod.rs +++ b/commons/src/scanner/mod.rs @@ -4,48 +4,32 @@ pub mod position; pub mod span; mod symbol; -use icu::segmenter::{GraphemeClusterSegmenter, SegmenterError}; -use icu_provider_adapters::fallback::LocaleFallbackProvider; +use icu_segmenter::GraphemeClusterSegmenter; use position::{Offset, Position}; pub use symbol::{Symbol, SymbolKind}; -#[derive(Debug, Clone)] -struct IcuDataProvider; -// Generated using: `icu4x-datagen --keys-for-bin .\target\debug\unimarkup.exe --locales full --format mod --out .\commons\src\scanner\icu_data` -// Note: Run `cargo build` before re-generating the data to ensure the newest binary is inspected by icu4x-datagen. -include!("./icu_data/mod.rs"); -impl_data_provider!(IcuDataProvider); - #[derive(Debug)] pub struct Scanner { - provider: LocaleFallbackProvider, segmenter: GraphemeClusterSegmenter, } impl Clone for Scanner { fn clone(&self) -> Self { - let segmenter = GraphemeClusterSegmenter::try_new_unstable(&self.provider) - .expect("Provider is valid at this point."); + let segmenter = GraphemeClusterSegmenter::new(); - Self { - provider: self.provider.clone(), - segmenter, - } + Self { segmenter } } } -impl Scanner { - pub fn try_new() -> Result { - let icu_data_provider = IcuDataProvider; - let fallback_provider = LocaleFallbackProvider::try_new_unstable(icu_data_provider)?; - let segmenter = GraphemeClusterSegmenter::try_new_unstable(&fallback_provider)?; +impl Default for Scanner { + fn default() -> Self { + let segmenter = GraphemeClusterSegmenter::new(); - Ok(Self { - provider: fallback_provider, - segmenter, - }) + Self { segmenter } } +} +impl Scanner { pub fn scan_str<'s>(&self, input: &'s str) -> Vec> { let mut symbols: Vec = Vec::new(); let mut curr_pos: Position = Position::default(); diff --git a/commons/src/test_runner/mod.rs b/commons/src/test_runner/mod.rs index e0cd5a74..f9e988ff 100644 --- a/commons/src/test_runner/mod.rs +++ b/commons/src/test_runner/mod.rs @@ -1,3 +1,8 @@ +use std::{ + fs::DirEntry, + path::{Path, PathBuf}, +}; + use crate::scanner::{Scanner, Symbol}; pub mod as_snapshot; @@ -5,10 +10,140 @@ pub mod snap_test_runner; pub mod spec_test; pub mod test_file; -pub use insta; +use self::test_file::{TestCase, TestFile}; /// Scans the string using the [`Scanner`] struct. pub fn scan_str(input: &str) -> Vec { - let scanner = Scanner::try_new().unwrap(); + let scanner = Scanner::default(); scanner.scan_str(input) } + +/// Finds all files with the given extension in the given path (recursively). +/// +/// # Arguments +/// +/// * `path` - The path to the directory to search in. +/// * `ext` - The extension of the files that should be included +pub fn collect_entries(path: impl AsRef, ext: &str) -> std::io::Result> { + let mut entries = vec![]; + + if path.as_ref().is_dir() { + for entry in std::fs::read_dir(path)? { + let entry = entry?; + let path = entry.path(); + + if path.is_dir() { + entries.append(&mut collect_entries(path, ext)?); + } else if path.extension().and_then(|ext| ext.to_str()).unwrap_or("") == ext { + entries.push(entry); + } + } + } + + Ok(entries) +} + +/// Generates the output path for the given test name. +/// +/// # Arguments +/// +/// * `out_folder` - The folder to write the snapshots to. +/// * `test_file` - The path to the input test file. Path will be generated with the help of +/// `test_file`'s name. +/// * `separator` - component of the `test_file` [`Path`], after which all the components of that +/// path will be included in the generated output path. +/// +/// # Example +/// ```rust +/// use unimarkup_commons::test_runner::gen_snap_path; +/// use std::path::Path; +/// +/// let out_folder = "tests/spec/snapshots/lexer"; +/// let input_file_path = "tests/spec/markup/some-subfolder/underline.yml"; +/// // ^^^^^^^^^^^^^^^^^^^^^^^^ will be contained in generated output path +/// let path = gen_snap_path(out_folder, input_file_path, "markup"); +/// +/// assert_eq!(&path, Path::new("tests/spec/snapshots/lexer/some-subfolder/underline")); +/// ``` +pub fn gen_snap_path( + out_folder: impl AsRef, + test_file: impl AsRef, + separator: &str, +) -> PathBuf { + let mut path = PathBuf::from(out_folder.as_ref()); + + let mut snap_path: PathBuf = test_file + .as_ref() + .components() + .skip_while(|component| Path::new(component) != Path::new(separator)) + .skip(1) + .collect(); + + snap_path.set_extension(""); + + path.push(snap_path); + path +} + +/// Generates test cases from test files +/// +/// # Arguments +/// * `markups` - Path to the folder containing the (input) test files. Test files are in YML +/// format (have extension '.yml') and will be collected recursively. +/// * `output` - Path to the folder where the (output) snapshot files will be saved. +/// * `separator` - The component of the `markups` Path, such that all the components of the path +/// following it will be included in the generated output path. These components will be +/// appended to the `output` path. +pub fn collect_tests( + markups: impl AsRef, + output: impl AsRef, + separator: &str, +) -> Vec { + let markups_path = PathBuf::from(markups.as_ref()); + + let entries = collect_entries(markups_path, "yml").unwrap(); + + let cases = entries.iter().flat_map(|entry| { + let path = entry.path(); + let input = std::fs::read_to_string(&path).unwrap(); + + let mut test_file: TestFile = serde_yaml::from_str(&input).unwrap(); + + let output = output.as_ref(); + let cases = test_file.tests.drain(..).map(move |test| { + let file_name = path.file_name().and_then(|file| file.to_str()).unwrap(); + let out_path = gen_snap_path(output, &path, separator); + + let file_path: String = path + .components() + .skip_while(|c| Path::new(c) != Path::new(separator)) + .collect::() + .to_string_lossy() + .to_string(); + + TestCase { + test, + file_name: String::from(file_name), + out_path, + file_path, + } + }); + + cases.collect::>() + }); + + cases.collect() +} + +/// Returns the absolute path to the integration `tests` folder of the crate it's called from. +#[macro_export] +macro_rules! crate_tests_path { + () => {{ + let curr = ::std::env!("CARGO_MANIFEST_DIR"); + + let mut buf = std::path::PathBuf::from(curr); + buf.push("tests"); + + buf + }}; +} diff --git a/commons/src/test_runner/snap_test_runner.rs b/commons/src/test_runner/snap_test_runner.rs index fd79137d..d0d946b6 100644 --- a/commons/src/test_runner/snap_test_runner.rs +++ b/commons/src/test_runner/snap_test_runner.rs @@ -1,6 +1,8 @@ use crate::scanner::Symbol; use serde::Serialize; +pub use insta::{assert_snapshot, Settings}; + #[derive(Debug)] pub struct SnapTestRunner<'a, I = ()> { pub info: Option, @@ -65,15 +67,22 @@ where } } +/// Runs the [`SnapTestRunner`] and writes the snapshot in the given output path. +/// +/// # Arguments +/// +/// * *snap_test* - The [`SnapTestRunner`] to run. +/// * *path* - The path to write the snapshot to. +/// +/// [SnapTestRunner]: self::SnapTestRunner #[macro_export] macro_rules! run_snap_test { - ($snap_test:expr $(, $path:expr)?) => { + ($snap_test:expr, $path:expr) => { let snap_test: $crate::test_runner::snap_test_runner::SnapTestRunner<_> = $snap_test; - let mut settings = $crate::test_runner::insta::Settings::clone_current(); + let mut settings = $crate::test_runner::snap_test_runner::Settings::clone_current(); - let mut path = std::path::Path::new("../spec/snapshots/"); - $(path = $path;)? + let path = $path; settings.set_snapshot_path(path); settings.set_omit_expression(true); @@ -102,74 +111,10 @@ macro_rules! run_snap_test { settings.set_prepend_module_to_snapshot(false); settings.bind(|| { - $crate::test_runner::insta::assert_snapshot!(snap_test.name.as_str(), snap_content); + $crate::test_runner::snap_test_runner::assert_snapshot!( + snap_test.name.as_str(), + snap_content + ); }) }; } - -/// Macro for snapshot testing of spec files. -/// -/// ## Arguments -/// -/// * *file_path* ... A path to the spec file to test, where the path must be relative to the `tests` directory of your crate (e.g. "spec/markup/blocks/paragraph.yml") -/// * *block_ty* ... A specific block element implementing `ParserGenerator` **may** be given as second argument to use the parser of the element for testing -/// -/// ## Usage -/// -/// ```ignore -/// test_parser_snap!("spec/markup/blocks/paragraph.yml", Paragraph); -/// test_parser_snap!("spec/markup/blocks/paragraph.yml"); -/// ``` -#[macro_export] -macro_rules! test_parser_snap { - ($paths:expr, $parser_fn:expr) => { - let test_content = $crate::test_runner::test_file::get_test_content($paths.0, $paths.1); - let cfg = $crate::config::Config::default(); - let scanner = $crate::scanner::Scanner::try_new().unwrap(); - - for test in &test_content.test_file.tests { - let symbols = scanner.scan_str(&test.input); - - let mut snap_runner = SnapTestRunner::with_fn::<_, _>(&test.name, &symbols, $parser_fn) - .with_info(format!( - "Test '{}-{}' from: {}", - &test_content.test_file.name, - &test.name, - $paths.0.to_string_lossy() - )); - - if let Some(ref description) = test.description { - snap_runner = snap_runner.with_description(description); - } - - let snap_runner = snap_runner - .with_sub_path(test_content.snap_path.to_str().expect("Invalid sub path")); - - // TODO: preamble? - - $crate::run_snap_test!(snap_runner); - } - }; - ($file_path:literal) => { - let test_content = $crate::test_runner::test_file::get_test_content($file_path); - - for test in &test_content.test_file.tests { - let mut snap_runner = SnapTestRunner::with_parser::<&str, _>(&test.name, &test.input) - .with_info(format!( - "Test '{}-{}' from: {}", - &test_content.test_file.name, &test.name, $file_path - )); - - if let Some(ref description) = test.description { - snap_runner = snap_runner.with_description(description); - } - - let snap_runner = snap_runner - .with_sub_path(test_content.snap_path.to_str().expect("Invalid sub path")); - - // TODO: preamble? - - $crate::run_snap_test!(snap_runner); - } - }; -} diff --git a/commons/src/test_runner/spec_test.rs b/commons/src/test_runner/spec_test.rs index b821297b..fcf6617d 100644 --- a/commons/src/test_runner/spec_test.rs +++ b/commons/src/test_runner/spec_test.rs @@ -38,33 +38,3 @@ where ); } } - -/// Macro for spec testing of spec files. -/// Spec tests compare the rendered outputs with the expected ones set in the spec files. -/// -/// ## Arguments -/// -/// * *file_path* ... A path to the spec file to test, where the path must be relative to the `tests` directory of your crate (e.g. "spec/markup/blocks/paragraph.yml") -/// -/// ## Usage -/// -/// ```ignore -/// run_spec_test!("spec/markup/blocks/paragraph.yml"); -/// ``` -#[macro_export] -macro_rules! run_spec_test { - ($paths:expr, $compile:expr) => { - let test_content = $crate::test_runner::test_file::get_test_content($paths.0, $paths.1); - - for test in &test_content.test_file.tests { - // TODO: preamble? - - $crate::test_runner::spec_test::assert_um_spec( - &test_content.test_file.name, - test, - $crate::config::Config::default(), - $compile, - ); - } - }; -} diff --git a/commons/src/test_runner/test_file.rs b/commons/src/test_runner/test_file.rs index 5acb3056..e150ffb7 100644 --- a/commons/src/test_runner/test_file.rs +++ b/commons/src/test_runner/test_file.rs @@ -10,13 +10,13 @@ pub struct Preamble { pub lang: Option, } -#[derive(Deserialize)] +#[derive(Deserialize, Clone)] pub struct TestOutputs { pub html: Option, pub um: Option, } -#[derive(Deserialize)] +#[derive(Deserialize, Clone)] pub struct Test { pub name: String, pub description: Option, @@ -27,7 +27,7 @@ pub struct Test { pub outputs: TestOutputs, } -#[derive(Deserialize)] +#[derive(Deserialize, Clone)] pub struct TestFile { pub spec: String, pub name: String, @@ -36,17 +36,10 @@ pub struct TestFile { pub tests: Vec, } -pub struct TestContent { - pub test_file: TestFile, - pub snap_path: PathBuf, -} - -pub fn get_test_content(test_filepath: PathBuf, snap_path: PathBuf) -> TestContent { - let input = std::fs::read_to_string(test_filepath).unwrap(); - let test_file: crate::test_runner::test_file::TestFile = serde_yaml::from_str(&input).unwrap(); - - TestContent { - test_file, - snap_path, - } +#[derive(Clone)] +pub struct TestCase { + pub test: Test, + pub file_name: String, + pub out_path: PathBuf, + pub file_path: String, } diff --git a/core/Cargo.toml b/core/Cargo.toml index 502bf1d0..7be6fd41 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -11,6 +11,11 @@ license.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[[test]] +name="unimarkup-core" +path="tests/tests.rs" +harness=false + [dependencies] logid.workspace = true thiserror.workspace = true @@ -20,3 +25,4 @@ unimarkup-render = { path = "../render/", version = "0" } [dev-dependencies] unimarkup-commons = { path ="../commons/", version = "0", features = ["test_runner"] } +libtest-mimic = "0.6.1" diff --git a/core/tests/elements/heading.rs b/core/tests/elements/heading.rs deleted file mode 100644 index 8b137891..00000000 --- a/core/tests/elements/heading.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/core/tests/elements/inline.rs b/core/tests/elements/inline.rs deleted file mode 100644 index 8b137891..00000000 --- a/core/tests/elements/inline.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/core/tests/general/metadata.rs b/core/tests/general/metadata.rs index a2a43892..521be8ea 100644 --- a/core/tests/general/metadata.rs +++ b/core/tests/general/metadata.rs @@ -5,8 +5,7 @@ use unimarkup_parser::{ security, }; -#[test] -fn test__metadata__create_from_memory() { +pub fn test__metadata__create_from_memory() { let testfile = "from_memory"; let content = "some **unimarkup content**"; diff --git a/core/tests/general/unimarkup.rs b/core/tests/general/unimarkup.rs index 87e43605..e49c4099 100644 --- a/core/tests/general/unimarkup.rs +++ b/core/tests/general/unimarkup.rs @@ -1,7 +1,6 @@ use unimarkup_commons::config::{output::OutputFormatKind, Config}; -#[test] -fn compile_empty_content() { +pub fn compile_empty_content() { let mut cfg = Config { input: "tests/test_files/all_syntax.um".into(), ..Default::default() diff --git a/core/tests/runner/mod.rs b/core/tests/runner/mod.rs new file mode 100644 index 00000000..00588fad --- /dev/null +++ b/core/tests/runner/mod.rs @@ -0,0 +1,94 @@ +use unimarkup_commons::test_runner::{ + self, as_snapshot::AsSnapshot, snap_test_runner::SnapTestRunner, test_file, +}; +use unimarkup_core::Unimarkup; + +use crate::snapshot::Snapshot; + +pub fn test_core_snapshots() -> Vec { + let tests_path = unimarkup_commons::crate_tests_path!(); + + let test_cases = test_runner::collect_tests( + tests_path.join("spec/markup"), + tests_path.join("spec/snapshots/"), + "markup", + ); + + let mut test_runs = Vec::with_capacity(test_cases.len()); + + for case in test_cases { + let spec_test_name = format!("{}::spec::{}", module_path!(), case.test.name.as_str()); + let snap_test_name = format!("{}::snap::{}", module_path!(), case.test.name.as_str()); + + let cloned_case = case.clone(); + let spec_test_run = move || { + std::panic::catch_unwind(|| run_spec_test(cloned_case)).map_err(|err| { + let panic_msg = err + .downcast_ref::<&str>() + .unwrap_or(&"Panic message not available"); + + format!("Test case panicked: {}", panic_msg).into() + }) + }; + + let snap_test_run = move || { + std::panic::catch_unwind(|| run_snap_test(case)).map_err(|err| { + let panic_msg = err + .downcast_ref::<&str>() + .unwrap_or(&"Panic message not available"); + + format!("Test case panicked: {}", panic_msg).into() + }) + }; + + test_runs.push(libtest_mimic::Trial::test(spec_test_name, spec_test_run)); + test_runs.push(libtest_mimic::Trial::test(snap_test_name, snap_test_run)); + } + + test_runs +} + +fn run_spec_test(case: test_runner::test_file::TestCase) { + test_runner::spec_test::assert_um_spec( + &case.file_name, + &case.test, + unimarkup_commons::config::Config::default(), + |test: &test_file::Test, cfg| { + let input = test.input.trim_end(); + let um = Unimarkup::parse(input, cfg); + test_file::TestOutputs { + html: Some(um.render_html().unwrap().to_string()), + um: Some(test.input.clone()), + } + }, + ); +} + +fn run_snap_test(case: test_runner::test_file::TestCase) { + let mut cfg = unimarkup_commons::config::Config::default(); + let scanner = unimarkup_commons::scanner::Scanner::default(); + + let symbols = scanner.scan_str(&case.test.input); + + let mut snap_runner = SnapTestRunner::with_fn::<_, _>(&case.test.name, &symbols, |_input| { + let um = unimarkup_core::parser::parse_unimarkup(&case.test.input, &mut cfg); + + ( + um.blocks + .iter() + .map(|block| Snapshot(block).as_snapshot()) + .collect(), + &[], + ) + }) + .with_info(format!( + "Test '{}' from: {}", + case.test.name, case.file_path + )); + + if let Some(ref description) = case.test.description { + snap_runner = snap_runner.with_description(description); + } + + unimarkup_commons::run_snap_test!(snap_runner, &case.out_path); +} diff --git a/core/tests/snapshot/mod.rs b/core/tests/snapshot/mod.rs new file mode 100644 index 00000000..c7df5631 --- /dev/null +++ b/core/tests/snapshot/mod.rs @@ -0,0 +1,36 @@ +use std::ops::Deref; + +use unimarkup_commons::test_runner::as_snapshot::AsSnapshot; +use unimarkup_parser::elements::blocks::Block; +use unimarkup_parser::elements::Blocks; + +mod paragraph; + +#[derive(Debug)] +pub struct Snapshot(pub T); + +impl Deref for Snapshot { + type Target = T; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl AsSnapshot for Snapshot { + fn as_snapshot(&self) -> String { + self.0 + .iter() + .map(|block| Snapshot(block).as_snapshot()) + .collect() + } +} + +impl AsSnapshot for Snapshot<&Block> { + fn as_snapshot(&self) -> String { + match **self { + Block::Paragraph(block) => Snapshot(block).as_snapshot(), + _ => unimplemented!("TODO: Implement snapshot for {:?}", self), + } + } +} diff --git a/core/tests/elements/paragraph.rs b/core/tests/snapshot/paragraph.rs similarity index 95% rename from core/tests/elements/paragraph.rs rename to core/tests/snapshot/paragraph.rs index 1f44131d..10b3e253 100644 --- a/core/tests/elements/paragraph.rs +++ b/core/tests/snapshot/paragraph.rs @@ -1,4 +1,4 @@ -use crate::test_runner::Snapshot; +use super::Snapshot; use unimarkup_commons::test_runner::as_snapshot::AsSnapshot; use unimarkup_parser::elements::atomic::Paragraph; diff --git a/core/tests/spec/markup/blocks/enclosed.yml b/core/tests/spec/markup/blocks/enclosed.yml deleted file mode 100644 index 6c7753b9..00000000 --- a/core/tests/spec/markup/blocks/enclosed.yml +++ /dev/null @@ -1,17 +0,0 @@ -# Unimarkup specification version -spec: "0.0.1" - -name: enclosed - -tests: - - name: simple-enclosed - - input: | - ### - Enclosed content - ### - - html: | -
-

Enclosed content

-
diff --git a/core/tests/spec/snapshots/blocks/paragraph/paragraph-with-inlines.snap b/core/tests/spec/snapshots/blocks/paragraph/paragraph-with-inlines.snap index dca33c63..9a78a010 100644 --- a/core/tests/spec/snapshots/blocks/paragraph/paragraph-with-inlines.snap +++ b/core/tests/spec/snapshots/blocks/paragraph/paragraph-with-inlines.snap @@ -1,6 +1,6 @@ --- -source: core/tests/test_runner/mod.rs -info: "Test 'paragraph-paragraph-with-inlines' from: spec/markup/blocks/paragraph.yml" +source: core/tests/runner/mod.rs +info: "Test 'paragraph-with-inlines' from: markup/blocks/paragraph.yml" --- Paragraph(Paragraph **with** inlines.) --- diff --git a/core/tests/spec/snapshots/blocks/paragraph/simple-paragraph.snap b/core/tests/spec/snapshots/blocks/paragraph/simple-paragraph.snap index f4b6a58d..8b2b7083 100644 --- a/core/tests/spec/snapshots/blocks/paragraph/simple-paragraph.snap +++ b/core/tests/spec/snapshots/blocks/paragraph/simple-paragraph.snap @@ -1,7 +1,7 @@ --- -source: core/tests/test_runner/mod.rs +source: core/tests/runner/mod.rs description: "Parse a simple paragraph.\n" -info: "Test 'paragraph-simple-paragraph' from: spec/markup/blocks/paragraph.yml" +info: "Test 'simple-paragraph' from: markup/blocks/paragraph.yml" --- Paragraph(Simple paragraph.) --- diff --git a/core/tests/test_runner/mod.rs b/core/tests/test_runner/mod.rs deleted file mode 100644 index 71a7d36e..00000000 --- a/core/tests/test_runner/mod.rs +++ /dev/null @@ -1,112 +0,0 @@ -use std::ops::Deref; -use std::path::{Path, PathBuf}; - -use unimarkup_commons::run_spec_test; -use unimarkup_commons::test_runner::as_snapshot::AsSnapshot; -use unimarkup_commons::test_runner::snap_test_runner::SnapTestRunner; -use unimarkup_commons::test_runner::test_file::{Test, TestOutputs}; -use unimarkup_parser::elements::atomic::Paragraph; -use unimarkup_parser::elements::blocks::Block; -use unimarkup_parser::elements::Blocks; -use unimarkup_parser::ParserGenerator; - -#[derive(Debug)] -pub(crate) struct Snapshot(T); - -impl Deref for Snapshot { - type Target = T; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl AsSnapshot for Snapshot { - fn as_snapshot(&self) -> String { - self.0 - .iter() - .map(|block| Snapshot(block).as_snapshot()) - .collect() - } -} - -impl AsSnapshot for Snapshot<&Block> { - fn as_snapshot(&self) -> String { - match **self { - Block::Paragraph(block) => Snapshot(block).as_snapshot(), - _ => unimplemented!("TODO: Implement snapshot for {:?}", self), - } - } -} - -macro_rules! snapshot_parser { - ($ty:ty) => { - |input| { - let parse = <$ty>::generate_parser(); - - parse(input) - .map(|(block, rest)| (Snapshot(block).as_snapshot(), rest)) - .expect("Could not parse content!") - } - }; -} - -macro_rules! spec_parser { - () => { - |test: &Test, cfg| { - let input = test.input.trim_end(); - - let um = unimarkup_core::Unimarkup::parse(input, cfg); - - TestOutputs { - html: Some(um.render_html().unwrap().to_string()), - um: Some(test.input.clone()), - } - } - }; -} - -pub fn gen_path(input_path: &str) -> (PathBuf, PathBuf) { - let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .canonicalize() - .unwrap(); - - path.push("tests/"); - let sanitized_filepath = if input_path.starts_with(|c| c == '/' || c == '\\') { - &input_path[1..] - } else { - input_path - }; - path.push(sanitized_filepath); - - let mut snap_path: PathBuf = path - .components() - .skip_while(|component| Path::new(component) != Path::new("markup")) - .skip(1) - .collect(); - - snap_path.set_extension(""); - - (path, snap_path) -} - -#[test] -pub fn paragraph_parser() { - unimarkup_commons::test_parser_snap!( - gen_path("spec/markup/blocks/paragraph.yml"), - snapshot_parser!(Paragraph) - ); -} - -#[test] -pub fn paragraph_with_main_parser() { - unimarkup_commons::test_parser_snap!( - gen_path("spec/markup/blocks/paragraph.yml"), - snapshot_parser!(Paragraph) - ); -} - -#[test] -pub fn paragraph_spec() { - run_spec_test!(gen_path("spec/markup/blocks/paragraph.yml"), spec_parser!()); -} diff --git a/core/tests/tests.rs b/core/tests/tests.rs index cd2eaf04..e0b6ae0f 100644 --- a/core/tests/tests.rs +++ b/core/tests/tests.rs @@ -1,19 +1,40 @@ -#![allow(non_snake_case)] // allows using `__` for better separation in functionnames +#![allow(non_snake_case)] -// allows using `__` for better separation in functionnames -#[allow(non_snake_case)] -mod elements { - mod heading; - mod inline; - mod paragraph; +mod general { + pub mod metadata; + pub mod unimarkup; } -// allows using `__` for better separation in functionnames -#[allow(non_snake_case)] -mod general { - mod metadata; - mod unimarkup; +pub mod runner; +pub mod snapshot; + +macro_rules! test_fn { + ($fn: path) => {{ + let try_run = ::std::panic::catch_unwind($fn).map_err(|err| { + let panic_msg = err + .downcast_ref::<&str>() + .unwrap_or(&"Panic message not available"); + + format!("Test case panicked: {}", panic_msg).into() + }); + + libtest_mimic::Trial::test(stringify!($fn), || try_run) + }}; } -mod test_runner; +fn main() { + let args = libtest_mimic::Arguments::from_args(); + + let mut tests = runner::test_core_snapshots(); + tests.extend(collect_tests()); + + libtest_mimic::run(&args, tests).exit(); +} + +fn collect_tests() -> impl IntoIterator { + [ + test_fn!(general::metadata::test__metadata__create_from_memory), + test_fn!(general::unimarkup::compile_empty_content), + ] +} diff --git a/inline/src/inlines/substitute.rs b/inline/src/inlines/substitute.rs index 9980620e..1fffef5c 100644 --- a/inline/src/inlines/substitute.rs +++ b/inline/src/inlines/substitute.rs @@ -83,7 +83,7 @@ pub(crate) struct Substitutor<'a> { impl<'sub> Substitutor<'sub> { pub(crate) fn new() -> Self { - let direct: HashMap<_, _> = EMOJIS.into_iter().chain(ARROWS.into_iter()).collect(); + let direct: HashMap<_, _> = EMOJIS.into_iter().chain(ARROWS).collect(); let aliased = ALIASES.into_iter().collect(); let max_len = direct.keys().map(|key| key.len()).max().unwrap_or(0); let first_grapheme = direct.keys().map(|key| &key[0..1]).collect(); diff --git a/inline/tests/lexer/mod.rs b/inline/tests/lexer/mod.rs index de4a3ca3..834b6e46 100644 --- a/inline/tests/lexer/mod.rs +++ b/inline/tests/lexer/mod.rs @@ -9,10 +9,16 @@ use crate::snapshot::Snapshot; mod snapshot; pub fn test_lexer_snapshots() -> Vec { - let test_cases = crate::prepare_test_cases("spec/markup", "spec/snapshots/lexer"); + let tests_path = unimarkup_commons::crate_tests_path!(); + let test_cases = test_runner::collect_tests( + tests_path.join("spec/markup"), + tests_path.join("spec/snapshots/lexer"), + "markup", + ); + let mut test_runs = Vec::with_capacity(test_cases.len()); for case in test_cases { - let test_name = format!("{}::{}", module_path!(), case.name.as_str()); + let test_name = format!("{}::{}", module_path!(), case.test.name.as_str()); let test_run = move || { panic::catch_unwind(|| run_test_case(case)).map_err(|err| { @@ -30,14 +36,17 @@ pub fn test_lexer_snapshots() -> Vec { test_runs } -fn run_test_case(case: crate::TestCase) { - let symbols = test_runner::scan_str(&case.input); - let runner = SnapTestRunner::with_fn(&case.name, &symbols, |symbols| { +fn run_test_case(case: test_runner::test_file::TestCase) { + let symbols = test_runner::scan_str(&case.test.input); + let runner = SnapTestRunner::with_fn(&case.test.name, &symbols, |symbols| { let rest = &[]; - let snapshot = Snapshot::snap((case.input.as_ref(), symbols.tokens())); + let snapshot = Snapshot::snap((case.test.input.as_ref(), symbols.tokens())); (snapshot, rest) }) - .with_info(format!("Test '{}' from '{}'", case.name, case.file_name)); + .with_info(format!( + "Test '{}' from '{}'", + case.test.name, case.file_path + )); unimarkup_commons::run_snap_test!(runner, &case.out_path); } diff --git a/inline/tests/mod.rs b/inline/tests/mod.rs index 4c9c4eb2..915d4b8d 100644 --- a/inline/tests/mod.rs +++ b/inline/tests/mod.rs @@ -1,8 +1,3 @@ -use std::{ - fs::DirEntry, - path::{Path, PathBuf}, -}; - mod lexer; mod parser; mod snapshot; @@ -11,7 +6,6 @@ use lexer::test_lexer_snapshots; use libtest_mimic::Arguments; use parser::test_parser_snapshots; pub(crate) use snapshot::*; -use unimarkup_commons::test_runner::test_file::TestFile; fn main() { let args = Arguments::from_args(); @@ -23,126 +17,3 @@ fn main() { libtest_mimic::run(&args, tests).exit(); } - -pub struct TestCase { - name: String, - input: String, - file_name: String, - out_path: PathBuf, -} - -/// Generates test cases from test files -/// -/// # Arguments -/// * `markups` - Path to the folder containing the (input) test files -/// * `output` - Path to the folder where the (output) snapshot files will be saved -pub fn prepare_test_cases(markups: impl AsRef, output: impl AsRef) -> Vec { - let mut markups_path = crate::tests_path(); - markups_path.push(markups); - - let entries = crate::collect_entries(markups_path, "yml").unwrap(); - - let cases = entries.iter().flat_map(|entry| { - let path = entry.path(); - let input = std::fs::read_to_string(&path).unwrap(); - - let mut test_file: TestFile = serde_yaml::from_str(&input).unwrap(); - - let output = output.as_ref(); - let cases = test_file.tests.drain(..).map(move |test| { - let file_name = path.file_name().and_then(|file| file.to_str()).unwrap(); - let out_path = crate::gen_snap_path(output, &path); - - TestCase { - name: test.name, - input: test.input, - file_name: String::from(file_name), - out_path, - } - }); - - cases.collect::>() - }); - - cases.collect() -} - -/// Returns the absolute path to the integration `tests` folder. -pub fn tests_path() -> PathBuf { - let curr = std::env!("CARGO_MANIFEST_DIR"); - - let mut buf = PathBuf::from(curr); - buf.push("tests"); - - buf -} - -/// Finds all files with the given extension in the given path (recursively). -pub fn collect_entries(path: impl AsRef, ext: &str) -> std::io::Result> { - let mut entries = vec![]; - - if path.as_ref().is_dir() { - for entry in std::fs::read_dir(path)? { - let entry = entry?; - let path = entry.path(); - - if path.is_dir() { - entries.append(&mut collect_entries(path, ext)?); - } else if path.extension().and_then(|ext| ext.to_str()).unwrap_or("") == ext { - entries.push(entry); - } - } - } - - Ok(entries) -} - -/// Generates the output path for the given test name. -/// -/// # Arguments -/// -/// * `out_folder` - The folder to write the snapshots to, relative to the `tests` folder. -/// * `test_file` - The path to the input test file relative to the integration `tests` -/// folder. Path will be generated with the help of `test_file`'s name. -/// -/// # Example -/// ``` -/// use unimarkup_inline::gen_snap_path; -/// -/// let in_file_path = "spec/markup/underline.yml"; -/// let path = gen_snap_path("spec/snapshots/lexer"); -/// -/// assert_eq!(&path, Path::new("tests/spec/snapshots/lexer/markup/underline")); -/// ``` -pub fn gen_snap_path(out_folder: F, test_file: T) -> PathBuf -where - F: AsRef, - T: AsRef, -{ - let mut path = crate::tests_path(); - path.push(out_folder); - - let mut snap_path: PathBuf = test_file - .as_ref() - .components() - .skip_while(|component| Path::new(component) != Path::new("markup")) - .skip(1) - .collect(); - - snap_path.set_extension(""); - - path.push(snap_path); - path -} - -#[test] -fn test_gen_snap_path() { - let in_file_path = Path::new("spec/tmp/markup/temp_file.yml"); - - let path = gen_snap_path("spec/tmp/snapshot/", in_file_path); - - let mut expected = crate::tests_path(); - expected.push("spec/tmp/snapshot/temp_file"); - - assert_eq!(path, expected.as_path()); -} diff --git a/inline/tests/parser/mod.rs b/inline/tests/parser/mod.rs index 3c35a1a5..14716d3f 100644 --- a/inline/tests/parser/mod.rs +++ b/inline/tests/parser/mod.rs @@ -8,11 +8,16 @@ use unimarkup_inline::ParseInlines; mod snapshot; pub fn test_parser_snapshots() -> Vec { - let test_cases = crate::prepare_test_cases("spec/markup", "spec/snapshots/parser"); - let mut test_runs = Vec::with_capacity(test_cases.len()); + let tests_path = unimarkup_commons::crate_tests_path!(); + let test_cases = test_runner::collect_tests( + tests_path.join("spec/markup"), + tests_path.join("spec/snapshots/parser"), + "markup", + ); + let mut test_runs = Vec::with_capacity(test_cases.len()); for case in test_cases { - let test_name = format!("{}::{}", module_path!(), case.name.as_str()); + let test_name = format!("{}::{}", module_path!(), case.test.name.as_str()); let test_run = move || { panic::catch_unwind(|| run_test_case(case)).map_err(|err| { @@ -30,16 +35,19 @@ pub fn test_parser_snapshots() -> Vec { test_runs } -fn run_test_case(case: crate::TestCase) { - let symbols = test_runner::scan_str(&case.input); +fn run_test_case(case: test_runner::test_file::TestCase) { + let symbols = test_runner::scan_str(&case.test.input); - let runner = SnapTestRunner::with_fn(&case.name, &symbols, |symbols| { + let runner = SnapTestRunner::with_fn(&case.test.name, &symbols, |symbols| { let rest: &[_] = &[]; let inlines: Vec<_> = symbols.parse_inlines().collect(); let snapshot = Snapshot::snap(&inlines[..]); (snapshot, rest) }) - .with_info(format!("Test '{}' from '{}'", case.name, case.file_name)); + .with_info(format!( + "Test '{}' from '{}'", + case.test.name, case.file_path + )); unimarkup_commons::run_snap_test!(runner, &case.out_path); } diff --git a/inline/tests/spec/snapshots/lexer/bold/bold-in-middle.snap b/inline/tests/spec/snapshots/lexer/bold/bold-in-middle.snap index 02d57077..a37fb690 100644 --- a/inline/tests/spec/snapshots/lexer/bold/bold-in-middle.snap +++ b/inline/tests/spec/snapshots/lexer/bold/bold-in-middle.snap @@ -1,6 +1,6 @@ --- source: inline/tests/lexer/mod.rs -info: "Test 'bold-in-middle' from 'bold.yml'" +info: "Test 'bold-in-middle' from 'markup/bold.yml'" --- The next **word** is bold. The diff --git a/inline/tests/spec/snapshots/lexer/bold/bold-not-bold.snap b/inline/tests/spec/snapshots/lexer/bold/bold-not-bold.snap index ee5d208a..788a2695 100644 --- a/inline/tests/spec/snapshots/lexer/bold/bold-not-bold.snap +++ b/inline/tests/spec/snapshots/lexer/bold/bold-not-bold.snap @@ -1,6 +1,6 @@ --- source: inline/tests/lexer/mod.rs -info: "Test 'bold-not-bold' from 'bold.yml'" +info: "Test 'bold-not-bold' from 'markup/bold.yml'" --- **Bold** not bold. ** diff --git a/inline/tests/spec/snapshots/lexer/bold/escaped-bold.snap b/inline/tests/spec/snapshots/lexer/bold/escaped-bold.snap index bbb8096b..770d7b05 100644 --- a/inline/tests/spec/snapshots/lexer/bold/escaped-bold.snap +++ b/inline/tests/spec/snapshots/lexer/bold/escaped-bold.snap @@ -1,6 +1,6 @@ --- source: inline/tests/lexer/mod.rs -info: "Test 'escaped-bold' from 'bold.yml'" +info: "Test 'escaped-bold' from 'markup/bold.yml'" --- \*\*not bold\*\* ␢* diff --git a/inline/tests/spec/snapshots/lexer/bold/not-bold.snap b/inline/tests/spec/snapshots/lexer/bold/not-bold.snap index bebb8ef8..1296ba41 100644 --- a/inline/tests/spec/snapshots/lexer/bold/not-bold.snap +++ b/inline/tests/spec/snapshots/lexer/bold/not-bold.snap @@ -1,6 +1,6 @@ --- source: inline/tests/lexer/mod.rs -info: "Test 'not-bold' from 'bold.yml'" +info: "Test 'not-bold' from 'markup/bold.yml'" --- ** not bold ** ** diff --git a/inline/tests/spec/snapshots/lexer/bold/not-closed-bold.snap b/inline/tests/spec/snapshots/lexer/bold/not-closed-bold.snap index 0f6060d3..78e8f7f4 100644 --- a/inline/tests/spec/snapshots/lexer/bold/not-closed-bold.snap +++ b/inline/tests/spec/snapshots/lexer/bold/not-closed-bold.snap @@ -1,6 +1,6 @@ --- source: inline/tests/lexer/mod.rs -info: "Test 'not-closed-bold' from 'bold.yml'" +info: "Test 'not-closed-bold' from 'markup/bold.yml'" --- **not bold ** ** diff --git a/inline/tests/spec/snapshots/lexer/bold/not-opened-bold.snap b/inline/tests/spec/snapshots/lexer/bold/not-opened-bold.snap index 308dde37..d94b5533 100644 --- a/inline/tests/spec/snapshots/lexer/bold/not-opened-bold.snap +++ b/inline/tests/spec/snapshots/lexer/bold/not-opened-bold.snap @@ -1,6 +1,6 @@ --- source: inline/tests/lexer/mod.rs -info: "Test 'not-opened-bold' from 'bold.yml'" +info: "Test 'not-opened-bold' from 'markup/bold.yml'" --- ** not bold** ** diff --git a/inline/tests/spec/snapshots/lexer/bold/simple-bold.snap b/inline/tests/spec/snapshots/lexer/bold/simple-bold.snap index 0c18c4f4..a6cda6ae 100644 --- a/inline/tests/spec/snapshots/lexer/bold/simple-bold.snap +++ b/inline/tests/spec/snapshots/lexer/bold/simple-bold.snap @@ -1,6 +1,6 @@ --- source: inline/tests/lexer/mod.rs -info: "Test 'simple-bold' from: 'bold.yml'" +info: "Test 'simple-bold' from 'markup/bold.yml'" --- **Bold** ** diff --git a/inline/tests/spec/snapshots/lexer/plain/breaking-unicode.snap b/inline/tests/spec/snapshots/lexer/plain/breaking-unicode.snap index 53ba1b62..43c4a846 100644 --- a/inline/tests/spec/snapshots/lexer/plain/breaking-unicode.snap +++ b/inline/tests/spec/snapshots/lexer/plain/breaking-unicode.snap @@ -1,6 +1,6 @@ --- source: inline/tests/lexer/mod.rs -info: "Test 'breaking-unicode' from 'plain.yml'" +info: "Test 'breaking-unicode' from 'markup/plain.yml'" --- The character 𝛂 broke some stuff. The diff --git a/inline/tests/spec/snapshots/lexer/plain/simple-plain.snap b/inline/tests/spec/snapshots/lexer/plain/simple-plain.snap index cff09e92..0404d095 100644 --- a/inline/tests/spec/snapshots/lexer/plain/simple-plain.snap +++ b/inline/tests/spec/snapshots/lexer/plain/simple-plain.snap @@ -1,6 +1,6 @@ --- source: inline/tests/lexer/mod.rs -info: "Test 'simple-plain' from 'plain.yml'" +info: "Test 'simple-plain' from 'markup/plain.yml'" --- Simple text. Simple diff --git a/inline/tests/spec/snapshots/lexer/verbatim/escaped-verbatim.snap b/inline/tests/spec/snapshots/lexer/verbatim/escaped-verbatim.snap index b6d789d7..9e619879 100644 --- a/inline/tests/spec/snapshots/lexer/verbatim/escaped-verbatim.snap +++ b/inline/tests/spec/snapshots/lexer/verbatim/escaped-verbatim.snap @@ -1,6 +1,6 @@ --- source: inline/tests/lexer/mod.rs -info: "Test 'escaped-verbatim' from 'verbatim.yml'" +info: "Test 'escaped-verbatim' from 'markup/verbatim.yml'" --- \`not verbatim\` ␢` diff --git a/inline/tests/spec/snapshots/lexer/verbatim/not-closed-verbatim.snap b/inline/tests/spec/snapshots/lexer/verbatim/not-closed-verbatim.snap index ae673e73..cbacaa05 100644 --- a/inline/tests/spec/snapshots/lexer/verbatim/not-closed-verbatim.snap +++ b/inline/tests/spec/snapshots/lexer/verbatim/not-closed-verbatim.snap @@ -1,6 +1,6 @@ --- source: inline/tests/lexer/mod.rs -info: "Test 'not-closed-verbatim' from 'verbatim.yml'" +info: "Test 'not-closed-verbatim' from 'markup/verbatim.yml'" --- `not verbatim ` ` diff --git a/inline/tests/spec/snapshots/lexer/verbatim/not-opened-verbatim.snap b/inline/tests/spec/snapshots/lexer/verbatim/not-opened-verbatim.snap index 5f1d8b3b..3646f560 100644 --- a/inline/tests/spec/snapshots/lexer/verbatim/not-opened-verbatim.snap +++ b/inline/tests/spec/snapshots/lexer/verbatim/not-opened-verbatim.snap @@ -1,6 +1,6 @@ --- source: inline/tests/lexer/mod.rs -info: "Test 'not-opened-verbatim' from 'verbatim.yml'" +info: "Test 'not-opened-verbatim' from 'markup/verbatim.yml'" --- ` not verbatim` ` diff --git a/inline/tests/spec/snapshots/lexer/verbatim/not-verbatim.snap b/inline/tests/spec/snapshots/lexer/verbatim/not-verbatim.snap index 3039e644..aa1ff28c 100644 --- a/inline/tests/spec/snapshots/lexer/verbatim/not-verbatim.snap +++ b/inline/tests/spec/snapshots/lexer/verbatim/not-verbatim.snap @@ -1,6 +1,6 @@ --- source: inline/tests/lexer/mod.rs -info: "Test 'not-verbatim' from 'verbatim.yml'" +info: "Test 'not-verbatim' from 'markup/verbatim.yml'" --- ` not verbatim ` ` diff --git a/inline/tests/spec/snapshots/lexer/verbatim/simple-verbatim.snap b/inline/tests/spec/snapshots/lexer/verbatim/simple-verbatim.snap index f67ef28d..4b889f75 100644 --- a/inline/tests/spec/snapshots/lexer/verbatim/simple-verbatim.snap +++ b/inline/tests/spec/snapshots/lexer/verbatim/simple-verbatim.snap @@ -1,6 +1,6 @@ --- source: inline/tests/lexer/mod.rs -info: "Test 'simple-verbatim' from 'verbatim.yml'" +info: "Test 'simple-verbatim' from 'markup/verbatim.yml'" --- `Verbatim` ` diff --git a/inline/tests/spec/snapshots/lexer/verbatim/verbatim-in-middle.snap b/inline/tests/spec/snapshots/lexer/verbatim/verbatim-in-middle.snap index 41889f0f..cf106db0 100644 --- a/inline/tests/spec/snapshots/lexer/verbatim/verbatim-in-middle.snap +++ b/inline/tests/spec/snapshots/lexer/verbatim/verbatim-in-middle.snap @@ -1,6 +1,6 @@ --- source: inline/tests/lexer/mod.rs -info: "Test 'verbatim-in-middle' from 'verbatim.yml'" +info: "Test 'verbatim-in-middle' from 'markup/verbatim.yml'" --- The next `word` is verbatim. The diff --git a/inline/tests/spec/snapshots/lexer/verbatim/verbatim-not-verbatim.snap b/inline/tests/spec/snapshots/lexer/verbatim/verbatim-not-verbatim.snap index 0a7a8663..c2faf006 100644 --- a/inline/tests/spec/snapshots/lexer/verbatim/verbatim-not-verbatim.snap +++ b/inline/tests/spec/snapshots/lexer/verbatim/verbatim-not-verbatim.snap @@ -1,6 +1,6 @@ --- source: inline/tests/lexer/mod.rs -info: "Test 'verbatim-not-verbatim' from 'verbatim.yml'" +info: "Test 'verbatim-not-verbatim' from 'markup/verbatim.yml'" --- `Verbatim` not verbatim. ` diff --git a/inline/tests/spec/snapshots/parser/bold/bold-in-middle.snap b/inline/tests/spec/snapshots/parser/bold/bold-in-middle.snap index fb69b78b..caa1d8fd 100644 --- a/inline/tests/spec/snapshots/parser/bold/bold-in-middle.snap +++ b/inline/tests/spec/snapshots/parser/bold/bold-in-middle.snap @@ -1,6 +1,6 @@ --- source: inline/tests/parser/mod.rs -info: "Test 'bold-in-middle' from 'bold.yml'" +info: "Test 'bold-in-middle' from 'markup/bold.yml'" --- Plain @ (1:1)->(1:10) ( The next diff --git a/inline/tests/spec/snapshots/parser/bold/bold-not-bold.snap b/inline/tests/spec/snapshots/parser/bold/bold-not-bold.snap index cebedbc2..d0c7cb5b 100644 --- a/inline/tests/spec/snapshots/parser/bold/bold-not-bold.snap +++ b/inline/tests/spec/snapshots/parser/bold/bold-not-bold.snap @@ -1,6 +1,6 @@ --- source: inline/tests/parser/mod.rs -info: "Test 'bold-not-bold' from 'bold.yml'" +info: "Test 'bold-not-bold' from 'markup/bold.yml'" --- Bold @ (1:1)->(1:9) ( Plain @ (1:3)->(1:7) ( diff --git a/inline/tests/spec/snapshots/parser/bold/escaped-bold.snap b/inline/tests/spec/snapshots/parser/bold/escaped-bold.snap index 693f8320..e7fc9814 100644 --- a/inline/tests/spec/snapshots/parser/bold/escaped-bold.snap +++ b/inline/tests/spec/snapshots/parser/bold/escaped-bold.snap @@ -1,6 +1,6 @@ --- source: inline/tests/parser/mod.rs -info: "Test 'escaped-bold' from 'bold.yml'" +info: "Test 'escaped-bold' from 'markup/bold.yml'" --- Plain @ (1:1)->(1:17) ( ␢␢**not bold**␢␢ diff --git a/inline/tests/spec/snapshots/parser/bold/not-bold.snap b/inline/tests/spec/snapshots/parser/bold/not-bold.snap index a6239bb6..59fb26c5 100644 --- a/inline/tests/spec/snapshots/parser/bold/not-bold.snap +++ b/inline/tests/spec/snapshots/parser/bold/not-bold.snap @@ -1,6 +1,6 @@ --- source: inline/tests/parser/mod.rs -info: "Test 'not-bold' from 'bold.yml'" +info: "Test 'not-bold' from 'markup/bold.yml'" --- Plain @ (1:1)->(1:15) ( ** not bold ** diff --git a/inline/tests/spec/snapshots/parser/bold/not-closed-bold.snap b/inline/tests/spec/snapshots/parser/bold/not-closed-bold.snap index 861a3a1e..25f2213b 100644 --- a/inline/tests/spec/snapshots/parser/bold/not-closed-bold.snap +++ b/inline/tests/spec/snapshots/parser/bold/not-closed-bold.snap @@ -1,6 +1,6 @@ --- source: inline/tests/parser/mod.rs -info: "Test 'not-closed-bold' from 'bold.yml'" +info: "Test 'not-closed-bold' from 'markup/bold.yml'" --- Plain @ (1:1)->(1:14) ( **not bold ** diff --git a/inline/tests/spec/snapshots/parser/bold/not-opened-bold.snap b/inline/tests/spec/snapshots/parser/bold/not-opened-bold.snap index 8fa65f5a..33ce4980 100644 --- a/inline/tests/spec/snapshots/parser/bold/not-opened-bold.snap +++ b/inline/tests/spec/snapshots/parser/bold/not-opened-bold.snap @@ -1,6 +1,6 @@ --- source: inline/tests/parser/mod.rs -info: "Test 'not-opened-bold' from 'bold.yml'" +info: "Test 'not-opened-bold' from 'markup/bold.yml'" --- Plain @ (1:1)->(1:14) ( ** not bold** diff --git a/inline/tests/spec/snapshots/parser/bold/simple-bold.snap b/inline/tests/spec/snapshots/parser/bold/simple-bold.snap index fa42417f..a197d9d3 100644 --- a/inline/tests/spec/snapshots/parser/bold/simple-bold.snap +++ b/inline/tests/spec/snapshots/parser/bold/simple-bold.snap @@ -1,6 +1,6 @@ --- source: inline/tests/parser/mod.rs -info: "Test 'simple-bold' from 'bold.yml'" +info: "Test 'simple-bold' from 'markup/bold.yml'" --- Bold @ (1:1)->(1:9) ( Plain @ (1:3)->(1:7) ( diff --git a/inline/tests/spec/snapshots/parser/plain/breaking-unicode.snap b/inline/tests/spec/snapshots/parser/plain/breaking-unicode.snap index 0e1ac3af..dc01f9ee 100644 --- a/inline/tests/spec/snapshots/parser/plain/breaking-unicode.snap +++ b/inline/tests/spec/snapshots/parser/plain/breaking-unicode.snap @@ -1,6 +1,6 @@ --- source: inline/tests/parser/mod.rs -info: "Test 'breaking-unicode' from 'plain.yml'" +info: "Test 'breaking-unicode' from 'markup/plain.yml'" --- Plain @ (1:1)->(1:34) ( The character 𝛂 broke some stuff. diff --git a/inline/tests/spec/snapshots/parser/plain/simple-plain.snap b/inline/tests/spec/snapshots/parser/plain/simple-plain.snap index 235c2e4a..e2a1267e 100644 --- a/inline/tests/spec/snapshots/parser/plain/simple-plain.snap +++ b/inline/tests/spec/snapshots/parser/plain/simple-plain.snap @@ -1,6 +1,6 @@ --- source: inline/tests/parser/mod.rs -info: "Test 'simple-plain' from 'plain.yml'" +info: "Test 'simple-plain' from 'markup/plain.yml'" --- Plain @ (1:1)->(1:13) ( Simple text. diff --git a/inline/tests/spec/snapshots/parser/verbatim/escaped-verbatim.snap b/inline/tests/spec/snapshots/parser/verbatim/escaped-verbatim.snap index 3e93ac94..0be31f9e 100644 --- a/inline/tests/spec/snapshots/parser/verbatim/escaped-verbatim.snap +++ b/inline/tests/spec/snapshots/parser/verbatim/escaped-verbatim.snap @@ -1,6 +1,6 @@ --- source: inline/tests/parser/mod.rs -info: "Test 'escaped-verbatim' from 'verbatim.yml'" +info: "Test 'escaped-verbatim' from 'markup/verbatim.yml'" --- Plain @ (1:1)->(1:17) ( ␢`not verbatim`␢ diff --git a/inline/tests/spec/snapshots/parser/verbatim/not-closed-verbatim.snap b/inline/tests/spec/snapshots/parser/verbatim/not-closed-verbatim.snap index 617605a6..b84f6b19 100644 --- a/inline/tests/spec/snapshots/parser/verbatim/not-closed-verbatim.snap +++ b/inline/tests/spec/snapshots/parser/verbatim/not-closed-verbatim.snap @@ -1,6 +1,6 @@ --- source: inline/tests/parser/mod.rs -info: "Test 'not-closed-verbatim' from 'verbatim.yml'" +info: "Test 'not-closed-verbatim' from 'markup/verbatim.yml'" --- Plain @ (1:1)->(1:16) ( `not verbatim ` diff --git a/inline/tests/spec/snapshots/parser/verbatim/not-opened-verbatim.snap b/inline/tests/spec/snapshots/parser/verbatim/not-opened-verbatim.snap index 82dc3898..924efdb7 100644 --- a/inline/tests/spec/snapshots/parser/verbatim/not-opened-verbatim.snap +++ b/inline/tests/spec/snapshots/parser/verbatim/not-opened-verbatim.snap @@ -1,6 +1,6 @@ --- source: inline/tests/parser/mod.rs -info: "Test 'not-opened-verbatim' from 'verbatim.yml'" +info: "Test 'not-opened-verbatim' from 'markup/verbatim.yml'" --- Plain @ (1:1)->(1:16) ( ` not verbatim` diff --git a/inline/tests/spec/snapshots/parser/verbatim/not-verbatim.snap b/inline/tests/spec/snapshots/parser/verbatim/not-verbatim.snap index c676d72c..205c613b 100644 --- a/inline/tests/spec/snapshots/parser/verbatim/not-verbatim.snap +++ b/inline/tests/spec/snapshots/parser/verbatim/not-verbatim.snap @@ -1,6 +1,6 @@ --- source: inline/tests/parser/mod.rs -info: "Test 'not-verbatim' from 'verbatim.yml'" +info: "Test 'not-verbatim' from 'markup/verbatim.yml'" --- Plain @ (1:1)->(1:17) ( ` not verbatim ` diff --git a/inline/tests/spec/snapshots/parser/verbatim/simple-verbatim.snap b/inline/tests/spec/snapshots/parser/verbatim/simple-verbatim.snap index 77584d45..93270611 100644 --- a/inline/tests/spec/snapshots/parser/verbatim/simple-verbatim.snap +++ b/inline/tests/spec/snapshots/parser/verbatim/simple-verbatim.snap @@ -1,6 +1,6 @@ --- source: inline/tests/parser/mod.rs -info: "Test 'simple-verbatim' from 'verbatim.yml'" +info: "Test 'simple-verbatim' from 'markup/verbatim.yml'" --- Verbatim @ (1:1)->(1:11) ( ␢Verbatim␢ diff --git a/inline/tests/spec/snapshots/parser/verbatim/verbatim-in-middle.snap b/inline/tests/spec/snapshots/parser/verbatim/verbatim-in-middle.snap index c0da02f7..8a14360e 100644 --- a/inline/tests/spec/snapshots/parser/verbatim/verbatim-in-middle.snap +++ b/inline/tests/spec/snapshots/parser/verbatim/verbatim-in-middle.snap @@ -1,6 +1,6 @@ --- source: inline/tests/parser/mod.rs -info: "Test 'verbatim-in-middle' from 'verbatim.yml'" +info: "Test 'verbatim-in-middle' from 'markup/verbatim.yml'" --- Plain @ (1:1)->(1:10) ( The next diff --git a/inline/tests/spec/snapshots/parser/verbatim/verbatim-not-verbatim.snap b/inline/tests/spec/snapshots/parser/verbatim/verbatim-not-verbatim.snap index 7cb84eb1..5808d75a 100644 --- a/inline/tests/spec/snapshots/parser/verbatim/verbatim-not-verbatim.snap +++ b/inline/tests/spec/snapshots/parser/verbatim/verbatim-not-verbatim.snap @@ -1,6 +1,6 @@ --- source: inline/tests/parser/mod.rs -info: "Test 'verbatim-not-verbatim' from 'verbatim.yml'" +info: "Test 'verbatim-not-verbatim' from 'markup/verbatim.yml'" --- Verbatim @ (1:1)->(1:11) ( ␢Verbatim␢ diff --git a/parser/src/elements/atomic/heading.rs b/parser/src/elements/atomic/heading.rs index ce44887a..5d68e864 100644 --- a/parser/src/elements/atomic/heading.rs +++ b/parser/src/elements/atomic/heading.rs @@ -158,8 +158,12 @@ impl ElementParser for Heading { } fn parse(input: Vec>) -> Option { - let HeadingToken::Level(level) = input[0] else {return None}; - let HeadingToken::Content(symbols) = input[1] else {return None}; + let HeadingToken::Level(level) = input[0] else { + return None; + }; + let HeadingToken::Content(symbols) = input[1] else { + return None; + }; let inline_start = symbols.get(0)?.start; let content = symbols.parse_inlines().collect(); diff --git a/parser/src/elements/enclosed/verbatim.rs b/parser/src/elements/enclosed/verbatim.rs index 837ac397..3275e7f7 100644 --- a/parser/src/elements/enclosed/verbatim.rs +++ b/parser/src/elements/enclosed/verbatim.rs @@ -85,8 +85,12 @@ impl ElementParser for Verbatim { } fn parse(input: Vec>) -> Option { - let Token::Delimiter { line } = input.get(0)? else {return None}; - let Token::Content(symbols) = input.get(1)? else { return None }; + let Token::Delimiter { line } = input.get(0)? else { + return None; + }; + let Token::Content(symbols) = input.get(1)? else { + return None; + }; let content = Symbol::flatten(symbols)?; let block = Self { diff --git a/parser/src/parser.rs b/parser/src/parser.rs index 71272ebe..9000d20d 100644 --- a/parser/src/parser.rs +++ b/parser/src/parser.rs @@ -161,9 +161,7 @@ impl MainParser { pub fn parse_unimarkup(um_content: &str, config: &mut Config) -> Document { let parser = MainParser::default(); - let symbols = Scanner::try_new() - .expect("Must be valid provider.") - .scan_str(um_content); + let symbols = Scanner::default().scan_str(um_content); let blocks = parser.parse(symbols); diff --git a/render/src/render.rs b/render/src/render.rs index 20660859..f6e23333 100644 --- a/render/src/render.rs +++ b/render/src/render.rs @@ -2,7 +2,7 @@ use std::collections::VecDeque; -use unimarkup_commons::config::locid::Locale; +use unimarkup_commons::config::icu_locid::Locale; use unimarkup_inline::{types::*, Inline}; use unimarkup_parser::{ document::Document,