edu.rice.cs.drjava.model.definitions.reducedmodel
Class MixedQuoteTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by edu.rice.cs.drjava.DrJavaTestCase
              extended by edu.rice.cs.drjava.model.definitions.reducedmodel.BraceReductionTestCase
                  extended by edu.rice.cs.drjava.model.definitions.reducedmodel.MixedQuoteTest
All Implemented Interfaces:
ReducedModelStates, junit.framework.Test

public final class MixedQuoteTest
extends BraceReductionTestCase
implements ReducedModelStates

Tests the interaction between double and single quotes and comments

Version:
$Id: MixedQuoteTest.java 5175 2010-01-20 08:46:32Z mgricken $

Nested Class Summary
 
Nested classes/interfaces inherited from class junit.framework.TestCase
junit.framework.TestCase.WrappedException
 
Field Summary
protected  ReducedModelControl _model
           
 
Fields inherited from class edu.rice.cs.drjava.model.definitions.reducedmodel.BraceReductionTestCase
model0, model1, model2
 
Fields inherited from interface edu.rice.cs.drjava.model.definitions.reducedmodel.ReducedModelStates
FREE, INSIDE_BLOCK_COMMENT, INSIDE_DOUBLE_QUOTE, INSIDE_LINE_COMMENT, INSIDE_SINGLE_QUOTE, STUTTER
 
Constructor Summary
MixedQuoteTest()
           
 
Method Summary
protected  void insertGap(BraceReduction model, int size)
          Convenience function to insert a number of non-special characters into a reduced model.
protected  void setUp()
          Initializes the reduced models used in the tests.
static junit.framework.Test suite()
          Creates a test suite for JUnit to use.
 void testDoubleEclipsesSingle()
          Tests how a double quote can eclipse the effects of a single quote by inserting the double quote before the single quote.
 void testSingleEclipsesDouble()
          Tests how a single quote can eclipse the effects of a double quote by inserting the single quote before the double quote.
 
Methods inherited from class edu.rice.cs.drjava.model.definitions.reducedmodel.BraceReductionTestCase
stateOfCurrentToken
 
Methods inherited from class edu.rice.cs.drjava.DrJavaTestCase
setConfigSetting, setDocText, tearDown
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_model

protected ReducedModelControl _model
Constructor Detail

MixedQuoteTest

public MixedQuoteTest()
Method Detail

setUp

protected void setUp()
              throws Exception
Initializes the reduced models used in the tests.

Overrides:
setUp in class BraceReductionTestCase
Throws:
Exception - This convention is mandated by JUnit.TestCase, the superclass of this class.

suite

public static junit.framework.Test suite()
Creates a test suite for JUnit to use.

Returns:
a test suite for JUnit

insertGap

protected void insertGap(BraceReduction model,
                         int size)
Convenience function to insert a number of non-special characters into a reduced model.

Overrides:
insertGap in class BraceReductionTestCase
Parameters:
model - the model being modified
size - the number of characters being inserted

testSingleEclipsesDouble

public void testSingleEclipsesDouble()
Tests how a single quote can eclipse the effects of a double quote by inserting the single quote before the double quote. This test caught an error with getStateAtCurrent(): the check for double quote status checks if there is a double quote immediately preceding, but it didn't make sure the double quote was FREE. I fixed that, so now the test passes.


testDoubleEclipsesSingle

public void testDoubleEclipsesSingle()
Tests how a double quote can eclipse the effects of a single quote by inserting the double quote before the single quote.