From: axelcl Date: Sun, 13 Feb 2005 18:23:59 +0000 (+0000) Subject: initial code; X-Git-Url: http://git.phpeclipse.com?hp=f2a7a389a1233cb328d094bd7733d7485e10ae88 initial code; junit tests and code generation --- diff --git a/archive/org.plog4u.wiki.test/.classpath b/archive/org.plog4u.wiki.test/.classpath new file mode 100644 index 0000000..b74c046 --- /dev/null +++ b/archive/org.plog4u.wiki.test/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/archive/org.plog4u.wiki.test/.project b/archive/org.plog4u.wiki.test/.project new file mode 100644 index 0000000..d32116c --- /dev/null +++ b/archive/org.plog4u.wiki.test/.project @@ -0,0 +1,17 @@ + + + org.plog4u.wiki.test + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/archive/org.plog4u.wiki.test/lib/junit.jar b/archive/org.plog4u.wiki.test/lib/junit.jar new file mode 100644 index 0000000..674d71e Binary files /dev/null and b/archive/org.plog4u.wiki.test/lib/junit.jar differ diff --git a/archive/org.plog4u.wiki.test/src/org/plog4u/wiki/test/filter/BoldFilterTest.java b/archive/org.plog4u.wiki.test/src/org/plog4u/wiki/test/filter/BoldFilterTest.java new file mode 100644 index 0000000..82ac4f4 --- /dev/null +++ b/archive/org.plog4u.wiki.test/src/org/plog4u/wiki/test/filter/BoldFilterTest.java @@ -0,0 +1,39 @@ +package org.plog4u.wiki.test.filter; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.plog4u.wiki.filter.WikipediaFilter; + +public class BoldFilterTest extends FilterTestSupport { + public BoldFilterTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + filter = new WikipediaFilter(); + super.setUp(); + } + + public static Test suite() { + return new TestSuite(BoldFilterTest.class); + } + + public void testBold() { + assertEquals("Text", filter.filter("'''Text'''", context)); + } + + public void testBold2() { + // close tags if user forget it: + assertEquals("Text", filter.filter("'''Text''", context)); + } + + public void testBoldItalicStack() { + // close tags if user forget it: + assertEquals("Texthallo", filter.filter("Texthallo", context)); + } + + public void testBoldWithPunctuation() { + assertEquals("Text:", filter.filter("'''Text''':", context)); + } +} \ No newline at end of file diff --git a/archive/org.plog4u.wiki.test/src/org/plog4u/wiki/test/filter/FilterTestSupport.java b/archive/org.plog4u.wiki.test/src/org/plog4u/wiki/test/filter/FilterTestSupport.java new file mode 100644 index 0000000..abb21a0 --- /dev/null +++ b/archive/org.plog4u.wiki.test/src/org/plog4u/wiki/test/filter/FilterTestSupport.java @@ -0,0 +1,31 @@ +package org.plog4u.wiki.test.filter; + +import junit.framework.TestCase; +import org.radeox.engine.context.BaseInitialRenderContext; +import org.radeox.engine.context.BaseRenderContext; +import org.radeox.filter.Filter; +import org.radeox.filter.context.BaseFilterContext; +import org.radeox.filter.context.FilterContext; + +/** + * Support class for defning JUnit FilterTests. + * + */ + +public class FilterTestSupport extends TestCase { + protected Filter filter; + protected FilterContext context; + + public FilterTestSupport(String s) { + super(s); + context = new BaseFilterContext(); + context.setRenderContext(new BaseRenderContext()); + } + + protected void setUp() throws Exception { + super.setUp(); + if (null != filter) { + filter.setInitialContext(new BaseInitialRenderContext()); + } + } +} diff --git a/archive/org.plog4u.wiki.test/src/org/plog4u/wiki/test/filter/HRBRTest.java b/archive/org.plog4u.wiki.test/src/org/plog4u/wiki/test/filter/HRBRTest.java new file mode 100644 index 0000000..3cc70bd --- /dev/null +++ b/archive/org.plog4u.wiki.test/src/org/plog4u/wiki/test/filter/HRBRTest.java @@ -0,0 +1,40 @@ +package org.plog4u.wiki.test.filter; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.plog4u.wiki.filter.WikipediaFilter; + +public class HRBRTest extends FilterTestSupport { + public HRBRTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + filter = new WikipediaFilter(); + super.setUp(); + } + + public static Test suite() { + return new TestSuite(HRBRTest.class); + } + + public void testNewline0() { + assertEquals("<br ===", filter.filter("
", filter.filter("
", context)); + } + public void testNewline2() { + assertEquals("
", filter.filter("
", context)); + } + public void testNewline3() { + assertEquals("< br >", filter.filter("< br >", context)); + } + public void testNewline4() { + assertEquals("< br / >", filter.filter("< br / >", context)); + } + + +} \ No newline at end of file diff --git a/archive/org.plog4u.wiki.test/src/org/plog4u/wiki/test/filter/HeaderFilterTest.java b/archive/org.plog4u.wiki.test/src/org/plog4u/wiki/test/filter/HeaderFilterTest.java new file mode 100644 index 0000000..adbdfa7 --- /dev/null +++ b/archive/org.plog4u.wiki.test/src/org/plog4u/wiki/test/filter/HeaderFilterTest.java @@ -0,0 +1,29 @@ +package org.plog4u.wiki.test.filter; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.plog4u.wiki.filter.WikipediaFilter; + +public class HeaderFilterTest extends FilterTestSupport { + public HeaderFilterTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + filter = new WikipediaFilter(); + super.setUp(); + } + + public static Test suite() { + return new TestSuite(HeaderFilterTest.class); + } + + public void testH2() { + assertEquals("

Text

", filter.filter("==Text==", context)); + } + + public void testH2WithPunctuation() { + assertEquals("

Text

:", filter.filter("==Text==:", context)); + } +} diff --git a/archive/org.plog4u.wiki.test/src/org/plog4u/wiki/test/filter/ItalicFilterTest.java b/archive/org.plog4u.wiki.test/src/org/plog4u/wiki/test/filter/ItalicFilterTest.java new file mode 100644 index 0000000..b2bca89 --- /dev/null +++ b/archive/org.plog4u.wiki.test/src/org/plog4u/wiki/test/filter/ItalicFilterTest.java @@ -0,0 +1,29 @@ +package org.plog4u.wiki.test.filter; + +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.plog4u.wiki.filter.WikipediaFilter; + +public class ItalicFilterTest extends FilterTestSupport { + public ItalicFilterTest(String name) { + super(name); + } + + protected void setUp() throws Exception { + filter = new WikipediaFilter(); + super.setUp(); + } + + public static Test suite() { + return new TestSuite(ItalicFilterTest.class); + } + + public void testItalic() { + assertEquals("Text", filter.filter("''Text''", context)); + } + + public void testItalicWithPunctuation() { + assertEquals("Text:", filter.filter("''Text'':", context)); + } +}