tests: run tests with different lang settings

fix: parsing subscriber count on channel search itms
fix: add warnings for all date and numstr parsing
fix: error parsing search suggestions
This commit is contained in:
ThetaDev 2023-05-04 21:44:10 +02:00
parent 6a99540ef5
commit b88faa9d05
32 changed files with 6501 additions and 214 deletions

View file

@ -5571,17 +5571,19 @@ pub(crate) fn entry(lang: Language) -> Entry {
timeago_tokens: ::phf::Map {
key: 15467950696543387533,
disps: &[
(3, 5),
(0, 0),
(0, 1),
(2, 0),
],
entries: &[
("\u{e34}นาท\u{e35}\u{e35}\u{e48}\u{e48}านมา", TaToken { n: 1, unit: Some(TimeUnit::Second) }),
("\u{e31}นท\u{e35}\u{e48}\u{e48}านมา", TaToken { n: 1, unit: Some(TimeUnit::Day) }),
("นาท\u{e35}\u{e35}\u{e48}\u{e48}านมา", TaToken { n: 1, unit: Some(TimeUnit::Minute) }),
("\u{e31}\u{e48}วโมงท\u{e35}\u{e48}\u{e48}านมา", TaToken { n: 1, unit: Some(TimeUnit::Hour) }),
("\u{e31}ปดาห\u{e4c}\u{e35}\u{e48}\u{e48}านมา", TaToken { n: 1, unit: Some(TimeUnit::Week) }),
("\u{e35}\u{e35}\u{e48}แล\u{e49}", TaToken { n: 1, unit: Some(TimeUnit::Year) }),
("เด\u{e37}อนท\u{e35}\u{e48}\u{e48}านมา", TaToken { n: 1, unit: Some(TimeUnit::Month) }),
("\u{e31}\u{e48}วโมงท\u{e35}\u{e48}\u{e48}านมา", TaToken { n: 1, unit: Some(TimeUnit::Hour) }),
("นาท\u{e35}", TaToken { n: 1, unit: Some(TimeUnit::Minute) }),
("\u{e31}นท\u{e35}\u{e48}\u{e48}านมา", TaToken { n: 1, unit: Some(TimeUnit::Day) }),
("\u{e31}ปดาห\u{e4c}\u{e35}\u{e48}\u{e48}านมา", TaToken { n: 1, unit: Some(TimeUnit::Week) }),
("\u{e34}นาท\u{e35}", TaToken { n: 1, unit: Some(TimeUnit::Second) }),
("\u{e34}นาท\u{e35}\u{e35}\u{e48}\u{e48}านมา", TaToken { n: 1, unit: Some(TimeUnit::Second) }),
],
},
date_order: &[DateCmp::D, DateCmp::Y],

View file

@ -328,6 +328,21 @@ where
.ok()
}
pub fn parse_large_numstr_or_warn<F>(
string: &str,
lang: Language,
warnings: &mut Vec<String>,
) -> Option<F>
where
F: TryFrom<u64>,
{
let res = parse_large_numstr::<F>(string, lang);
if res.is_none() {
warnings.push(format!("could not parse numstr `{string}`"));
}
res
}
/// Replace all html control characters to make a string safe for inserting into HTML.
pub fn escape_html(input: &str) -> String {
let mut buf = String::with_capacity(input.len());