01: // Copyright (C) 2003,2004,2005 by Object Mentor, Inc. All rights reserved.
02: // Released under the terms of the GNU General Public License version 2 or later.
03: package fitnesse.wikitext.widgets;
04:
05: import fitnesse.wiki.MockWikiPage;
06: import junit.framework.TestCase;
07:
08: import java.util.regex.Pattern;
09:
10: public class CommentWidgetTest extends TestCase {
11: private WidgetRoot root;
12:
13: public void setUp() throws Exception {
14: MockWikiPage page = new MockWikiPage();
15: root = new WidgetRoot(page);
16: }
17:
18: public void tearDown() throws Exception {
19: }
20:
21: public void testRegexp() throws Exception {
22: assertTrue("match1", Pattern.matches(CommentWidget.REGEXP,
23: "# Comment text\n"));
24: assertTrue("match2", Pattern.matches(CommentWidget.REGEXP,
25: "#\n"));
26: assertTrue("match3", !Pattern.matches(CommentWidget.REGEXP,
27: " #\n"));
28: }
29:
30: public void testHtml() throws Exception {
31: CommentWidget widget = new CommentWidget(root, "# some text\n");
32: assertEquals("", widget.render());
33: }
34:
35: public void testAsWikiText() throws Exception {
36: CommentWidget widget = new CommentWidget(root, "# some text\n");
37: assertEquals("# some text\n", widget.asWikiText());
38: }
39: }
|