com.google.caja.parser.quasiliteral
Class ScopeTest

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.parser.quasiliteral.ScopeTest
All Implemented Interfaces:
junit.framework.Test

public class ScopeTest
extends CajaTestCase

Author:
ihab.awad@gmail.com

Nested Class Summary
private static class ScopeTest.Holder<T>
           
 
Field Summary
 
Fields inherited from class com.google.caja.util.CajaTestCase
is, mc, mq, SEED
 
Constructor Summary
ScopeTest()
           
 
Method Summary
private  void assertFreeVariables(java.lang.String code, java.lang.String freeVariables, java.lang.String notFreeVariables)
           
private  void assertFunctionRedefined(java.lang.String code, boolean recurseIntoFunction, MessageType type, MessageLevel level)
           
private  void assertMsgLevel(MessageLevel level, Message message)
           
private  void assertMsgType(MessageType type, Message message)
           
private  FunctionConstructor findFunctionConstructor(ParseTreeNode root, java.lang.String name)
           
private
<T extends ParseTreeNode>
T
findNodeWithIdentifier(ParseTreeNode root, java.lang.Class<T> clazz, java.lang.String identifierValue)
           
 void testAnonymousFunction()
           
 void testBodyOfNamedFunction()
           
 void testCatchBlocks()
           
 void testFormalParams()
           
 void testFreeVariableCatchStmt()
           
 void testFreeVariableDeclaration()
           
 void testFreeVariableFunction()
           
 void testFreeVariableFunctionParams()
           
 void testFreeVariableFunctionWithMember()
           
 void testFreeVariablesDotted()
           
 void testFreeVariablesIndexedChained()
           
 void testFreeVariablesIndexedRecursive()
           
 void testFunctionsRedefined()
           
 void testMaskedExceptionVariablesErrorA()
           
 void testMaskedExceptionVariablesErrorB()
           
 void testMaskedExceptionVariablesSame()
           
 void testNamedFunction()
           
 void testNamedFunctionSameName()
           
 void testSimpleDeclaredFunction()
           
 void testStartStatementsForCatchStmt()
           
 void testStartStatementsForFunctionConstructor()
           
 void testStartStatementsForParseTreeNodeContainer()
           
 void testStartStatementsForPlainBlock()
           
 void testStartStatementsForProgram()
           
 void testUnmaskableFormals()
           
 void testUnmaskableIdentifiersInCatch()
           
 void testUnmaskableIdentifiersInDeclarations()
           
 
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
 

Constructor Detail

ScopeTest

public ScopeTest()
Method Detail

testSimpleDeclaredFunction

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

testFreeVariablesDotted

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

testFreeVariablesIndexedChained

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

testFreeVariablesIndexedRecursive

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

testFreeVariableFunction

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

testFreeVariableFunctionWithMember

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

testFreeVariableFunctionParams

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

testFreeVariableDeclaration

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

testFreeVariableCatchStmt

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

assertFreeVariables

private void assertFreeVariables(java.lang.String code,
                                 java.lang.String freeVariables,
                                 java.lang.String notFreeVariables)
                          throws java.lang.Exception
Throws:
java.lang.Exception

testAnonymousFunction

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

testNamedFunction

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

testNamedFunctionSameName

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

testFormalParams

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

testCatchBlocks

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

testBodyOfNamedFunction

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

testMaskedExceptionVariablesErrorA

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

testMaskedExceptionVariablesErrorB

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

testMaskedExceptionVariablesSame

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

assertFunctionRedefined

private void assertFunctionRedefined(java.lang.String code,
                                     boolean recurseIntoFunction,
                                     MessageType type,
                                     MessageLevel level)
                              throws java.lang.Exception
Throws:
java.lang.Exception

testFunctionsRedefined

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

testStartStatementsForProgram

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

testStartStatementsForPlainBlock

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

testStartStatementsForCatchStmt

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

testStartStatementsForFunctionConstructor

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

testStartStatementsForParseTreeNodeContainer

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

testUnmaskableIdentifiersInCatch

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

testUnmaskableIdentifiersInDeclarations

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

testUnmaskableFormals

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

findFunctionConstructor

private FunctionConstructor findFunctionConstructor(ParseTreeNode root,
                                                    java.lang.String name)

findNodeWithIdentifier

private <T extends ParseTreeNode> T findNodeWithIdentifier(ParseTreeNode root,
                                                           java.lang.Class<T> clazz,
                                                           java.lang.String identifierValue)

assertMsgType

private void assertMsgType(MessageType type,
                           Message message)

assertMsgLevel

private void assertMsgLevel(MessageLevel level,
                            Message message)


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