1 33 34 72 73 package edu.rice.cs.drjava.model.definitions.indent; 74 75 80 public final class QuestionCurrLineEmptyOrEnterPressTest extends IndentRulesTestCase { 81 82 static IndentRuleQuestion _rule = new QuestionCurrLineEmptyOrEnterPress(null, null); 83 84 85 public void testEmpty() throws javax.swing.text.BadLocationException { 86 _setDocText("/*\n\n*/"); 90 assertTrue("nothing on line", _rule.applyRule(_doc, 3, Indenter.OTHER)); 92 } 93 public void testSpaces() throws javax.swing.text.BadLocationException { 94 _setDocText("/*\n \n*/"); 98 assertTrue("only spaces", _rule.applyRule(_doc, 6, Indenter.OTHER)); 100 } 101 102 static String stuffExample = "/*\n foo \n*/"; 103 108 public void testStuffBefore() throws javax.swing.text.BadLocationException { 109 _setDocText(stuffExample); 110 assertTrue("text before the cursor", !_rule.applyRule(_doc, 3, Indenter.OTHER)); 111 } 112 public void testStuffAfter() throws javax.swing.text.BadLocationException { 113 _setDocText(stuffExample); 114 assertTrue("text after the cursor", !_rule.applyRule(_doc, 11, Indenter.OTHER)); 115 } 116 117 public void testLineWithStar() throws javax.swing.text.BadLocationException { 118 _setDocText("/*\n * foo\n */"); 119 assertTrue("line with a star", !_rule.applyRule(_doc, 5, Indenter.OTHER)); 120 } 121 } 122 | Popular Tags |