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 junit.swingui.TestRunner;
06:
07: public class LiteralWidgetTest extends AbstractWidget {
08: public static void main(String[] args) {
09: TestRunner.main(new String[] { "LiteralWidgetTest" });
10: }
11:
12: public void setUp() throws Exception {
13: }
14:
15: public void tearDown() throws Exception {
16: }
17:
18: public void testMatches() throws Exception {
19: assertMatches("!lit(0)");
20: assertMatches("!lit(99)");
21: assertNoMatch("!lit(-1)");
22: assertNoMatch("!lit(a)");
23: }
24:
25: protected String getRegexp() {
26: return LiteralWidget.REGEXP;
27: }
28:
29: public void testWikiWordIsNotParsed() throws Exception {
30: WidgetRoot root = new MockWidgetRoot();
31: root.defineLiteral("Bob");
32: LiteralWidget w = new LiteralWidget(root, "!lit(0)");
33: String html = w.render();
34: assertEquals("Bob", html);
35: }
36: }
|