org.antlr.stringtemplate.test
Class TestStringTemplate

java.lang.Object
  extended byorg.antlr.stringtemplate.test.TestSuite
      extended byorg.antlr.stringtemplate.test.TestStringTemplate

public class TestStringTemplate
extends TestSuite

Test the various functionality of StringTemplate. Seems to run only on unix due to \r\n vs \n issue. David Scurrah says: "I don't think you were necessarily sloppy with your newlines, but Java make it very difficult to be consistant. The stringtemplate library used unix end of lines for writing toString methods and the like, while the testing was using the system local end of line. The other problem with end of lines was any template file used in the testing will also have a specific end of line ( this case unix) and when read into a string that can the unique problem of having end of line unix and local system end of line in the on line. My solution was not very elegant but I think it required the least changes and only to the testing. I simply converted all strings to use unix end of line characters inside the assertTrue and then compared them. The only other problem I found was writing a file out to the /tmp directory won't work on windows so I used the system property java.io.tmpdir to get a temp directory." I'll fix later.


Nested Class Summary
static class TestStringTemplate.A
           
static class TestStringTemplate.B
           
static class TestStringTemplate.C
           
 class TestStringTemplate.Connector
           
 class TestStringTemplate.Connector2
           
 class TestStringTemplate.Connector3
           
static class TestStringTemplate.Decl
           
static class TestStringTemplate.R1
           
static class TestStringTemplate.R2
           
static class TestStringTemplate.R3
           
static class TestStringTemplate.Tree
           
 
Field Summary
 
Fields inherited from class org.antlr.stringtemplate.test.TestSuite
testName
 
Constructor Summary
TestStringTemplate()
           
 
Method Summary
 void testAlternatingTemplateApplication()
           
 void testAlternativeWriter()
           
 void testAngleBracketsNoGroup()
           
 void testAngleBracketsWithGroupFile()
           
 void testAnonymousTemplateAccessToEnclosingAttributes()
           
 void testApplyAnonymousTemplateToAggregateAttribute()
           
 void testApplyAnonymousTemplateToArrayAndMapProperty()
           
 void testApplyAnonymousTemplateToMapAndSet()
           
 void testApplyAnonymousTemplateToMultiValuedAttribute()
           
 void testApplyAnonymousTemplateToSingleValuedAttribute()
           
 void testApplyingTemplateFromDiskWithPrecompiledIF()
           
 void testApplyRepeatedAnonymousTemplateWithForeignTemplateRefToMultiValuedAttribute()
           
 void testApplySuperTemplateRef()
           
 void testApplyTemplateNameExpression()
           
 void testApplyTemplateToSingleValuedAttribute()
           
 void testApplyTemplateToSingleValuedAttributeWithDefaultAttribute()
           
 void testAttributeRefButtedUpAgainstEndifAndWhitespace()
           
 void testChangingAttrValueRepeatedTemplateApplicationToVector()
           
 void testChangingAttrValueTemplateApplicationToVector()
           
 void testCharLiterals()
           
 void testCollectionAttributes()
           
 void testComplicatedIndirectTemplateApplication()
           
 void testComplicatedSeparatorExpr()
           
 void testDeliberateRecursiveTemplateApplication()
           
 void testDumpMapAndSet()
           
 void testElseClause()
           
 void testEmbeddedComments()
           
 void testEmbeddedCommentsAngleBracketed()
           
 void testEmbeddedMultiLineIF()
           
 void testEmptyIteratedConditionalValueGetsNoSeparator()
           
 void testEmptyIteratedConditionalWithElseValueGetsSeparator()
           
 void testEmptyIteratedValueGetsSeparator()
           
 void testEscapes()
           
 void testEscapesOutsideExpressions()
           
 void testExpressionAsRHSOfAssignment()
           
 void testExprInParens()
           
 void testFindTemplateInCLASSPATH()
           
 void testFormalArgumentAssignment()
           
 void testFormalArgumentAssignmentInApply()
           
 void testGroupFileFormat()
           
 void testHashMapPropertyFetch()
           
 void testIFBoolean()
          As of 2.0, you can test a boolean value
 void testIFTemplate()
           
 void testImmediateTemplateAsAttributeLoop()
           
 void testIndentBetweenLeftJustifiedLiterals()
           
 void testIndentOfMultilineAttributes()
           
 void testIndentOfMultipleBlankLines()
           
 void testIndirectTemplateApplication()
           
 void testInheritArgumentFromRecursiveTemplateApplication()
           
 void testLazyEvalOfSuperInApplySuperTemplateRef()
           
 void testListOfEmbeddedTemplateSeesEnclosingAttributes()
           
 void testMissingEndDelimiter()
           
 void testMissingInheritedAttribute()
           
 void testMultiLevelInheritance()
           
 void testMultipleAdditions()
           
 void testMultiValuedAttributeWithAnonymousTemplateUsingIndexVariableI()
           
 void testMultiValuedAttributeWithSeparator()
           
 void testNestedAnonymousTemplates()
           
 void testNestedAnonymousTemplatesAgain()
           
 void testNestedIF()
           
 void testNestedIFTemplate()
           
 void testNestedIndent()
           
 void testNullIndirectTemplate()
           
 void testNullIndirectTemplateApplication()
           
 void testNullTemplateApplication()
           
 void testNullTemplateToMultiValuedApplication()
           
 void testObjectPropertyReference()
           
 void testOverrideInheritance()
           
 void testParameterAndAttributeScoping()
           
 void testParenthesizedExpression()
           
 void testRecursion()
           
 void testReflection()
           
 void testReflectionRecursive()
           
 void testReflectionTypeLoop()
           
 void testReflectionWithMap()
           
 void testRepeatedApplicationOfTemplateToMultiValuedAttributeWithSeparator()
           
 void testRepeatedApplicationOfTemplateToSingleValuedAttribute()
           
 void testSetButNotRefd()
           
 void testSimpleAutoIndent()
           
 void testSimpleIndentOfAttributeList()
           
 void testSimpleInheritance()
           
 void testSingleValuedAttributes()
           
 void testSizeZeroButNonNullListGetsNoOutput()
           
 void testSizeZeroOnLineByItselfGetsNoOutput()
           
 void testSizeZeroOnLineWithIndentGetsNoOutput()
           
 void testStringCatenationOnSingleValuedAttribute()
           
 void testStringLiteralAsAttribute()
           
 void testSuperTemplateRef()
           
 void testTemplateAlias()
           
 void testTemplateApplicationAsRHSOfAssignment()
           
 void testTemplateGetPropertyGetsAttribute()
           
 void testTemplateNameExpression()
           
 void testTemplateParameterDecls()
          Check syntax and setAttribute-time errors
 void testTemplatePolymorphism()
           
 void testTemplateRedef()
           
 void testUndefinedArgumentAssignment()
           
 void testUndefinedArgumentAssignmentInApply()
           
 void testUndefinedAttributeReference()
           
 void testUndefinedDefaultAttributeReference()
           
 void testWhiteSpaceAtEndOfTemplate()
           
 
Methods inherited from class org.antlr.stringtemplate.test.TestSuite
assertEqual, assertEqual, assertTrue, assertTrue, getFailures, getSuccesses, invokeTest, runTest, time
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestStringTemplate

public TestStringTemplate()
Method Detail

testGroupFileFormat

public void testGroupFileFormat()
                         throws java.lang.Exception
Throws:
java.lang.Exception

testTemplateParameterDecls

public void testTemplateParameterDecls()
                                throws java.lang.Exception
Check syntax and setAttribute-time errors

Throws:
java.lang.Exception

testTemplateRedef

public void testTemplateRedef()
                       throws java.lang.Exception
Throws:
java.lang.Exception

testMissingInheritedAttribute

public void testMissingInheritedAttribute()
                                   throws java.lang.Exception
Throws:
java.lang.Exception

testFormalArgumentAssignment

public void testFormalArgumentAssignment()
                                  throws java.lang.Exception
Throws:
java.lang.Exception

testUndefinedArgumentAssignment

public void testUndefinedArgumentAssignment()
                                     throws java.lang.Exception
Throws:
java.lang.Exception

testFormalArgumentAssignmentInApply

public void testFormalArgumentAssignmentInApply()
                                         throws java.lang.Exception
Throws:
java.lang.Exception

testUndefinedArgumentAssignmentInApply

public void testUndefinedArgumentAssignmentInApply()
                                            throws java.lang.Exception
Throws:
java.lang.Exception

testUndefinedAttributeReference

public void testUndefinedAttributeReference()
                                     throws java.lang.Exception
Throws:
java.lang.Exception

testUndefinedDefaultAttributeReference

public void testUndefinedDefaultAttributeReference()
                                            throws java.lang.Exception
Throws:
java.lang.Exception

testAngleBracketsWithGroupFile

public void testAngleBracketsWithGroupFile()
                                    throws java.lang.Exception
Throws:
java.lang.Exception

testAngleBracketsNoGroup

public void testAngleBracketsNoGroup()
                              throws java.lang.Exception
Throws:
java.lang.Exception

testSimpleInheritance

public void testSimpleInheritance()
                           throws java.lang.Exception
Throws:
java.lang.Exception

testOverrideInheritance

public void testOverrideInheritance()
                             throws java.lang.Exception
Throws:
java.lang.Exception

testMultiLevelInheritance

public void testMultiLevelInheritance()
                               throws java.lang.Exception
Throws:
java.lang.Exception

testExprInParens

public void testExprInParens()
                      throws java.lang.Exception
Throws:
java.lang.Exception

testMultipleAdditions

public void testMultipleAdditions()
                           throws java.lang.Exception
Throws:
java.lang.Exception

testCollectionAttributes

public void testCollectionAttributes()
                              throws java.lang.Exception
Throws:
java.lang.Exception

testParenthesizedExpression

public void testParenthesizedExpression()
                                 throws java.lang.Exception
Throws:
java.lang.Exception

testApplyTemplateNameExpression

public void testApplyTemplateNameExpression()
                                     throws java.lang.Exception
Throws:
java.lang.Exception

testTemplateNameExpression

public void testTemplateNameExpression()
                                throws java.lang.Exception
Throws:
java.lang.Exception

testMissingEndDelimiter

public void testMissingEndDelimiter()
                             throws java.lang.Exception
Throws:
java.lang.Exception

testSetButNotRefd

public void testSetButNotRefd()
                       throws java.lang.Exception
Throws:
java.lang.Exception

testNullTemplateApplication

public void testNullTemplateApplication()
                                 throws java.lang.Exception
Throws:
java.lang.Exception

testNullTemplateToMultiValuedApplication

public void testNullTemplateToMultiValuedApplication()
                                              throws java.lang.Exception
Throws:
java.lang.Exception

testChangingAttrValueTemplateApplicationToVector

public void testChangingAttrValueTemplateApplicationToVector()
                                                      throws java.lang.Exception
Throws:
java.lang.Exception

testChangingAttrValueRepeatedTemplateApplicationToVector

public void testChangingAttrValueRepeatedTemplateApplicationToVector()
                                                              throws java.lang.Exception
Throws:
java.lang.Exception

testAlternatingTemplateApplication

public void testAlternatingTemplateApplication()
                                        throws java.lang.Exception
Throws:
java.lang.Exception

testExpressionAsRHSOfAssignment

public void testExpressionAsRHSOfAssignment()
                                     throws java.lang.Exception
Throws:
java.lang.Exception

testTemplateApplicationAsRHSOfAssignment

public void testTemplateApplicationAsRHSOfAssignment()
                                              throws java.lang.Exception
Throws:
java.lang.Exception

testParameterAndAttributeScoping

public void testParameterAndAttributeScoping()
                                      throws java.lang.Exception
Throws:
java.lang.Exception

testComplicatedSeparatorExpr

public void testComplicatedSeparatorExpr()
                                  throws java.lang.Exception
Throws:
java.lang.Exception

testAttributeRefButtedUpAgainstEndifAndWhitespace

public void testAttributeRefButtedUpAgainstEndifAndWhitespace()
                                                       throws java.lang.Exception
Throws:
java.lang.Exception

testStringCatenationOnSingleValuedAttribute

public void testStringCatenationOnSingleValuedAttribute()
                                                 throws java.lang.Exception
Throws:
java.lang.Exception

testApplyingTemplateFromDiskWithPrecompiledIF

public void testApplyingTemplateFromDiskWithPrecompiledIF()
                                                   throws java.lang.Exception
Throws:
java.lang.Exception

testMultiValuedAttributeWithAnonymousTemplateUsingIndexVariableI

public void testMultiValuedAttributeWithAnonymousTemplateUsingIndexVariableI()
                                                                      throws java.lang.Exception
Throws:
java.lang.Exception

testFindTemplateInCLASSPATH

public void testFindTemplateInCLASSPATH()
                                 throws java.lang.Exception
Throws:
java.lang.Exception

testApplyTemplateToSingleValuedAttribute

public void testApplyTemplateToSingleValuedAttribute()
                                              throws java.lang.Exception
Throws:
java.lang.Exception

testStringLiteralAsAttribute

public void testStringLiteralAsAttribute()
                                  throws java.lang.Exception
Throws:
java.lang.Exception

testApplyTemplateToSingleValuedAttributeWithDefaultAttribute

public void testApplyTemplateToSingleValuedAttributeWithDefaultAttribute()
                                                                  throws java.lang.Exception
Throws:
java.lang.Exception

testApplyAnonymousTemplateToSingleValuedAttribute

public void testApplyAnonymousTemplateToSingleValuedAttribute()
                                                       throws java.lang.Exception
Throws:
java.lang.Exception

testApplyAnonymousTemplateToMultiValuedAttribute

public void testApplyAnonymousTemplateToMultiValuedAttribute()
                                                      throws java.lang.Exception
Throws:
java.lang.Exception

testApplyAnonymousTemplateToAggregateAttribute

public void testApplyAnonymousTemplateToAggregateAttribute()
                                                    throws java.lang.Exception
Throws:
java.lang.Exception

testRepeatedApplicationOfTemplateToSingleValuedAttribute

public void testRepeatedApplicationOfTemplateToSingleValuedAttribute()
                                                              throws java.lang.Exception
Throws:
java.lang.Exception

testRepeatedApplicationOfTemplateToMultiValuedAttributeWithSeparator

public void testRepeatedApplicationOfTemplateToMultiValuedAttributeWithSeparator()
                                                                          throws java.lang.Exception
Throws:
java.lang.Exception

testMultiValuedAttributeWithSeparator

public void testMultiValuedAttributeWithSeparator()
                                           throws java.lang.Exception
Throws:
java.lang.Exception

testSingleValuedAttributes

public void testSingleValuedAttributes()
                                throws java.lang.Exception
Throws:
java.lang.Exception

testIFTemplate

public void testIFTemplate()
                    throws java.lang.Exception
Throws:
java.lang.Exception

testIFBoolean

public void testIFBoolean()
                   throws java.lang.Exception
As of 2.0, you can test a boolean value

Throws:
java.lang.Exception

testNestedIFTemplate

public void testNestedIFTemplate()
                          throws java.lang.Exception
Throws:
java.lang.Exception

testObjectPropertyReference

public void testObjectPropertyReference()
                                 throws java.lang.Exception
Throws:
java.lang.Exception

testApplyRepeatedAnonymousTemplateWithForeignTemplateRefToMultiValuedAttribute

public void testApplyRepeatedAnonymousTemplateWithForeignTemplateRefToMultiValuedAttribute()
                                                                                    throws java.lang.Exception
Throws:
java.lang.Exception

testRecursion

public void testRecursion()
                   throws java.lang.Exception
Throws:
java.lang.Exception

testNestedAnonymousTemplates

public void testNestedAnonymousTemplates()
                                  throws java.lang.Exception
Throws:
java.lang.Exception

testAnonymousTemplateAccessToEnclosingAttributes

public void testAnonymousTemplateAccessToEnclosingAttributes()
                                                      throws java.lang.Exception
Throws:
java.lang.Exception

testNestedAnonymousTemplatesAgain

public void testNestedAnonymousTemplatesAgain()
                                       throws java.lang.Exception
Throws:
java.lang.Exception

testEscapes

public void testEscapes()
                 throws java.lang.Exception
Throws:
java.lang.Exception

testEscapesOutsideExpressions

public void testEscapesOutsideExpressions()
                                   throws java.lang.Exception
Throws:
java.lang.Exception

testElseClause

public void testElseClause()
                    throws java.lang.Exception
Throws:
java.lang.Exception

testNestedIF

public void testNestedIF()
                  throws java.lang.Exception
Throws:
java.lang.Exception

testEmbeddedMultiLineIF

public void testEmbeddedMultiLineIF()
                             throws java.lang.Exception
Throws:
java.lang.Exception

testSimpleIndentOfAttributeList

public void testSimpleIndentOfAttributeList()
                                     throws java.lang.Exception
Throws:
java.lang.Exception

testIndentOfMultilineAttributes

public void testIndentOfMultilineAttributes()
                                     throws java.lang.Exception
Throws:
java.lang.Exception

testIndentOfMultipleBlankLines

public void testIndentOfMultipleBlankLines()
                                    throws java.lang.Exception
Throws:
java.lang.Exception

testIndentBetweenLeftJustifiedLiterals

public void testIndentBetweenLeftJustifiedLiterals()
                                            throws java.lang.Exception
Throws:
java.lang.Exception

testNestedIndent

public void testNestedIndent()
                      throws java.lang.Exception
Throws:
java.lang.Exception

testAlternativeWriter

public void testAlternativeWriter()
                           throws java.lang.Exception
Throws:
java.lang.Exception

testApplyAnonymousTemplateToMapAndSet

public void testApplyAnonymousTemplateToMapAndSet()
                                           throws java.lang.Exception
Throws:
java.lang.Exception

testDumpMapAndSet

public void testDumpMapAndSet()
                       throws java.lang.Exception
Throws:
java.lang.Exception

testApplyAnonymousTemplateToArrayAndMapProperty

public void testApplyAnonymousTemplateToArrayAndMapProperty()
                                                     throws java.lang.Exception
Throws:
java.lang.Exception

testSuperTemplateRef

public void testSuperTemplateRef()
                          throws java.lang.Exception
Throws:
java.lang.Exception

testApplySuperTemplateRef

public void testApplySuperTemplateRef()
                               throws java.lang.Exception
Throws:
java.lang.Exception

testLazyEvalOfSuperInApplySuperTemplateRef

public void testLazyEvalOfSuperInApplySuperTemplateRef()
                                                throws java.lang.Exception
Throws:
java.lang.Exception

testTemplatePolymorphism

public void testTemplatePolymorphism()
                              throws java.lang.Exception
Throws:
java.lang.Exception

testListOfEmbeddedTemplateSeesEnclosingAttributes

public void testListOfEmbeddedTemplateSeesEnclosingAttributes()
                                                       throws java.lang.Exception
Throws:
java.lang.Exception

testInheritArgumentFromRecursiveTemplateApplication

public void testInheritArgumentFromRecursiveTemplateApplication()
                                                         throws java.lang.Exception
Throws:
java.lang.Exception

testDeliberateRecursiveTemplateApplication

public void testDeliberateRecursiveTemplateApplication()
                                                throws java.lang.Exception
Throws:
java.lang.Exception

testImmediateTemplateAsAttributeLoop

public void testImmediateTemplateAsAttributeLoop()
                                          throws java.lang.Exception
Throws:
java.lang.Exception

testTemplateAlias

public void testTemplateAlias()
                       throws java.lang.Exception
Throws:
java.lang.Exception

testTemplateGetPropertyGetsAttribute

public void testTemplateGetPropertyGetsAttribute()
                                          throws java.lang.Exception
Throws:
java.lang.Exception

testComplicatedIndirectTemplateApplication

public void testComplicatedIndirectTemplateApplication()
                                                throws java.lang.Exception
Throws:
java.lang.Exception

testIndirectTemplateApplication

public void testIndirectTemplateApplication()
                                     throws java.lang.Exception
Throws:
java.lang.Exception

testNullIndirectTemplateApplication

public void testNullIndirectTemplateApplication()
                                         throws java.lang.Exception
Throws:
java.lang.Exception

testNullIndirectTemplate

public void testNullIndirectTemplate()
                              throws java.lang.Exception
Throws:
java.lang.Exception

testReflection

public void testReflection()
                    throws java.lang.Exception
Throws:
java.lang.Exception

testReflectionRecursive

public void testReflectionRecursive()
                             throws java.lang.Exception
Throws:
java.lang.Exception

testReflectionTypeLoop

public void testReflectionTypeLoop()
                            throws java.lang.Exception
Throws:
java.lang.Exception

testReflectionWithMap

public void testReflectionWithMap()
                           throws java.lang.Exception
Throws:
java.lang.Exception

testHashMapPropertyFetch

public void testHashMapPropertyFetch()
                              throws java.lang.Exception
Throws:
java.lang.Exception

testEmbeddedComments

public void testEmbeddedComments()
                          throws java.lang.Exception
Throws:
java.lang.Exception

testEmbeddedCommentsAngleBracketed

public void testEmbeddedCommentsAngleBracketed()
                                        throws java.lang.Exception
Throws:
java.lang.Exception

testCharLiterals

public void testCharLiterals()
                      throws java.lang.Exception
Throws:
java.lang.Exception

testEmptyIteratedValueGetsSeparator

public void testEmptyIteratedValueGetsSeparator()
                                         throws java.lang.Exception
Throws:
java.lang.Exception

testEmptyIteratedConditionalValueGetsNoSeparator

public void testEmptyIteratedConditionalValueGetsNoSeparator()
                                                      throws java.lang.Exception
Throws:
java.lang.Exception

testEmptyIteratedConditionalWithElseValueGetsSeparator

public void testEmptyIteratedConditionalWithElseValueGetsSeparator()
                                                            throws java.lang.Exception
Throws:
java.lang.Exception

testWhiteSpaceAtEndOfTemplate

public void testWhiteSpaceAtEndOfTemplate()
                                   throws java.lang.Exception
Throws:
java.lang.Exception

testSizeZeroButNonNullListGetsNoOutput

public void testSizeZeroButNonNullListGetsNoOutput()
                                            throws java.lang.Exception
Throws:
java.lang.Exception

testSizeZeroOnLineByItselfGetsNoOutput

public void testSizeZeroOnLineByItselfGetsNoOutput()
                                            throws java.lang.Exception
Throws:
java.lang.Exception

testSizeZeroOnLineWithIndentGetsNoOutput

public void testSizeZeroOnLineWithIndentGetsNoOutput()
                                              throws java.lang.Exception
Throws:
java.lang.Exception

testSimpleAutoIndent

public void testSimpleAutoIndent()
                          throws java.lang.Exception
Throws:
java.lang.Exception