| 1 33 34 package edu.rice.cs.drjava.model.definitions.indent; 35 36 39 public final class QuestionPrevLineStartsCommentTest extends IndentRulesTestCase { 40 41 static IndentRuleQuestion rule2 = new QuestionPrevLineStartsComment(null, 42 null); 43 private static String example1 = "/*\nfoo\nbar\n*/"; 44 private static String example2 = "foo /* bar\nblah\nmoo\n*/"; 50 private static String example3 = "/*\nfoo\n// /*\nbar\n*/"; 56 63 public void testSimpleFirstLine() throws javax.swing.text.BadLocationException { 64 _setDocText(example1); 65 assertEquals(true, rule2.applyRule(_doc, 3, Indenter.OTHER)); 66 } 67 68 public void testSimpleSecondLine() throws javax.swing.text.BadLocationException { 69 _setDocText(example1); 70 assertEquals(false, rule2.applyRule(_doc, 7, Indenter.OTHER)); 71 } 72 73 public void testSlashStarMidLineFirstLine() throws javax.swing.text.BadLocationException { 74 _setDocText(example2); 75 assertEquals(true, rule2.applyRule(_doc, 11, Indenter.OTHER)); 76 } 77 public void testSlashStarMidLineSecondLine() throws javax.swing.text.BadLocationException { 78 _setDocText(example2); 79 assertEquals(false, rule2.applyRule(_doc, 16, Indenter.OTHER)); 80 } 81 public void testCommentedOutSlashStarBefore() throws javax.swing.text.BadLocationException { 82 _setDocText(example3); 83 assertEquals(true, rule2.applyRule(_doc, 3, Indenter.OTHER)); 84 } 85 public void testCommentedOutSlashStarAt() throws javax.swing.text.BadLocationException { 86 _setDocText(example3); 87 assertEquals(false, rule2.applyRule(_doc, 7, Indenter.OTHER)); 88 } 89 public void testCommentedOutSlashStarAfter() throws javax.swing.text.BadLocationException { 90 _setDocText(example3); 91 assertEquals(false, rule2.applyRule(_doc, 13, Indenter.OTHER)); 92 } 93 } 94 95 96 | Popular Tags |