Skip to content

Commit

Permalink
new test to check for duplicate citations in markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
shyamd committed Apr 3, 2022
1 parent ed46045 commit 6aa672b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test_files/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,17 @@ def test_on_page_markdown(plugin):
in plugin.on_page_markdown(test_markdown, None, None, None)
)

test_markdown = "This is a citation. [@test] This is another citation [@test2]\n\n \\bibliography"
test_markdown = "This is a citation. [@test2] This is another citation [@test]\n\n \\bibliography"
# ensure there are two items in bibliography

assert "[^2]:" in plugin.on_page_markdown(test_markdown, None, None, None)

# Ensure if an item is referenced multiple times, it only shows up as one reference
test_markdown = "This is a citation. [@test] This is another citation [@test]\n\n \\bibliography"

assert "[^2]" not in plugin.on_page_markdown(test_markdown, None, None, None)

# Ensure item only shows up once even if used in multiple places as both a compound and lone cite key
test_markdown = "This is a citation. [@test; @test2] This is another citation [@test]\n\n \\bibliography"

assert "[^3]" not in plugin.on_page_markdown(test_markdown, None, None, None)

0 comments on commit 6aa672b

Please sign in to comment.