Skip to content

Commit

Permalink
Use locales in purposes test
Browse files Browse the repository at this point in the history
  • Loading branch information
reknih committed Apr 8, 2024
1 parent 22f4439 commit 7085f36
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/csl/rendering/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,8 @@ impl RenderCsl for citationberg::Date {
}

let base = if let Some(form) = self.form {
// Localized date formats can fail to print anything at all,
// especially if no locale is set.
let Some(base) = ctx.localized_date(form) else { return };
Some(base)
} else {
Expand Down
3 changes: 2 additions & 1 deletion tests/citeproc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ where
#[test]
fn purposes() {
let style = ArchivedStyle::by_name("apa").unwrap().get();
let locales = locales();
let Style::Independent(style) = style else {
panic!("test has dependent style");
};
Expand Down Expand Up @@ -624,7 +625,7 @@ fn purposes() {
vec![CitationItem::new(&item, None, None, false, Some(purpose))],
&style,
None,
&[],
&locales,
Some(1),
));

Expand Down

0 comments on commit 7085f36

Please sign in to comment.