1 33 34 package edu.rice.cs.drjava.model.definitions.indent; 35 36 41 public final class QuestionInsideCommentTest extends IndentRulesTestCase { 42 43 static IndentRuleQuestion _rule = new QuestionInsideComment(null, null); 44 45 public void setUp() throws Exception { 46 super.setUp(); 47 try { 48 _setDocText("\n/*\nfoo\n*/\nbar\nfoo /* bar\n// /*\nfoo */ bar\n// /*\nblah"); 49 } catch (javax.swing.text.BadLocationException ex) { 62 throw new RuntimeException ("Bad Location Exception"); 63 } 64 } 65 66 67 public void testDocStart() throws javax.swing.text.BadLocationException { 68 assertEquals(false, _rule.applyRule(_doc, 0, Indenter.OTHER)); 69 } 70 public void testLineBeginsComment() throws javax.swing.text.BadLocationException { 71 assertEquals(false, _rule.applyRule(_doc, 3, Indenter.OTHER)); 72 } 73 public void testFooLine() throws javax.swing.text.BadLocationException { 74 assertEquals(true, _rule.applyRule(_doc, 6, Indenter.OTHER)); 75 } 76 public void testLineEndsComment() throws javax.swing.text.BadLocationException { 77 assertEquals(true, _rule.applyRule(_doc, 9, Indenter.OTHER)); 78 } 79 public void testBarLine() throws javax.swing.text.BadLocationException { 80 assertEquals(false, _rule.applyRule(_doc, 13, Indenter.OTHER)); 81 } 82 public void testSlashStarMidLineBefore() throws javax.swing.text.BadLocationException { 83 assertEquals(false, _rule.applyRule(_doc, 16, Indenter.OTHER)); 84 } 85 public void testSlashStarMidLineAfter() throws javax.swing.text.BadLocationException { 86 assertEquals(false, _rule.applyRule(_doc, 24, Indenter.OTHER)); 87 } 88 public void testCommentedOutSlashStar() throws javax.swing.text.BadLocationException { 89 assertEquals(true, _rule.applyRule(_doc, 30, Indenter.OTHER)); 90 } 91 public void testStarSlashMidLineBefore() throws javax.swing.text.BadLocationException { 92 assertEquals(true, _rule.applyRule(_doc, 33, Indenter.OTHER)); 93 } 94 public void testStarSlashMidLineAfter() throws javax.swing.text.BadLocationException { 95 assertEquals(true, _rule.applyRule(_doc, 41, Indenter.OTHER)); 96 } 97 public void testAfterCommentedOutSlashStar() throws javax.swing.text.BadLocationException { 98 assertEquals(false, _rule.applyRule(_doc, 49, Indenter.OTHER)); 99 } 100 101 } 102 | Popular Tags |