Skip to content

Commit

Permalink
Ignore ASCII punctuation. Problems down to 46
Browse files Browse the repository at this point in the history
  • Loading branch information
sffc committed Nov 28, 2024
1 parent 3d2c3fe commit 9ed98cc
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions provider/source/src/datetime/neo_skeleton.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,24 +583,44 @@ mod date_skeleton_consistency_tests {
use icu::datetime::provider::pattern::PatternItem;

let mut items = core::mem::take(pattern).into_items();
for item in items.iter_mut() {
items.retain_mut(|item| {
match item {
PatternItem::Field(ref mut field @ Field {
symbol: FieldSymbol::Era,
length: FieldLength::Three
}) => {
field.length = FieldLength::One;
true
}
// For now, ignore differences between 'y' and 'yy'
PatternItem::Field(ref mut field @ Field {
length: FieldLength::Two,
..
}) => {
field.length = FieldLength::One;
true
}
// For now, ignore whitespace and ASCII punctuation
PatternItem::Literal(' ') => {
false
}
PatternItem::Literal('.') => {
false
}
PatternItem::Literal(',') => {
false
}
PatternItem::Literal('/') => {
false
}
PatternItem::Literal('-') => {
false
}
_ => {
true
}
_ => {}
}
}
});
*pattern = items.into();
}

Expand Down

0 comments on commit 9ed98cc

Please sign in to comment.