| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package org.xwiki.rendering.wikimodel.test; |
| 21 |
|
|
| 22 |
|
import org.xwiki.rendering.wikimodel.IWikiParser; |
| 23 |
|
import org.xwiki.rendering.wikimodel.WikiParserException; |
| 24 |
|
import org.xwiki.rendering.wikimodel.gwiki.GWikiParser; |
| 25 |
|
|
| 26 |
|
|
| 27 |
|
@version |
| 28 |
|
@since |
| 29 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (62) |
Complexity: 11 |
Complexity Density: 0.22 |
|
| 30 |
|
public class GWikiParserTest extends AbstractWikiParserTest |
| 31 |
|
{ |
| 32 |
|
|
| 33 |
|
@param |
| 34 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 35 |
9 |
public GWikiParserTest(String name)... |
| 36 |
|
{ |
| 37 |
9 |
super(name); |
| 38 |
|
} |
| 39 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 40 |
49 |
@Override... |
| 41 |
|
protected IWikiParser newWikiParser() |
| 42 |
|
{ |
| 43 |
49 |
return new GWikiParser(); |
| 44 |
|
} |
| 45 |
|
|
| 46 |
|
|
| 47 |
|
@throws |
| 48 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
| 49 |
1 |
public void testFormats() throws WikiParserException... |
| 50 |
|
{ |
| 51 |
1 |
test("*bold*"); |
| 52 |
1 |
test("~~strike~~"); |
| 53 |
1 |
test("_italic_"); |
| 54 |
1 |
test("^superscript^"); |
| 55 |
1 |
test(",,subscript,,"); |
| 56 |
|
|
| 57 |
1 |
test("normal*bold_bold-italic*italic_normal"); |
| 58 |
|
|
| 59 |
1 |
test("*bold"); |
| 60 |
1 |
test("~~strike"); |
| 61 |
1 |
test("_italic"); |
| 62 |
1 |
test("^superscript"); |
| 63 |
1 |
test(",,subscript"); |
| 64 |
|
|
| 65 |
1 |
test("bold*"); |
| 66 |
1 |
test("strike~~"); |
| 67 |
1 |
test("italic_"); |
| 68 |
1 |
test("superscript^"); |
| 69 |
1 |
test("subscript,,"); |
| 70 |
|
} |
| 71 |
|
|
| 72 |
|
|
| 73 |
|
@throws |
| 74 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
| 75 |
1 |
public void testHeaders() throws WikiParserException... |
| 76 |
|
{ |
| 77 |
1 |
test("===Header==="); |
| 78 |
1 |
test("\n===Header===\n * list item"); |
| 79 |
1 |
test("before\n=== Header ===\nafter"); |
| 80 |
1 |
test("before\n=== Header \nafter"); |
| 81 |
1 |
test("This is not a header: ==="); |
| 82 |
|
} |
| 83 |
|
|
| 84 |
|
|
| 85 |
|
@throws |
| 86 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
| 87 |
1 |
public void testLists() throws WikiParserException... |
| 88 |
|
{ |
| 89 |
1 |
test(" * item one\n" |
| 90 |
|
+ " * item two\n" |
| 91 |
|
+ " # item three\n" |
| 92 |
|
+ " # item four\n" |
| 93 |
|
+ " * item five - first line\n" |
| 94 |
|
+ " item five - second line\n" |
| 95 |
|
+ " * item six\n" |
| 96 |
|
+ " is on multiple\n" |
| 97 |
|
+ " lines"); |
| 98 |
|
} |
| 99 |
|
|
| 100 |
|
|
| 101 |
|
@throws |
| 102 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
| 103 |
1 |
public void testParagraphs() throws WikiParserException... |
| 104 |
|
{ |
| 105 |
1 |
test("First paragraph.\n" |
| 106 |
|
+ "Second line of the same paragraph.\n" |
| 107 |
|
+ "\n" |
| 108 |
|
+ "The second paragraph"); |
| 109 |
|
} |
| 110 |
|
|
| 111 |
|
|
| 112 |
|
@throws |
| 113 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
| 114 |
1 |
public void testProperties() throws WikiParserException... |
| 115 |
|
{ |
| 116 |
1 |
test( |
| 117 |
|
"#toto hello world\n123", |
| 118 |
|
"<div class='wikimodel-property' url='toto'><p>hello world</p>\n</div>\n<p>123</p>"); |
| 119 |
1 |
test( |
| 120 |
|
"#prop1 value1\n#prop2 value2", |
| 121 |
|
"" |
| 122 |
|
+ "<div class='wikimodel-property' url='prop1'><p>value1</p>\n</div>\n" |
| 123 |
|
+ "<div class='wikimodel-property' url='prop2'><p>value2</p>\n</div>"); |
| 124 |
1 |
test( |
| 125 |
|
"#prop1 value1\nparagraph\n#prop2 value2", |
| 126 |
|
"" |
| 127 |
|
+ "<div class='wikimodel-property' url='prop1'><p>value1</p>\n</div>\n" |
| 128 |
|
+ "<p>paragraph</p>\n" |
| 129 |
|
+ "<div class='wikimodel-property' url='prop2'><p>value2</p>\n</div>"); |
| 130 |
|
} |
| 131 |
|
|
| 132 |
|
|
| 133 |
|
@throws |
| 134 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
| 135 |
1 |
public void testQuot() throws WikiParserException... |
| 136 |
|
{ |
| 137 |
1 |
test("This is a paragraph\n" |
| 138 |
|
+ "\n" |
| 139 |
|
+ " and this is a quotations\n" |
| 140 |
|
+ " the second line"); |
| 141 |
1 |
test(" First\n" + " Second\n" + " Third"); |
| 142 |
1 |
test(" \n\n" |
| 143 |
|
+ " First\n" |
| 144 |
|
+ " Second\n" |
| 145 |
|
+ " Third"); |
| 146 |
|
} |
| 147 |
|
|
| 148 |
|
|
| 149 |
|
@throws |
| 150 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
| 151 |
1 |
public void testReferences() throws WikiParserException... |
| 152 |
|
{ |
| 153 |
1 |
test("before http://www.foo.bar/com after"); |
| 154 |
1 |
test("before [toto] after"); |
| 155 |
|
} |
| 156 |
|
|
| 157 |
|
|
| 158 |
|
@throws |
| 159 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
| 160 |
1 |
public void testTables() throws WikiParserException... |
| 161 |
|
{ |
| 162 |
1 |
test("|| cell1.1 || cell1.2\n" + "|| cell 2.1 || cell 2.2"); |
| 163 |
1 |
test("abc || cde"); |
| 164 |
1 |
test("||a\nb\nc || c\nd\ne\n{{{\n Hello\n * World}}} \n x "); |
| 165 |
|
} |
| 166 |
|
|
| 167 |
|
|
| 168 |
|
@throws |
| 169 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
| 170 |
1 |
public void testVerbatimBlocks() throws WikiParserException... |
| 171 |
|
{ |
| 172 |
1 |
test("{{{verbatim}}}"); |
| 173 |
1 |
test("{{{verbatim"); |
| 174 |
1 |
test("{{{{{{verbatim"); |
| 175 |
1 |
test("{{{{{{verbatim}}}"); |
| 176 |
1 |
test("{{{{{{verbatim}}}}}}"); |
| 177 |
1 |
test("{{{before{{{verbatim}}}after}}}"); |
| 178 |
1 |
test("{{{before{{{123{{{verbatim}}}456}}}after}}}"); |
| 179 |
1 |
test("{{{verbatim}}}}}} - the three last symbols should be in a paragraph"); |
| 180 |
|
|
| 181 |
1 |
test("before{{{verbatim}}}after"); |
| 182 |
|
|
| 183 |
1 |
test("abc \n{{{ 123\n CDE\n 345 }}} efg"); |
| 184 |
1 |
test("abc {{{ 123\n CDE\n 345 }}} efg"); |
| 185 |
1 |
test("abc\n{{{before{{{ inside }}}after}}} efg"); |
| 186 |
1 |
test("`verbatim`"); |
| 187 |
1 |
test("before`verbatim`after"); |
| 188 |
1 |
test("`just like this..."); |
| 189 |
|
} |
| 190 |
|
} |