edu.rice.cs.drjava.model.definitions.indent
Class QuestionExistsCharInStmtTest
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
edu.rice.cs.drjava.DrJavaTestCase
edu.rice.cs.drjava.model.definitions.indent.IndentRulesTestCase
edu.rice.cs.drjava.model.definitions.indent.QuestionExistsCharInStmtTest
- All Implemented Interfaces:
- Test
public final 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 5175 2010-01-20 08:46:32Z mgricken $
| Methods inherited from class junit.framework.Assert |
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format |
QuestionExistsCharInStmtTest
public QuestionExistsCharInStmtTest()
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.
- Throws:
BadLocationException
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.
- Throws:
BadLocationException
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.
- Throws:
BadLocationException
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.
- Throws:
BadLocationException
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.
- Throws:
BadLocationException
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.
- Throws:
BadLocationException