1 33 34 72 73 package edu.rice.cs.drjava.model.definitions.indent; 74 75 79 public final class QuestionCurrLineIsWingCommentTest extends IndentRulesTestCase { 80 81 static IndentRuleQuestion _rule = new QuestionCurrLineIsWingComment(null, null); 82 83 public void testWingComment() throws javax.swing.text.BadLocationException { 84 _setDocText("// This is a wing comment"); 85 assertTrue("A valid wing comment 1", _rule.applyRule(_doc, 0, Indenter.OTHER)); 86 assertTrue("A valid wing comment 2", _rule.applyRule(_doc, 4, Indenter.OTHER)); 87 assertTrue("A valid wing comment 3", _rule.applyRule(_doc, 10, Indenter.OTHER)); 88 } 89 public void testSpaces() throws javax.swing.text.BadLocationException { 90 _setDocText("/*\n \n*/"); 91 assertFalse("A block comment 1", _rule.applyRule(_doc, 0, Indenter.OTHER)); 92 assertFalse("A block comment 2", _rule.applyRule(_doc, 3, Indenter.OTHER)); 93 assertFalse("A block comment 3", _rule.applyRule(_doc, 5, Indenter.OTHER)); 94 } 95 96 static String cornerCase = " //\n"; 97 98 public void testCornerCase() throws javax.swing.text.BadLocationException { 99 _setDocText(cornerCase); 100 assertFalse("Corner Case 1", _rule.applyRule(_doc, 0, Indenter.OTHER)); 101 assertFalse("Corner Case 2", _rule.applyRule(_doc, 1, Indenter.OTHER)); 102 assertFalse("Corner Case 3", _rule.applyRule(_doc, 2, Indenter.OTHER)); 103 assertFalse("Corner Case 4", _rule.applyRule(_doc, 3, Indenter.OTHER)); 104 } 105 106 public void testWingInsideBlock() throws javax.swing.text.BadLocationException { 107 _setDocText("/*//\n \n */"); 108 assertFalse("Wing Inside BlockComment 1", _rule.applyRule(_doc, Indenter.OTHER)); 109 assertFalse("Wing Inside BlockComment 2", _rule.applyRule(_doc, 2, Indenter.OTHER)); 110 } 111 } 112 | Popular Tags |