X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=src%2Fcom%2Fhughes%2Fandroid%2Fdictionary%2Fparser%2FWikiTokenizerTest.java;fp=src%2Fcom%2Fhughes%2Fandroid%2Fdictionary%2Fparser%2FWikiTokenizerTest.java;h=9142bd87312508aec7b40dbac36d23533530fa34;hb=5a79ed5f458a5c469d4b5fa81f25e83baabad57c;hp=4079f1b7bd0133b5f6ea0cc201e0cefbb7665589;hpb=070f6d37264882ce16415270773acae54c7f6c5d;p=DictionaryPC.git diff --git a/src/com/hughes/android/dictionary/parser/WikiTokenizerTest.java b/src/com/hughes/android/dictionary/parser/WikiTokenizerTest.java index 4079f1b..9142bd8 100644 --- a/src/com/hughes/android/dictionary/parser/WikiTokenizerTest.java +++ b/src/com/hughes/android/dictionary/parser/WikiTokenizerTest.java @@ -91,6 +91,19 @@ public class WikiTokenizerTest extends TestCase { assertEquals("202", new WikiTokenizer(wikiText).nextToken().functionNamedArgs().get("arg2")); assertEquals("{{n1|n2=7|n3}}", new WikiTokenizer(wikiText).nextToken().functionNamedArgs().get("arg3")); + wikiText = "{{gloss|asdf}\nAsdf\n\n"; + assertEquals("{{gloss|asdf}", new WikiTokenizer(wikiText).nextToken().token()); + + wikiText = "#*{{quote-book|year=1960|author={{w|P. G. Wodehouse}}\n" + + "|title={{w|Jeeves in the Offing}}\n" + + "|section=chapter XI\n" + + "|passage=“I'm sorely beset, Jeeves. Do you recall telling me once about someone who told somebody he could tell him something which would make him think a bit? Knitted socks and porcu\n" + + "pines entered into it, I remember.” “I think you may be referring to the ghost of the father of Hamlet, Prince of Denmark, sir. Addressing his son, he said ‘I could a tale unfold whos\n" + + "e lightest word would harrow up thy soul, freeze thy young blood, make thy two eyes, like stars, start from their spheres, thy knotted and combined locks to part and each particular h\n" + + "air to stand on end like quills upon the fretful '''porpentine'''.’ â€ “That's right. Locks, of course, not socks. Odd that he should have said '''porpentine''' when he meant porc\n" + + "upine. Slip of the tongue, no doubt, as so often happens with ghosts.”}}"; + assertEquals(wikiText, new WikiTokenizer(wikiText).nextToken().token()); + } @@ -142,7 +155,7 @@ public class WikiTokenizerTest extends TestCase { assertTrue(new WikiTokenizer(wikiText).nextToken().isHeading()); assertEquals(1, new WikiTokenizer(wikiText).nextToken().headingDepth()); assertEquals("a", new WikiTokenizer(wikiText).nextToken().headingWikiText()); - assertEquals(1, new WikiTokenizer(wikiText).nextToken().errors.size()); + assertEquals(2, new WikiTokenizer(wikiText).nextToken().errors.size()); wikiText = "=a=="; assertEquals("=a==", new WikiTokenizer(wikiText).nextToken().token()); @@ -168,6 +181,7 @@ public class WikiTokenizerTest extends TestCase { assertEquals(2, new WikiTokenizer(wikiText).nextToken().headingDepth()); assertEquals("aa[[|=]] {{|={{=}} }}", new WikiTokenizer(wikiText).nextToken().headingWikiText()); assertEquals(0, new WikiTokenizer(wikiText).nextToken().errors.size()); + }