com.google.caja.parser.js.scope
Class ScopeAnalyzerTest

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.js.scope.ScopeAnalyzerTest
All Implemented Interfaces:
junit.framework.Test

public class ScopeAnalyzerTest
extends CajaTestCase


Nested Class Summary
(package private) static class ScopeAnalyzerTest.TestScope
           
private  class ScopeAnalyzerTest.TestScopeListener
           
 
Field Summary
(package private)  java.util.List<java.lang.String> events
           
(package private)  ScopeListener<ScopeAnalyzerTest.TestScope> listener
           
 
Fields inherited from class com.google.caja.util.CajaTestCase
is, mc, mq, SEED
 
Constructor Summary
ScopeAnalyzerTest()
           
 
Method Summary
private static
<S extends AbstractScope>
java.util.List<ScopeAnalyzer<S>>
allImplementations(ScopeListener<S> listener)
           
private  void assertEvents(java.lang.String... expected)
           
private  void assertScoping(AncestorChain<Block> program, java.util.List<ScopeAnalyzer<ScopeAnalyzerTest.TestScope>> impls, java.lang.String... goldenEvents)
           
private static
<S extends AbstractScope>
java.util.List<ScopeAnalyzer<S>>
notJScript(ScopeListener<S> listener)
           
private  AncestorChain<Block> program(java.lang.String... lines)
           
 void setUp()
           
 void testAssignments()
           
 void testDupesAndMasking()
           
 void testExceptionReadAndAssign()
           
 void testFnCtorsInES5()
           
 void testFnCtorsInJScript()
           
 void testFnCtorsInWorstCase()
           
 void testFnDeclInCatch()
           
 void testFnDeclInCatchJS()
           
 void testFnDecls()
           
 void testForEachLoopAssignsPropName1()
           
 void testForEachLoopAssignsPropName2()
           
 void testGlobalScope()
           
 void testHoistingOfDecls1()
           
 void testHoistingOfDecls2()
           
 void testImmediatelyCalledFns1()
           
 void testImmediatelyCalledFns2()
           
 void testImmediatelyCalledFns3()
           
 void testMasking1()
           
 void testMasking2()
           
 void testSameName1()
           
 void testSameName2()
           
 void testSameName3()
           
 void testSameName4()
           
 void testSplitInitialization()
           
 void testUsageOfArguments()
           
 void testUsageOfThis1()
           
 void testUsageOfThis2()
           
 void testWithBlock()
           
 
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, 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

events

java.util.List<java.lang.String> events

listener

ScopeListener<ScopeAnalyzerTest.TestScope> listener
Constructor Detail

ScopeAnalyzerTest

public ScopeAnalyzerTest()
Method Detail

testGlobalScope

public final void testGlobalScope()
                           throws ParseException
Throws:
ParseException

testFnDecls

public final void testFnDecls()
                       throws ParseException
Throws:
ParseException

testFnCtorsInES5

public final void testFnCtorsInES5()
                            throws ParseException
Throws:
ParseException

testFnCtorsInJScript

public final void testFnCtorsInJScript()
                                throws ParseException
Throws:
ParseException

testFnCtorsInWorstCase

public final void testFnCtorsInWorstCase()
                                  throws ParseException
Throws:
ParseException

testHoistingOfDecls1

public final void testHoistingOfDecls1()
                                throws ParseException
Throws:
ParseException

testHoistingOfDecls2

public final void testHoistingOfDecls2()
                                throws ParseException
Throws:
ParseException

testUsageOfThis1

public final void testUsageOfThis1()
                            throws ParseException
Throws:
ParseException

testUsageOfThis2

public final void testUsageOfThis2()
                            throws ParseException
Throws:
ParseException

testUsageOfArguments

public final void testUsageOfArguments()
                                throws ParseException
Throws:
ParseException

testDupesAndMasking

public final void testDupesAndMasking()
                               throws ParseException
Throws:
ParseException

testMasking1

public final void testMasking1()
                        throws ParseException
Throws:
ParseException

testSplitInitialization

public final void testSplitInitialization()
                                   throws ParseException
Throws:
ParseException

testMasking2

public final void testMasking2()
                        throws ParseException
Throws:
ParseException

testAssignments

public final void testAssignments()
                           throws ParseException
Throws:
ParseException

testForEachLoopAssignsPropName1

public final void testForEachLoopAssignsPropName1()
                                           throws ParseException
Throws:
ParseException

testForEachLoopAssignsPropName2

public final void testForEachLoopAssignsPropName2()
                                           throws ParseException
Throws:
ParseException

testSameName1

public final void testSameName1()
                         throws ParseException
Throws:
ParseException

testFnDeclInCatch

public final void testFnDeclInCatch()
                             throws ParseException
Throws:
ParseException

testFnDeclInCatchJS

public final void testFnDeclInCatchJS()
                               throws ParseException
Throws:
ParseException

testExceptionReadAndAssign

public final void testExceptionReadAndAssign()
                                      throws ParseException
Throws:
ParseException

testSameName2

public final void testSameName2()
                         throws ParseException
Throws:
ParseException

testSameName3

public final void testSameName3()
                         throws ParseException
Throws:
ParseException

testSameName4

public final void testSameName4()
                         throws ParseException
Throws:
ParseException

testWithBlock

public final void testWithBlock()
                         throws ParseException
Throws:
ParseException

testImmediatelyCalledFns1

public final void testImmediatelyCalledFns1()
                                     throws ParseException
Throws:
ParseException

testImmediatelyCalledFns2

public final void testImmediatelyCalledFns2()
                                     throws ParseException
Throws:
ParseException

testImmediatelyCalledFns3

public final void testImmediatelyCalledFns3()
                                     throws ParseException
Throws:
ParseException

setUp

public void setUp()
           throws java.lang.Exception
Overrides:
setUp in class CajaTestCase
Throws:
java.lang.Exception

program

private AncestorChain<Block> program(java.lang.String... lines)
                              throws ParseException
Throws:
ParseException

assertEvents

private void assertEvents(java.lang.String... expected)

assertScoping

private void assertScoping(AncestorChain<Block> program,
                           java.util.List<ScopeAnalyzer<ScopeAnalyzerTest.TestScope>> impls,
                           java.lang.String... goldenEvents)

allImplementations

private static <S extends AbstractScope> java.util.List<ScopeAnalyzer<S>> allImplementations(ScopeListener<S> listener)

notJScript

private static <S extends AbstractScope> java.util.List<ScopeAnalyzer<S>> notJScript(ScopeListener<S> listener)


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