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: public class PreProcessorLiteralWidgetTest extends AbstractWidget {
06: private WidgetRoot root;
07:
08: public void setUp() throws Exception {
09: root = new MockWidgetRoot();
10: }
11:
12: protected String getRegexp() {
13: return PreProcessorLiteralWidget.REGEXP;
14: }
15:
16: public void testMatches() throws Exception {
17: assertMatches("!-literal-!");
18: assertMatches("!-this is a literal-!");
19: assertMatches("!-this is\n a literal-!");
20: assertMatches("!- !- !-this is a literal-!");
21: assertMatches("!-!literal-!");
22: assertMatches("!--!");
23: assertNoMatch("!-no");
24: assertNoMatch("! -no-!");
25: assertMatchEquals("!-no-!-!", "!-no-!");
26: }
27:
28: public void testRender() throws Exception {
29: PreProcessorLiteralWidget widget = new PreProcessorLiteralWidget(
30: root, "!-abc-!");
31: assertEquals("!lit(0)", widget.render());
32: assertEquals("abc", root.getLiteral(0));
33: }
34:
35: public void testAsWikiText() throws Exception {
36: PreProcessorLiteralWidget widget = new PreProcessorLiteralWidget(
37: root, "!-abc-!");
38: assertEquals("!-abc-!", widget.asWikiText());
39: }
40: }
|