mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-24 06:54:00 +00:00
Add smoke tests for previously uncovered combinations
I noticed a possible issue related to the $this->refSequence counter in the patch Ida9612d. Some of these counters might get messes up, but there was never a test that checked what will happen to the *next* reference then. I checked the test cases in this patch with a very old version of the codebase. Change-Id: If6e56f727dce5d0e5e38e048e602437597248a42
This commit is contained in:
parent
0013943a4a
commit
38a38ae472
75
tests/parser/citeSmokeTests.txt
Normal file
75
tests/parser/citeSmokeTests.txt
Normal file
|
@ -0,0 +1,75 @@
|
|||
!! test
|
||||
Smoke test for duplicated references with the same text
|
||||
!! wikitext
|
||||
<ref name="a">text</ref>
|
||||
<ref name="a">text</ref>
|
||||
<ref name="b">other</ref>
|
||||
!! html
|
||||
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
|
||||
<sup id="cite_ref-a_1-1" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
|
||||
</p>
|
||||
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">[2]</a></sup><div class="mw-references-wrap"><ol class="references">
|
||||
<li id="cite_note-a-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a_1-0">1.0</a></sup> <sup><a href="#cite_ref-a_1-1">1.1</a></sup></span> <span class="reference-text">text</span>
|
||||
</li>
|
||||
<li id="cite_note-b-2"><span class="mw-cite-backlink"><a href="#cite_ref-b_2-0">↑</a></span> <span class="reference-text">other</span>
|
||||
</li>
|
||||
</ol></div>
|
||||
!! end
|
||||
|
||||
!! test
|
||||
Smoke test for duplicated references with conflicting text
|
||||
!! wikitext
|
||||
<ref name="a">text</ref>
|
||||
<ref name="a">bad</ref>
|
||||
<ref name="b">other</ref>
|
||||
!! html
|
||||
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
|
||||
<sup id="cite_ref-a_1-1" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
|
||||
</p>
|
||||
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">[2]</a></sup><div class="mw-references-wrap"><ol class="references">
|
||||
<li id="cite_note-a-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a_1-0">1.0</a></sup> <sup><a href="#cite_ref-a_1-1">1.1</a></sup></span> <span class="reference-text">text <span class="error mw-ext-cite-error" lang="en" dir="ltr">Cite error: Invalid <code><ref></code> tag; name "a" defined multiple times with different content</span></span>
|
||||
</li>
|
||||
<li id="cite_note-b-2"><span class="mw-cite-backlink"><a href="#cite_ref-b_2-0">↑</a></span> <span class="reference-text">other</span>
|
||||
</li>
|
||||
</ol></div>
|
||||
!! end
|
||||
|
||||
!! test
|
||||
Smoke test for references that are reused *before* defined in the text
|
||||
!! wikitext
|
||||
<ref name="a" />
|
||||
<ref name="a">text</ref>
|
||||
<ref name="b">other</ref>
|
||||
!! html
|
||||
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
|
||||
<sup id="cite_ref-a_1-1" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
|
||||
</p>
|
||||
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">[2]</a></sup><div class="mw-references-wrap"><ol class="references">
|
||||
<li id="cite_note-a-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a_1-0">1.0</a></sup> <sup><a href="#cite_ref-a_1-1">1.1</a></sup></span> <span class="reference-text">text</span>
|
||||
</li>
|
||||
<li id="cite_note-b-2"><span class="mw-cite-backlink"><a href="#cite_ref-b_2-0">↑</a></span> <span class="reference-text">other</span>
|
||||
</li>
|
||||
</ol></div>
|
||||
!! end
|
||||
|
||||
!! test
|
||||
Smoke test for references that are reused *before* defined in <references>
|
||||
!! wikitext
|
||||
<ref name="a" />
|
||||
<ref name="a" />
|
||||
<ref name="b">other</ref>
|
||||
<references>
|
||||
<ref name="a">text</ref>
|
||||
</references>
|
||||
!! html
|
||||
<p><sup id="cite_ref-a_1-0" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
|
||||
<sup id="cite_ref-a_1-1" class="reference"><a href="#cite_note-a-1">[1]</a></sup>
|
||||
<sup id="cite_ref-b_2-0" class="reference"><a href="#cite_note-b-2">[2]</a></sup>
|
||||
</p>
|
||||
<div class="mw-references-wrap"><ol class="references">
|
||||
<li id="cite_note-a-1"><span class="mw-cite-backlink">↑ <sup><a href="#cite_ref-a_1-0">1.0</a></sup> <sup><a href="#cite_ref-a_1-1">1.1</a></sup></span> <span class="reference-text">text</span>
|
||||
</li>
|
||||
<li id="cite_note-b-2"><span class="mw-cite-backlink"><a href="#cite_ref-b_2-0">↑</a></span> <span class="reference-text">other</span>
|
||||
</li>
|
||||
</ol></div>
|
||||
!! end
|
Loading…
Reference in a new issue