From a43bd5cda72ab90a165863492a4437833d82a745 Mon Sep 17 00:00:00 2001 From: Subramanya Sastry Date: Thu, 13 Jun 2013 18:36:05 -0500 Subject: [PATCH] Added parsoid-only tests for parsoid's native cite implementation Change-Id: If5cf091d7c6c864f6bd90165086a19ae38ec257e --- tests/parser/parserTests.txt | 348 +++++++++++++++++++++++++++++++++++ 1 file changed, 348 insertions(+) diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 4aadd7aed8..21a6b864e5 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -14018,6 +14018,353 @@ parsoid=wt2html,wt2wt
a
!!end +#### ---------------------------------------------------------------- +#### Parsoid-only testing of Parsoid's impl of and +#### tags. Parsoid's output for these tags differs from that of the +#### PHP parser. +#### ---------------------------------------------------------------- + +!!test +Ref: 1. ref-location should be replaced with an index span +!!options +parsoid +!!input +A foo +B foo +C +!!result +

A [1] +B [2] +C [3]

+!!end + +!!test +Ref: 2. ref-tags with identical names should all get the same index +!!options +parsoid +!!input +A foo +B +!!result +

A [1] +B [1]

+!!end + +!!test +Ref: 3. spaces in ref-names should be ignored +!!options +parsoid +!!input +A foo +B +C +!!result +

A [1] +B [1] +C [1]

+!!end + +!!test +Ref: 4. 'constructor' should be accepted as a valid ref-name +(NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly) +!!options +parsoid +!!input +A foo +!!result +

A [1]

+!!end + +!!test +Ref: 5. body should accept generic wikitext +!!options +parsoid +!!input +A + This is a '''[[bolded link]]''' and this is a {{echo|transclusion}} + + + +!!result +

A [1]

+ +
    +
  1. ↑ This is a bolded link and this is a transclusion +
+!!end + +!!test +Ref: 6. indent-pres should not be output in ref-body +!!options +parsoid +!!input +A + foo + bar + baz + + + +!!result +

A [1]

+ +
    +
  1. ↑ foo + bar + baz +
+!!end + +!!test +Ref: 6. No p-wrapping in ref-body +!!options +parsoid +!!input +A +foo + +bar + + +baz + + + +booz + + + +!!result +

A [1]

+ +
    +
  1. ↑ foo + +bar + + +baz + + + +booz +
+!!end + +!!test +Ref: 8. transclusion wikitext has lower precedence +!!options +parsoid +!!input +A foo {{echo| B C}} + + +!!result +

A [1] B C}}

+ +
    +
  1. ↑ foo {{echo|
+!!end + +!!test +Ref: 9. unclosed comments should not leak out of ref-body +!!options +parsoid +!!input +A foo "},"attrs":{}}' id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref">[1] B C

+ +
    +
  1. ↑ foo
+!!end + +!!test +Ref: 10. Unclosed HTML tags should not leak out of ref-body +!!options +parsoid +!!input +A foo B C + + +!!result +

A [1] B C

+ +
    +
  1. ↑ foo
+!!end + +!!test +Ref: 11. ref-tags acts like an inline element wrt P-wrapping +!!options +parsoid +!!input +A foo B +C bar D +!!result +

A [1] B +C [2] D

+!!end + +!!test +Ref: 12. ref-tags act as trailing newline migration barrier +!!options +parsoid +!!input +a + +b + + +c +!!result +

a

+ + +

b [1] +[2]

+ + +

c

+!!end + +!!test +Ref: 13. ref-tags are not SOL-transparent and block indent-pres +!!options +parsoid +!!input +foo A +bar + B +!!result +

[1] A +[2] B

+!!end + +!!test +Ref: 14. A nested ref-tag should be emitted as plain text +!!options +parsoid +!!input +foo bar baz + + +!!result +

[1] baz</ref>

+ +
  1. ↑ foo <ref>bar
+!!end + +!!test +Ref: 15. ref-tags with identical names should get identical indexes +!!options +parsoid +!!input +A1 foo A2 +B1 B2 bar + + +!!result +

A1 [1] A2 [1] +B1 [2] B2 [2]

+ +
  1. ↑ 1.0 1.1 foo
  2. ↑ 2.0 2.1 bar
+!!end + +!!test +References: 1. references tag without any refs should be handled properly +!!options +parsoid +!!input + +!!result +
    +!!end + +!!test +References: 2. references tag with group only outputs references from that group +!!options +parsoid +!!input +A foo +B bar + + +!!result +

    A [a 1] +B [b 1]

    + +
    1. ↑ foo
    +!!end + +!!test +References: 3. ref list should be cleared after processing references +!!options +parsoid +!!input +A foo + + + +B bar + + +!!result +

    A [1]

    + +
    1. ↑ foo
    + +

    B [1]

    + +
    1. ↑ bar
    +!!end + +!!test +References: 4. only referenced group should be cleared after processing references +!!options +parsoid +!!input +A afoo +B bfoo + + + +C cfoo + + +!!result +

    A [a 1] +B [1]

    + +
    1. ↑ afoo
    + +

    C [2]

    + +
    1. ↑ bfoo
    2. ↑ cfoo
    +!!end + +!!test +References: 5. ref tags in references should be processed while ignoring all other content +!!options +parsoid +!!input +A +B bar + + +foo +This should just get lost. + +!!result +

    A [1] +B [2]

    + +
    1. ↑ foo
    2. ↑ bar
    +!!end + +#### ---------------------------------------------------------------- #### The following section of tests are primarily to test #### wikitext escaping capabilities of Parsoid. Given that #### escaping can be done any number of ways, the wikitext (input) @@ -14027,6 +14374,7 @@ parsoid=wt2html,wt2wt #### We are marking several tests as parsoid-only since the #### HTML in the result section is different from what the #### PHP parser generates for it. +#### ---------------------------------------------------------------- #### --------------- Headings --------------- -- 2.20.1