com.google.caja.render
Class JsPrettyPrinterTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by com.google.caja.util.CajaTestCase
              extended by com.google.caja.render.JsPrettyPrinterTest
All Implemented Interfaces:
junit.framework.Test

public class JsPrettyPrinterTest
extends CajaTestCase


Field Summary
private static Keyword[] KEYWORDS
           
private static Operator[] OPERATORS
           
private static JsTokenType[] TYPES
           
private static java.lang.String WORD_CHARS
           
 
Fields inherited from class com.google.caja.util.CajaTestCase
is, mc, mq, SEED
 
Constructor Summary
JsPrettyPrinterTest()
           
 
Method Summary
private  void assertLexed(java.lang.String golden, java.lang.String input)
           
private  void assertRendered(java.lang.String golden, ParseTreeNode node)
           
private  void assertRendered(java.lang.String golden, java.lang.String input)
           
private  void assertTokens(java.lang.String golden, java.lang.String... input)
           
private  java.util.List<java.lang.String> generateRandomTokens(java.util.Random rnd)
           
private static java.lang.String randomString(java.util.Random rnd)
           
private static java.lang.String randomWord(java.util.Random rnd)
           
private static java.lang.String simplifyComments(java.lang.String token)
          The renderer is allowed to muck with comment internals to fix problems with line-breaks in restricted productions.
 void testAdjacentBlocks()
           
 void testBreakBeforeWhile()
           
 void testComments()
           
 void testCommentsInRestrictedProductions1()
           
 void testCommentsInRestrictedProductions2()
           
 void testConditional()
           
 void testDivisionByRegex()
           
 void testEmptyBlock()
           
 void testIndentationAfterParens1()
           
 void testIndentationAfterParens2()
           
 void testIndentationAfterParens3()
           
 void testIndentationAfterParens4()
           
 void testJSON()
           
 void testLongLines()
           
 void testMarkupEndStructures()
           
 void testMultipleStatements()
           
 void testNegatedNegativeNumericConstants()
           
 void testNumberPropertyAccess()
           
 void testObjectConstructor()
           
 void testRetokenization()
           
 void testSemisInsideParents()
           
 void testSimpleStatement()
           
 
Methods inherited from class com.google.caja.util.CajaTestCase
assertArrayEquals, assertCloneable, assertDeepEquals, assertMessage, assertMessage, assertMessagesLessSevereThan, assertNoErrors, assertNoMessage, assertNoWarnings, checkHeadless, css, css, cssDecls, cssDecls, dataFromResource, formatShort, fromResource, fromResource, fromString, fromString, fromString, html, htmlFragment, js, js, js, jsExpr, jsExpr, markup, markupFragment, minify, plain, quasi, render, render, renderProgram, runTest, setUp, tearDown, xml, xmlFragment
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPES

private static final JsTokenType[] TYPES

OPERATORS

private static final Operator[] OPERATORS

KEYWORDS

private static final Keyword[] KEYWORDS

WORD_CHARS

private static final java.lang.String WORD_CHARS
See Also:
Constant Field Values
Constructor Detail

JsPrettyPrinterTest

public JsPrettyPrinterTest()
Method Detail

testEmptyBlock

public final void testEmptyBlock()
                          throws java.lang.Exception
Throws:
java.lang.Exception

testAdjacentBlocks

public final void testAdjacentBlocks()
                              throws java.lang.Exception
Throws:
java.lang.Exception

testSimpleStatement

public final void testSimpleStatement()
                               throws java.lang.Exception
Throws:
java.lang.Exception

testLongLines

public final void testLongLines()
                         throws java.lang.Exception
Throws:
java.lang.Exception

testSemisInsideParents

public final void testSemisInsideParents()
                                  throws java.lang.Exception
Throws:
java.lang.Exception

testObjectConstructor

public final void testObjectConstructor()
                                 throws java.lang.Exception
Throws:
java.lang.Exception

testMultipleStatements

public final void testMultipleStatements()
                                  throws java.lang.Exception
Throws:
java.lang.Exception

testBreakBeforeWhile

public final void testBreakBeforeWhile()
                                throws java.lang.Exception
Throws:
java.lang.Exception

testMarkupEndStructures

public final void testMarkupEndStructures()
                                   throws java.lang.Exception
Throws:
java.lang.Exception

testJSON

public final void testJSON()
                    throws java.lang.Exception
Throws:
java.lang.Exception

testConditional

public final void testConditional()
                           throws java.lang.Exception
Throws:
java.lang.Exception

testNumberPropertyAccess

public final void testNumberPropertyAccess()
                                    throws java.lang.Exception
Throws:
java.lang.Exception

testComments

public final void testComments()
                        throws java.lang.Exception
Throws:
java.lang.Exception

testDivisionByRegex

public final void testDivisionByRegex()
                               throws java.lang.Exception
Throws:
java.lang.Exception

testNegatedNegativeNumericConstants

public final void testNegatedNegativeNumericConstants()

testRetokenization

public final void testRetokenization()
                              throws java.lang.Exception
Throws:
java.lang.Exception

simplifyComments

private static java.lang.String simplifyComments(java.lang.String token)
The renderer is allowed to muck with comment internals to fix problems with line-breaks in restricted productions.


testIndentationAfterParens1

public final void testIndentationAfterParens1()

testIndentationAfterParens2

public final void testIndentationAfterParens2()

testIndentationAfterParens3

public final void testIndentationAfterParens3()

testIndentationAfterParens4

public final void testIndentationAfterParens4()

testCommentsInRestrictedProductions1

public final void testCommentsInRestrictedProductions1()

testCommentsInRestrictedProductions2

public final void testCommentsInRestrictedProductions2()

generateRandomTokens

private java.util.List<java.lang.String> generateRandomTokens(java.util.Random rnd)

randomWord

private static java.lang.String randomWord(java.util.Random rnd)

randomString

private static java.lang.String randomString(java.util.Random rnd)

assertRendered

private void assertRendered(java.lang.String golden,
                            java.lang.String input)
                     throws java.lang.Exception
Throws:
java.lang.Exception

assertRendered

private void assertRendered(java.lang.String golden,
                            ParseTreeNode node)

assertLexed

private void assertLexed(java.lang.String golden,
                         java.lang.String input)
                  throws java.lang.Exception
Throws:
java.lang.Exception

assertTokens

private void assertTokens(java.lang.String golden,
                          java.lang.String... input)


Copyright (C) 2008 Google Inc.
Licensed under the Apache License, Version 2.0