edu.rice.cs.drjava.model.definitions.indent
Class QuestionExistsCharInStmtTest

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--edu.rice.cs.drjava.model.definitions.indent.IndentRulesTestCase
                    |
                    +--edu.rice.cs.drjava.model.definitions.indent.QuestionExistsCharInStmtTest
All Implemented Interfaces:
Test

public class QuestionExistsCharInStmtTest
extends IndentRulesTestCase

Tests the question rule which determines if the given findChar is found between the start of the statement and the endChar, which must exist on the current line.

This is done in the context of determining if a colon that was found on the current line is part of a ternary operator. Hence, we use endChar=':' and findChar='?'.

Version:
$Id: QuestionExistsCharInStmtTest.java,v 1.2 2002/03/26 08:57:13 csreis Exp $

Fields inherited from class edu.rice.cs.drjava.model.definitions.indent.IndentRulesTestCase
_doc, _indent
 
Fields inherited from class junit.framework.TestCase
fName
 
Constructor Summary
QuestionExistsCharInStmtTest(String name)
          Tests the indentation decision tree.
 
Method Summary
 void testColonInTernaryOpIgnoreWhitespaceAndComments()
          Ensures that a colon that is part of a ternary operator is detected.
 void testColonInTernaryOpMultiLineStmts()
          Ensures that a colon that is part of a ternary operator is detected.
 void testColonInTernaryOpOneLineStmts()
          Ensures that a colon that is part of a ternary operator is detected.
 void testColonInTernaryOpTwoStmtsOnOneLine()
          Ensures that a colon that is part of a ternary operator is detected.
 void testColonNotInTernaryOpDueToQuestionMarkInCommentsOrQuotes()
          Ensures that a colon that is part of a ternary operator is detected.
 void testColonNotInTernaryOpMultiLineStmts()
          Ensures that a colon that is part of a ternary operator is detected.
 
Methods inherited from class edu.rice.cs.drjava.model.definitions.indent.IndentRulesTestCase
_assertContents, _setDocText, setUp
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Constructor Detail

QuestionExistsCharInStmtTest

public QuestionExistsCharInStmtTest(String name)
Tests the indentation decision tree.
Method Detail

testColonInTernaryOpOneLineStmts

public void testColonInTernaryOpOneLineStmts()
                                      throws BadLocationException
Ensures that a colon that is part of a ternary operator is detected. Tests that this rule works for one line statements.

testColonInTernaryOpTwoStmtsOnOneLine

public void testColonInTernaryOpTwoStmtsOnOneLine()
                                           throws BadLocationException
Ensures that a colon that is part of a ternary operator is detected. Tests that this rule works when there are two statements on the same line. Essentially, that it uses the first colon that it finds on the line as the endChar.

testColonInTernaryOpMultiLineStmts

public void testColonInTernaryOpMultiLineStmts()
                                        throws BadLocationException
Ensures that a colon that is part of a ternary operator is detected. Tests that a colon in a multi-line ternary op statement is detected.

testColonInTernaryOpIgnoreWhitespaceAndComments

public void testColonInTernaryOpIgnoreWhitespaceAndComments()
                                                     throws BadLocationException
Ensures that a colon that is part of a ternary operator is detected. Tests that whitespace, single-line comments and multi-line comments in between the ':' character and the '?' character are ignored.

testColonNotInTernaryOpDueToQuestionMarkInCommentsOrQuotes

public void testColonNotInTernaryOpDueToQuestionMarkInCommentsOrQuotes()
                                                                throws BadLocationException
Ensures that a colon that is part of a ternary operator is detected. Tests that a '?' in quotes or single-line comments or multi-line comments is not detected - and hence that a colon is not party of a ternary op.

testColonNotInTernaryOpMultiLineStmts

public void testColonNotInTernaryOpMultiLineStmts()
                                           throws BadLocationException
Ensures that a colon that is part of a ternary operator is detected. Tests that a colon that is part of a multi-line statement is not falsely identified as belonging to a ternary op.