Skip to content

Commit 2da9215

Browse files
authored
Merge pull request #112 from google/test-duplicates
Test that duplicates are handled correctly
2 parents a551c69 + 3d88367 commit 2da9215

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

i18n-helpers/src/bin/mdbook-xgettext.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,4 +280,29 @@ mod tests {
280280

281281
Ok(())
282282
}
283+
284+
#[test]
285+
fn test_create_catalog_duplicates() -> anyhow::Result<()> {
286+
let (ctx, _tmp) = create_render_context(&[
287+
("book.toml", "[book]"),
288+
("src/SUMMARY.md", "- [Foo](foo.md)"),
289+
(
290+
"src/foo.md",
291+
"# Foo\n\
292+
\n\
293+
Foo\n",
294+
),
295+
])?;
296+
297+
let catalog = create_catalog(&ctx)?;
298+
assert_eq!(
299+
catalog
300+
.messages()
301+
.map(|msg| (msg.source(), msg.msgid()))
302+
.collect::<Vec<_>>(),
303+
&[("src/SUMMARY.md:1 src/foo.md:1 src/foo.md:3", "Foo"),]
304+
);
305+
306+
Ok(())
307+
}
283308
}

0 commit comments

Comments
 (0)