Revision: 9415
http://languagetool.svn.sourceforge.net/languagetool/?rev=9415&view=rev
Author: dnaber
Date: 2013-02-17 23:32:52 +0000 (Sun, 17 Feb 2013)
Log Message:
-----------
re-add more tests from pre-Maven days, now split up so that they are now in the
language module they belong to + a generic part in standalone module
Modified Paths:
--------------
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/JLanguageTool.java
trunk/languagetool/languagetool-standalone/src/test/java/org/languagetool/JLanguageToolTest.java
Added Paths:
-----------
trunk/languagetool/languagetool-language-modules/de/src/test/java/org/languagetool/JLanguageToolTest.java
trunk/languagetool/languagetool-language-modules/en/src/test/java/org/languagetool/JLanguageToolTest.java
trunk/languagetool/languagetool-language-modules/ja/src/test/java/org/languagetool/JLanguageToolTest.java
trunk/languagetool/languagetool-language-modules/nl/src/test/java/org/languagetool/JLanguageToolTest.java
trunk/languagetool/languagetool-language-modules/pl/src/test/java/org/languagetool/JLanguageToolTest.java
trunk/languagetool/languagetool-language-modules/sl/src/test/java/org/languagetool/JLanguageToolTest.java
Modified:
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/JLanguageTool.java
===================================================================
---
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/JLanguageTool.java
2013-02-17 23:11:22 UTC (rev 9414)
+++
trunk/languagetool/languagetool-core/src/main/java/org/languagetool/JLanguageTool.java
2013-02-17 23:32:52 UTC (rev 9415)
@@ -708,7 +708,8 @@
return words;
}
- private static int countLineBreaks(final String s) {
+ // non-private only for test case
+ static int countLineBreaks(final String s) {
int pos = -1;
int count = 0;
while (true) {
Copied:
trunk/languagetool/languagetool-language-modules/de/src/test/java/org/languagetool/JLanguageToolTest.java
(from rev 9047,
trunk/JLanguageTool/src/test/java/org/languagetool/JLanguageToolTest.java)
===================================================================
---
trunk/languagetool/languagetool-language-modules/de/src/test/java/org/languagetool/JLanguageToolTest.java
(rev 0)
+++
trunk/languagetool/languagetool-language-modules/de/src/test/java/org/languagetool/JLanguageToolTest.java
2013-02-17 23:32:52 UTC (rev 9415)
@@ -0,0 +1,66 @@
+/* LanguageTool, a natural language style checker
+ * Copyright (C) 2005 Daniel Naber (http://www.danielnaber.de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+package org.languagetool;
+
+import junit.framework.TestCase;
+import org.languagetool.language.German;
+import org.languagetool.language.GermanyGerman;
+import org.languagetool.rules.RuleMatch;
+
+import java.io.IOException;
+import java.util.List;
+
+public class JLanguageToolTest extends TestCase {
+
+ public void testGerman() throws IOException {
+ final JLanguageTool tool = new JLanguageTool(new German());
+ assertEquals(0, tool.check("Ein Test, der keine Fehler geben
sollte.").size());
+ assertEquals(1, tool.check("Ein Test Test, der Fehler geben
sollte.").size());
+ tool.activateDefaultPatternRules();
+ tool.setListUnknownWords(true);
+ // no spelling mistakes as we have not created a variant:
+ assertEquals(0, tool.check("I can give you more a detailed
description").size());
+ //test unknown words listing
+ assertEquals("[I, can, detailed, give, more, you]",
tool.getUnknownWords().toString());
+ }
+
+ public void testGermanyGerman() throws IOException {
+ final JLanguageTool tool = new JLanguageTool(new GermanyGerman());
+ assertEquals(0, tool.check("Ein Test, der keine Fehler geben
sollte.").size());
+ assertEquals(1, tool.check("Ein Test Test, der Fehler geben
sollte.").size());
+ tool.activateDefaultPatternRules();
+ tool.setListUnknownWords(true);
+ // German rule has no effect with English error, but they are spelling
mistakes:
+ assertEquals(6, tool.check("I can give you more a detailed
description").size());
+ //test unknown words listing
+ assertEquals("[I, can, detailed, give, more, you]",
tool.getUnknownWords().toString());
+ }
+
+ public void testPositionsWithGerman() throws IOException {
+ final JLanguageTool tool = new JLanguageTool(new German());
+ tool.activateDefaultPatternRules();
+ final List<RuleMatch> matches = tool.check("Stundenkilometer");
+ assertEquals(1, matches.size());
+ final RuleMatch match = matches.get(0);
+ // TODO: values should be either 0-based or 1-based, it should not be
mixed up!
+ assertEquals(0, match.getLine());
+ assertEquals(1, match.getColumn());
+ }
+
+}
Copied:
trunk/languagetool/languagetool-language-modules/en/src/test/java/org/languagetool/JLanguageToolTest.java
(from rev 9047,
trunk/JLanguageTool/src/test/java/org/languagetool/JLanguageToolTest.java)
===================================================================
---
trunk/languagetool/languagetool-language-modules/en/src/test/java/org/languagetool/JLanguageToolTest.java
(rev 0)
+++
trunk/languagetool/languagetool-language-modules/en/src/test/java/org/languagetool/JLanguageToolTest.java
2013-02-17 23:32:52 UTC (rev 9415)
@@ -0,0 +1,169 @@
+/* LanguageTool, a natural language style checker
+ * Copyright (C) 2005 Daniel Naber (http://www.danielnaber.de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+package org.languagetool;
+
+import junit.framework.TestCase;
+import org.languagetool.JLanguageTool.ParagraphHandling;
+import org.languagetool.language.AmericanEnglish;
+import org.languagetool.language.English;
+import org.languagetool.rules.Category;
+import org.languagetool.rules.Rule;
+import org.languagetool.rules.RuleMatch;
+import org.languagetool.rules.patterns.Element;
+import org.languagetool.rules.patterns.PatternRule;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class JLanguageToolTest extends TestCase {
+
+ // used on http://www.languagetool.org/usage/
+ /*
+ public void testDemo() throws IOException {
+ JLanguageTool langTool = new JLanguageTool(Language.ENGLISH);
+ langTool.activateDefaultPatternRules();
+ List<RuleMatch> matches = langTool.check("A sentence " +
+ "with a error in the Hitchhiker's Guide tot he Galaxy");
+ for (RuleMatch match : matches) {
+ System.out.println("Potential error at line " +
+ match.getEndLine() + ", column " +
+ match.getColumn() + ": " + match.getMessage());
+ System.out.println("Suggested correction: " +
+ match.getSuggestedReplacements());
+ }
+ }
+ */
+
+ public void testEnglish() throws IOException {
+ final JLanguageTool tool = new JLanguageTool(new English());
+ assertEquals(0, tool.check("A test that should not give errors.").size());
+ assertEquals(1, tool.check("A test test that should give errors.").size());
+ assertEquals(0, tool.check("I can give you more a detailed
description.").size());
+ assertEquals(10, tool.getAllRules().size());
+ tool.activateDefaultPatternRules();
+ assertTrue(tool.getAllRules().size() > 3);
+ assertEquals(1, tool.check("I can give you more a detailed
description.").size());
+ tool.disableRule("MORE_A_JJ");
+ assertEquals(0, tool.check("I can give you more a detailed
description.").size());
+ assertEquals(1, tool.check("I've go to go.").size());
+ tool.disableCategory("Possible Typos");
+ assertEquals(0, tool.check("I've go to go.").size());
+ }
+
+ public void testPositionsWithEnglish() throws IOException {
+ final JLanguageTool tool = new JLanguageTool(new AmericanEnglish());
+ final List<RuleMatch> matches = tool.check("A sentence with no period\n" +
+ "A sentence. A typoh.");
+ assertEquals(1, matches.size());
+ final RuleMatch match = matches.get(0);
+ assertEquals(1, match.getLine());
+ assertEquals(15, match.getColumn());
+ }
+
+ public void testPositionsWithEnglishTwoLineBreaks() throws IOException {
+ final JLanguageTool tool = new JLanguageTool(new AmericanEnglish());
+ final List<RuleMatch> matches = tool.check("This sentence.\n\n" +
+ "A sentence. A typoh.");
+ assertEquals(1, matches.size());
+ final RuleMatch match = matches.get(0);
+ assertEquals(2, match.getLine());
+ assertEquals(14, match.getColumn()); // TODO: should actually be 15, as
in testPositionsWithEnglish()
+ }
+
+ public void testAnalyzedSentence() throws IOException {
+ final JLanguageTool tool = new JLanguageTool(new English());
+ //test soft-hyphen ignoring:
+ assertEquals("<S> This[this/DT] is[be/VBZ] a[a/DT]
tested[tested/JJ,test/VBD,test/VBN,tested]
sentence[sentence/NN,sentence/VB,sentence/VBP].[./.,</S>]",
tool.getAnalyzedSentence("This is a test\u00aded sentence.").toString());
+ //test paragraph ends adding
+ assertEquals("<S> </S><P/> ", tool.getAnalyzedSentence("\n").toString());
+ }
+
+ public void testParagraphRules() throws IOException {
+ final JLanguageTool tool = new JLanguageTool(new English());
+
+ //run normally
+ List<RuleMatch> matches = tool.check("(This is an quote.\n It ends in the
second sentence.");
+ assertEquals(2, matches.size());
+ assertEquals(2, tool.getSentenceCount());
+
+ //run in a sentence-only mode
+ matches = tool.check("(This is an quote.\n It ends in the second
sentence.", false, ParagraphHandling.ONLYNONPARA);
+ assertEquals(1, matches.size());
+ assertEquals("EN_A_VS_AN", matches.get(0).getRule().getId());
+ assertEquals(1, tool.getSentenceCount());
+
+ //run in a paragraph mode - single sentence
+ matches = tool.check("(This is an quote.\n It ends in the second
sentence.", false, ParagraphHandling.ONLYPARA);
+ assertEquals(1, matches.size());
+ assertEquals("EN_UNPAIRED_BRACKETS", matches.get(0).getRule().getId());
+ assertEquals(1, tool.getSentenceCount());
+
+ //run in a paragraph mode - many sentences
+ matches = tool.check("(This is an quote.\n It ends in the second
sentence.", true, ParagraphHandling.ONLYPARA);
+ assertEquals(1, matches.size());
+ assertEquals("EN_UNPAIRED_BRACKETS", matches.get(0).getRule().getId());
+ assertEquals(2, tool.getSentenceCount());
+ }
+
+ public void testWhitespace() throws IOException {
+ final JLanguageTool tool = new JLanguageTool(new English());
+ final AnalyzedSentence raw = tool.getRawAnalyzedSentence("Let's do a
\"test\", do you understand?");
+ final AnalyzedSentence cooked = tool.getAnalyzedSentence("Let's do a
\"test\", do you understand?");
+ //test if there was a change
+ assertFalse(raw.equals(cooked));
+ //see if nothing has been deleted
+ assertEquals(raw.getTokens().length, cooked.getTokens().length);
+ int i = 0;
+ for (final AnalyzedTokenReadings atr : raw.getTokens()) {
+ assertEquals(atr.isWhitespaceBefore(),
+ cooked.getTokens()[i].isWhitespaceBefore());
+ i++;
+ }
+ }
+
+ public void testOverlapFilter() throws IOException {
+ final Category category = new Category("test category");
+ final List<Element> elements1 = Arrays.asList(new Element("one", true,
false, false));
+ final PatternRule rule1 = new PatternRule("id1", new English(), elements1,
"desc1", "msg1", "shortMsg1");
+ rule1.setSubId("1");
+ rule1.setCategory(category);
+
+ final List<Element> elements2 = Arrays.asList(new Element("one", true,
false, false), new Element("two", true, false, false));
+ final PatternRule rule2 = new PatternRule("id1", new English(), elements2,
"desc2", "msg2", "shortMsg2");
+ rule2.setSubId("2");
+ rule2.setCategory(category);
+
+ final JLanguageTool tool = new JLanguageTool(new English());
+ tool.addRule(rule1);
+ tool.addRule(rule2);
+
+ final List<RuleMatch> ruleMatches1 = tool.check("And one two three.");
+ assertEquals("one overlapping rule must be filtered out", 1,
ruleMatches1.size());
+ assertEquals("msg1", ruleMatches1.get(0).getMessage());
+
+ final String sentence = "And one two three.";
+ final AnalyzedSentence analyzedSentence =
tool.getAnalyzedSentence(sentence);
+ final List<Rule> bothRules = new ArrayList<Rule>(Arrays.asList(rule1,
rule2));
+ final List<RuleMatch> ruleMatches2 =
tool.checkAnalyzedSentence(ParagraphHandling.NORMAL, bothRules, 0, 0, 0,
sentence, analyzedSentence);
+ assertEquals("one overlapping rule must be filtered out", 1,
ruleMatches2.size());
+ assertEquals("msg1", ruleMatches2.get(0).getMessage());
+ }
+}
Copied:
trunk/languagetool/languagetool-language-modules/ja/src/test/java/org/languagetool/JLanguageToolTest.java
(from rev 9047,
trunk/JLanguageTool/src/test/java/org/languagetool/JLanguageToolTest.java)
===================================================================
---
trunk/languagetool/languagetool-language-modules/ja/src/test/java/org/languagetool/JLanguageToolTest.java
(rev 0)
+++
trunk/languagetool/languagetool-language-modules/ja/src/test/java/org/languagetool/JLanguageToolTest.java
2013-02-17 23:32:52 UTC (rev 9415)
@@ -0,0 +1,35 @@
+/* LanguageTool, a natural language style checker
+ * Copyright (C) 2005 Daniel Naber (http://www.danielnaber.de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+package org.languagetool;
+
+import junit.framework.TestCase;
+import org.languagetool.language.Japanese;
+
+import java.io.IOException;
+
+public class JLanguageToolTest extends TestCase {
+
+ public void testJapanese() throws IOException {
+ final JLanguageTool tool = new JLanguageTool(new Japanese());
+ tool.activateDefaultPatternRules();
+ assertEquals(0, tool.check("エラーを含まないテスト文です。").size());
+ assertEquals(1, tool.check("エラーお含むテスト文です。").size());
+ }
+
+}
Copied:
trunk/languagetool/languagetool-language-modules/nl/src/test/java/org/languagetool/JLanguageToolTest.java
(from rev 9047,
trunk/JLanguageTool/src/test/java/org/languagetool/JLanguageToolTest.java)
===================================================================
---
trunk/languagetool/languagetool-language-modules/nl/src/test/java/org/languagetool/JLanguageToolTest.java
(rev 0)
+++
trunk/languagetool/languagetool-language-modules/nl/src/test/java/org/languagetool/JLanguageToolTest.java
2013-02-17 23:32:52 UTC (rev 9415)
@@ -0,0 +1,44 @@
+/* LanguageTool, a natural language style checker
+ * Copyright (C) 2005 Daniel Naber (http://www.danielnaber.de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+package org.languagetool;
+
+import junit.framework.TestCase;
+import org.languagetool.language.Dutch;
+
+import java.io.IOException;
+
+public class JLanguageToolTest extends TestCase {
+
+ public void testDutch() throws IOException {
+ final JLanguageTool tool = new JLanguageTool(new Dutch());
+ tool.activateDefaultPatternRules();
+ assertEquals(0, tool.check("Een test, die geen fouten mag geven.").size());
+ assertEquals(2, tool.check("Een test test, die een fout moet
geven.").size());
+ assertEquals(1, tool.check("Dit is fout.!").size());
+ //test uppercasing rule:
+ /*
+ matches = tool.check("De Afdeling Beheer kan het");
+ assertEquals(1, matches.size());
+ assertEquals("Als Afdeling geen deel uitmaakt van de naam, dan is
juist:<suggestion>afdeling</suggestion>", matches.get(0).getMessage());
+ */
+ // Dutch rule has no effect with English error but they are spelling
mistakes:
+ assertEquals(5, tool.check("I can give you more a detailed
description.").size());
+ }
+
+}
Copied:
trunk/languagetool/languagetool-language-modules/pl/src/test/java/org/languagetool/JLanguageToolTest.java
(from rev 9047,
trunk/JLanguageTool/src/test/java/org/languagetool/JLanguageToolTest.java)
===================================================================
---
trunk/languagetool/languagetool-language-modules/pl/src/test/java/org/languagetool/JLanguageToolTest.java
(rev 0)
+++
trunk/languagetool/languagetool-language-modules/pl/src/test/java/org/languagetool/JLanguageToolTest.java
2013-02-17 23:32:52 UTC (rev 9415)
@@ -0,0 +1,90 @@
+/* LanguageTool, a natural language style checker
+ * Copyright (C) 2005 Daniel Naber (http://www.danielnaber.de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+package org.languagetool;
+
+import junit.framework.TestCase;
+import org.languagetool.language.Polish;
+import org.languagetool.rules.RuleMatch;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+public class JLanguageToolTest extends TestCase {
+
+ public void testPolish() throws IOException {
+ final Polish polish = new Polish();
+ JLanguageTool tool = new JLanguageTool(polish);
+ assertEquals("[PL]", Arrays.toString(polish.getCountryVariants()));
+ List<RuleMatch> matches = tool.check("To jest całkowicie prawidłowe
zdanie.");
+ assertEquals(0, matches.size());
+ matches = tool.check("To jest jest problem.");
+ assertEquals(1, matches.size());
+ //this rule is by default off
+ matches = tool.check("Był on bowiem pięknym strzelcem bowiem.");
+ assertEquals(0, matches.size());
+ tool.enableDefaultOffRule("PL_WORD_REPEAT");
+ matches = tool.check("Był on bowiem pięknym strzelcem bowiem.");
+ assertEquals(1, matches.size());
+ tool.activateDefaultPatternRules();
+ matches = tool.check("Premier drapie się w ucho co i rusz.");
+ assertEquals(1, matches.size());
+ // Polish rule has no effect with English error but will get spelling
activated:
+ matches = tool.check("I can give you more a detailed description");
+ assertEquals(6, matches.size());
+ tool.setListUnknownWords(true);
+ matches = tool.check("This is not a Polish text.");
+ assertEquals(3, matches.size());
+ assertEquals("[Polish, This, is, text]",
tool.getUnknownWords().toString());
+ //check positions relative to sentence ends
+ matches = tool.check("To jest tekst.\nTest 1. To jest linia w której nie
ma przecinka.");
+ assertEquals(17, matches.get(0).getColumn());
+ //with a space...
+ matches = tool.check("To jest tekst. \nTest 1. To jest linia w której nie
ma przecinka.");
+ assertEquals(16, matches.get(0).getColumn());
+ matches = tool.check("To jest tekst. Test 1. To jest linia w której nie ma
przecinka.");
+ assertEquals(32, matches.get(0).getColumn());
+ //recheck with the -b mode...
+ polish.getSentenceTokenizer().setSingleLineBreaksMarksParagraph(true);
+ tool = new JLanguageTool(polish);
+ tool.activateDefaultPatternRules();
+ matches = tool.check("To jest tekst.\nTest 1. To jest linia w której nie
ma przecinka.");
+ assertEquals(17, matches.get(0).getColumn());
+ //with a space...
+ matches = tool.check("To jest tekst. \nTest 1. To jest linia w której nie
ma przecinka.");
+ assertEquals(17, matches.get(0).getColumn());
+ matches = tool.check("To jest tekst. To jest linia w której nie ma
przecinka.");
+ assertEquals(24, matches.get(0).getColumn());
+
+ //and let's test other feats
+ AnalyzedSentence sent = tool.getAnalyzedSentence("Z powodu pogody dobre
buty są wskazane.");
+ assertEquals("Disambiguator log: "
+ + "\n\nMULTIWORD_CHUNKER: Z[z/prep:gen.inst*] ->
Z[z/prep:gen.inst*,Z powodu/<PREP:GEN>*]"
+ + "\n\nMULTIWORD_CHUNKER: powodu[powód/subst:sg:gen:m3] ->
powodu[powód/subst:sg:gen:m3,Z powodu/</PREP:GEN>]\n",
+ sent.getAnnotations());
+ sent = tool.getAnalyzedSentence("Nie mamy żadnej ryby.");
+ assertEquals("Disambiguator log: "
+ + "\n\nNIE_ADAMP:
Nie[nie/qub*,on/ppron3:pl:acc:f.m2.m3.n.p2.p3:ter:praep*,on/ppron3:sg:acc:n:ter:praep*]
-> Nie[nie/qub*]"
+ + "\n\nunify_adj_subst:
żadnej[żaden/adj:sg:dat:f:pos,żaden/adj:sg:gen:f:pos,żaden/adj:sg:loc:f:pos] ->
żadnej[żaden/adj:sg:gen:f:pos]" +
+ "\n\nunify_adj_subst:
ryby[ryba/subst:pl:acc:f,ryba/subst:pl:nom:f,ryba/subst:pl:voc:f,ryba/subst:sg:gen:f]
-> ryby[ryba/subst:sg:gen:f]\n",
+ sent.getAnnotations());
+
+ }
+
+}
Copied:
trunk/languagetool/languagetool-language-modules/sl/src/test/java/org/languagetool/JLanguageToolTest.java
(from rev 9047,
trunk/JLanguageTool/src/test/java/org/languagetool/JLanguageToolTest.java)
===================================================================
---
trunk/languagetool/languagetool-language-modules/sl/src/test/java/org/languagetool/JLanguageToolTest.java
(rev 0)
+++
trunk/languagetool/languagetool-language-modules/sl/src/test/java/org/languagetool/JLanguageToolTest.java
2013-02-17 23:32:52 UTC (rev 9415)
@@ -0,0 +1,33 @@
+/* LanguageTool, a natural language style checker
+ * Copyright (C) 2005 Daniel Naber (http://www.danielnaber.de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+package org.languagetool;
+
+import junit.framework.TestCase;
+import org.languagetool.language.Slovenian;
+
+import java.io.IOException;
+
+public class JLanguageToolTest extends TestCase {
+
+ public void testSlovenian() throws IOException {
+ final JLanguageTool tool = new JLanguageTool(new Slovenian());
+ assertEquals(1, tool.check("Kupil je npr. jajca, moko in mleko.").size());
+ }
+
+}
Modified:
trunk/languagetool/languagetool-standalone/src/test/java/org/languagetool/JLanguageToolTest.java
===================================================================
---
trunk/languagetool/languagetool-standalone/src/test/java/org/languagetool/JLanguageToolTest.java
2013-02-17 23:11:22 UTC (rev 9414)
+++
trunk/languagetool/languagetool-standalone/src/test/java/org/languagetool/JLanguageToolTest.java
2013-02-17 23:32:52 UTC (rev 9415)
@@ -25,6 +25,7 @@
import java.util.ResourceBundle;
+import static junit.framework.Assert.assertEquals;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
@@ -42,4 +43,12 @@
assertThat(bundle3.getString("de"), is("German"));
}
+ @Test
+ public void testCountLines() {
+ assertEquals(0, JLanguageTool.countLineBreaks(""));
+ assertEquals(1, JLanguageTool.countLineBreaks("Hallo,\nnächste Zeile"));
+ assertEquals(2, JLanguageTool.countLineBreaks("\nZweite\nDritte"));
+ assertEquals(4, JLanguageTool.countLineBreaks("\nZweite\nDritte\n\n"));
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
is your hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials, tech docs,
whitepapers, evaluation guides, and opinion stories. Check out the most
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Languagetool-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/languagetool-commits