update to JUnit 4

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3747 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
msridhar1 2009-07-27 23:21:22 +00:00
parent a0926ef664
commit 8b41d7fc88
17 changed files with 121 additions and 89 deletions

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.cast.js.rhino.test"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.ibm.wala.cast.js.rhino.test"/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5&quot; javaProject=&quot;com.ibm.wala.cast.js.rhino.test&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#10;&lt;memento exportedEntriesOnly=&quot;false&quot; project=&quot;com.ibm.wala.cast.js.rhino.test&quot;/&gt;&#10;&lt;/runtimeClasspathEntry&gt;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.ibm.wala.cast.js.test/examples-src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#10;"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.cast.js.rhino.test"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx800M -verbose:gc"/>
</launchConfiguration>

View File

@ -13,6 +13,6 @@ Require-Bundle: org.eclipse.core.runtime,
com.ibm.wala.cast.js.test;bundle-version="1.0.0",
com.ibm.wala.cast.test;bundle-version="1.0.0",
com.ibm.wala.core.tests;bundle-version="1.1.3",
org.junit;bundle-version="3.8.2"
org.junit4;bundle-version="4.3.1"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy

View File

@ -10,22 +10,19 @@
*****************************************************************************/
package com.ibm.wala.cast.js.test;
import java.io.IOException;
import java.net.URL;
import org.junit.Before;
import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
import com.ibm.wala.cast.js.translator.JavaScriptTranslatorFactory;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.util.CancelException;
public class TestAjaxsltCallGraphShapeRhino extends TestJSCallGraphShape {
public class TestAjaxsltCallGraphShapeRhino extends TestAjaxsltCallGraphShape {
public static void main(String[] args) {
justThisTest(TestAjaxsltCallGraphShapeRhino.class);
}
@Before
public void setUp() {
Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
com.ibm.wala.cast.js.ipa.callgraph.Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
}

View File

@ -10,6 +10,8 @@
*****************************************************************************/
package com.ibm.wala.cast.js.test;
import org.junit.Before;
import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
public class TestMediawikiCallGraphShapeRhino extends TestMediawikiCallGraphShape {
@ -18,8 +20,9 @@ public class TestMediawikiCallGraphShapeRhino extends TestMediawikiCallGraphShap
justThisTest(TestMediawikiCallGraphShapeRhino.class);
}
@Before
public void setUp() {
Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
com.ibm.wala.cast.js.ipa.callgraph.Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
}
}

View File

@ -10,6 +10,8 @@
*****************************************************************************/
package com.ibm.wala.cast.js.test;
import org.junit.Before;
import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
public class TestSimpleCallGraphShapeRhino extends TestSimpleCallGraphShape {
@ -18,8 +20,9 @@ public class TestSimpleCallGraphShapeRhino extends TestSimpleCallGraphShape {
justThisTest(TestSimpleCallGraphShapeRhino.class);
}
@Before
public void setUp() {
Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
com.ibm.wala.cast.js.ipa.callgraph.Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
}
}

View File

@ -10,21 +10,18 @@
*****************************************************************************/
package com.ibm.wala.cast.js.test;
import java.io.IOException;
import java.net.URL;
import org.junit.Before;
import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
import com.ibm.wala.cast.js.translator.JavaScriptTranslatorFactory;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.util.CancelException;
public class TestSimplePageCallGraphShapeRhino extends TestJSCallGraphShape {
public class TestSimplePageCallGraphShapeRhino extends TestSimplePageCallGraphShape {
public static void main(String[] args) {
justThisTest(TestSimplePageCallGraphShapeRhino.class);
}
@Before
public void setUp() {
Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
com.ibm.wala.cast.js.ipa.callgraph.Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
}
}

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="source"/>
<classpathentry exported="true" kind="lib" path="lib/js.jar"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="lib" path="lib/js.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -521,7 +521,7 @@ public class RhinoToAstTranslator {
// code is fishy. This should be cleaned up and the unchecked suppressWarnings
// should be removed.
private CAstEntity walkEntity(final ScriptOrFnNode n, WalkContext context) {
final FunctionContext child = (n instanceof FunctionNode) ? new FunctionContext(context, (FunctionNode) n) : new ScriptContext(
final FunctionContext child = (n instanceof FunctionNode) ? new FunctionContext(context, n) : new ScriptContext(
context, n, n.getSourceName());
CAstNode[] stmts = gatherChildren(n, child);
@ -549,7 +549,7 @@ public class RhinoToAstTranslator {
if (v instanceof Collection)
subs.put(k, (Set<CAstEntity>) v);
else {
Set<CAstEntity> s = (Set<CAstEntity>)Collections.singleton((CAstEntity)v);
Set<CAstEntity> s = Collections.singleton((CAstEntity)v);
subs.put(k, s);
}
}

View File

@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="harness-src"/>
<classpathentry kind="src" path="examples-src"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.ibm.wala.cast.test"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="harness-src"/>
<classpathentry kind="src" path="examples-src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,23 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.cast.js.test"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.ibm.wala.cast.js.test"/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot; javaProject=&quot;com.ibm.wala.cast.js.test&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#13;&#10;&lt;memento exportedEntriesOnly=&quot;false&quot; project=&quot;com.ibm.wala.cast.js.test&quot;/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.ibm.wala.cast.js.test/examples-src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.cast.js.test"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx800M -verbose:gc"/>
</launchConfiguration>
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.cast.js.test"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.ibm.wala.cast.js.test"/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot; javaProject=&quot;com.ibm.wala.cast.js.test&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#13;&#10;&lt;memento exportedEntriesOnly=&quot;false&quot; project=&quot;com.ibm.wala.cast.js.test&quot;/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.ibm.wala.cast.js.test/examples-src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.cast.js.test"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx800M -verbose:gc"/>
</launchConfiguration>

View File

@ -1,13 +1,17 @@
#Sun Dec 14 15:56:36 EST 2008
#Mon Jul 27 17:14:09 MDT 2009
eclipse.preferences.version=1
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
@ -51,6 +55,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.5
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
@ -94,11 +99,9 @@ org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
org.eclipse.jdt.core.formatter.comment.format_block_comments=true
org.eclipse.jdt.core.formatter.comment.format_comments=true
org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
@ -124,7 +127,6 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert

View File

@ -11,6 +11,8 @@ Require-Bundle: com.ibm.wala.cast.js,
com.ibm.wala.core,
org.eclipse.core.runtime,
com.ibm.wala.core.tests,
org.junit
org.junit4;bundle-version="4.3.1",
com.ibm.wala.cast.test;bundle-version="1.0.0"
Bundle-ActivationPolicy: lazy
Export-Package: com.ibm.wala.cast.js.test
Bundle-RequiredExecutionEnvironment: J2SE-1.5

View File

@ -13,11 +13,12 @@ package com.ibm.wala.cast.js.test;
import java.io.IOException;
import java.net.URL;
import com.ibm.wala.cast.js.translator.JavaScriptTranslatorFactory;
import org.junit.Test;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.util.CancelException;
public class TestAjaxsltCallGraphShape extends TestJSCallGraphShape {
public abstract class TestAjaxsltCallGraphShape extends TestJSCallGraphShape {
public static void main(String[] args) {
justThisTest(TestAjaxsltCallGraphShape.class);
@ -27,7 +28,7 @@ public class TestAjaxsltCallGraphShape extends TestJSCallGraphShape {
};
public void testAjaxslt() throws IOException, IllegalArgumentException, CancelException {
@Test public void testAjaxslt() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("ajaxslt/test/xslt.html");
CallGraph CG = Util.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForAjaxslt);
@ -37,7 +38,7 @@ public class TestAjaxsltCallGraphShape extends TestJSCallGraphShape {
};
public void testAjaxpath() throws IOException, IllegalArgumentException, CancelException {
@Test public void testAjaxpath() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("ajaxslt/test/xpath.html");
CallGraph CG = Util.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForAjaxpath);

View File

@ -13,11 +13,12 @@ package com.ibm.wala.cast.js.test;
import java.io.IOException;
import java.net.URL;
import com.ibm.wala.cast.js.translator.JavaScriptTranslatorFactory;
import org.junit.Test;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.util.CancelException;
public class TestMediawikiCallGraphShape extends TestJSCallGraphShape {
public abstract class TestMediawikiCallGraphShape extends TestJSCallGraphShape {
public static void main(String[] args) {
justThisTest(TestMediawikiCallGraphShape.class);
@ -27,7 +28,7 @@ public class TestMediawikiCallGraphShape extends TestJSCallGraphShape {
};
public void testSwineFlu() throws IOException, IllegalArgumentException, CancelException {
@Test public void testSwineFlu() throws IOException, IllegalArgumentException, CancelException {
URL url = new URL("http://en.wikipedia.org/wiki/2009_swine_flu_outbreak");
CallGraph CG = Util.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForSwineFlu);

View File

@ -12,12 +12,13 @@ package com.ibm.wala.cast.js.test;
import java.io.IOException;
import com.ibm.wala.cast.js.translator.JavaScriptTranslatorFactory;
import org.junit.Test;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.propagation.PropagationCallGraphBuilder;
import com.ibm.wala.util.CancelException;
public class TestSimpleCallGraphShape extends TestJSCallGraphShape {
public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
public static void main(String[] args) {
justThisTest(TestSimpleCallGraphShape.class);
@ -35,7 +36,7 @@ public class TestSimpleCallGraphShape extends TestJSCallGraphShape {
new Object[] { "tests/simple.js/fib", new String[] { "tests/simple.js/fib" } },
new Object[] { "tests/simple.js/weirder", new String[] { "prologue.js/abs" } } };
public void testSimple() throws IOException, IllegalArgumentException, CancelException {
@Test public void testSimple() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "simple.js");
verifyGraphAssertions(CG, assertionsForSimple);
}
@ -48,7 +49,7 @@ public class TestSimpleCallGraphShape extends TestJSCallGraphShape {
new String[] { "tests/objects.js/something", "tests/objects.js/objects_are_fun/nothing" } },
new Object[] { "tests/objects.js/objects_are_fun", new String[] { "tests/objects.js/other", "tests/objects.js/whatever" } } };
public void testObjects() throws IOException, IllegalArgumentException, CancelException {
@Test public void testObjects() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "objects.js");
verifyGraphAssertions(CG, assertionsForObjects);
}
@ -67,7 +68,7 @@ public class TestSimpleCallGraphShape extends TestJSCallGraphShape {
*/
};
public void testInherit() throws IOException, IllegalArgumentException, CancelException {
@Test public void testInherit() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "inherit.js");
verifyGraphAssertions(CG, assertionsForInherit);
}
@ -75,7 +76,7 @@ public class TestSimpleCallGraphShape extends TestJSCallGraphShape {
private static final Object[][] assertionsForNewfn = new Object[][] { new Object[] { ROOT, new String[] { "tests/newfn.js" } },
new Object[] { "tests/newfn.js", new String[] { "ctor 1/_fromctor", "ctor 2/_fromctor", "ctor 3/_fromctor" } } };
public void testNewfn() throws IOException, IllegalArgumentException, CancelException {
@Test public void testNewfn() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "newfn.js");
verifyGraphAssertions(CG, assertionsForNewfn);
}
@ -87,7 +88,7 @@ public class TestSimpleCallGraphShape extends TestJSCallGraphShape {
new String[] { "tests/control-flow.js/testSwitch", "tests/control-flow.js/testDoWhile",
"tests/control-flow.js/testWhile", "tests/control-flow.js/testFor", "tests/control-flow.js/testReturn" } } };
public void testControlflow() throws IOException, IllegalArgumentException, CancelException {
@Test public void testControlflow() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "control-flow.js");
verifyGraphAssertions(CG, assertionsForControlflow);
}
@ -100,7 +101,7 @@ public class TestSimpleCallGraphShape extends TestJSCallGraphShape {
"tests/more-control-flow.js/testDoWhile", "tests/more-control-flow.js/testWhile",
"tests/more-control-flow.js/testFor", "tests/more-control-flow.js/testReturn" } } };
public void testMoreControlflow() throws IOException, IllegalArgumentException, CancelException {
@Test public void testMoreControlflow() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "more-control-flow.js");
verifyGraphAssertions(CG, assertionsForMoreControlflow);
}
@ -109,7 +110,7 @@ public class TestSimpleCallGraphShape extends TestJSCallGraphShape {
new Object[] { "tests/forin.js", new String[] { "tests/forin.js/testForIn" } },
new Object[] { "tests/forin.js/testForIn", new String[] { "tests/forin.js/testForIn1", "tests/forin.js/testForIn2" } } };
public void testForin() throws IOException, IllegalArgumentException, CancelException {
@Test public void testForin() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "forin.js");
verifyGraphAssertions(CG, assertionsForForin);
}
@ -126,7 +127,7 @@ public class TestSimpleCallGraphShape extends TestJSCallGraphShape {
new Object[] { "tests/simple-lexical.js/outer/inner2",
new String[] { "tests/simple-lexical.js/outer/inner", "tests/simple-lexical.js/outer/inner3" } } };
public void testSimpleLexical() throws IOException, IllegalArgumentException, CancelException {
@Test public void testSimpleLexical() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "simple-lexical.js");
verifyGraphAssertions(CG, assertionsForSimpleLexical);
}
@ -142,7 +143,7 @@ public class TestSimpleCallGraphShape extends TestJSCallGraphShape {
new Object[] { "tests/try.js/tryCatchFinally",
new String[] { "tests/try.js/targetOne", "tests/try.js/targetTwo", "tests/try.js/three", "tests/try.js/two" } } };
public void testTry() throws IOException, IllegalArgumentException, CancelException {
@Test public void testTry() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "try.js", true);
verifyGraphAssertions(CG, assertionsForTry);
}
@ -151,7 +152,7 @@ public class TestSimpleCallGraphShape extends TestJSCallGraphShape {
new Object[] { ROOT, new String[] { "tests/string-op.js" } },
new Object[] { "tests/string-op.js", new String[] { "tests/string-op.js/getOp", "tests/string-op.js/plusNum" } } };
public void testStringOp() throws IOException, IllegalArgumentException, CancelException {
@Test public void testStringOp() throws IOException, IllegalArgumentException, CancelException {
PropagationCallGraphBuilder B = Util.makeScriptCGBuilder("tests", "string-op.js");
B.getOptions().setTraceStringConstants(true);
CallGraph CG = B.makeCallGraph(B.getOptions());
@ -164,7 +165,7 @@ public class TestSimpleCallGraphShape extends TestJSCallGraphShape {
"tests/upward.js",
new String[] { "tests/upward.js/Obj/set", "tests/upward.js/Obj/get", "tests/upward.js/tester1", "tests/upward.js/tester2" } } };
public void testUpward() throws IOException, IllegalArgumentException, CancelException {
@Test public void testUpward() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "upward.js");
verifyGraphAssertions(CG, assertionsForUpward);
}
@ -173,7 +174,7 @@ public class TestSimpleCallGraphShape extends TestJSCallGraphShape {
new Object[] { ROOT, new String[] { "tests/string-prims.js" } },
new Object[] { "tests/string-prims.js", new String[] { "prologue.js/stringSplit", "prologue.js/toUpperCase" } } };
public void testStringPrims() throws IOException, IllegalArgumentException, CancelException {
@Test public void testStringPrims() throws IOException, IllegalArgumentException, CancelException {
PropagationCallGraphBuilder B = Util.makeScriptCGBuilder("tests", "string-prims.js");
B.getOptions().setTraceStringConstants(true);
CallGraph CG = B.makeCallGraph(B.getOptions());
@ -189,7 +190,7 @@ public class TestSimpleCallGraphShape extends TestJSCallGraphShape {
}
};
public void testNested() throws IOException, IllegalArgumentException, CancelException {
@Test public void testNested() throws IOException, IllegalArgumentException, CancelException {
PropagationCallGraphBuilder B = Util.makeScriptCGBuilder("tests", "nested.js");
CallGraph CG = B.makeCallGraph(B.getOptions());
verifyGraphAssertions(CG, assertionsForNested);
@ -199,7 +200,7 @@ public class TestSimpleCallGraphShape extends TestJSCallGraphShape {
new Object[] { ROOT, new String[] { "tests/instanceof.js" } }
};
public void testInstanceof() throws IOException, IllegalArgumentException, CancelException {
@Test public void testInstanceof() throws IOException, IllegalArgumentException, CancelException {
PropagationCallGraphBuilder B = Util.makeScriptCGBuilder("tests", "instanceof.js");
CallGraph CG = B.makeCallGraph(B.getOptions());
verifyGraphAssertions(CG, assertionsForInstanceof);
@ -210,19 +211,19 @@ public class TestSimpleCallGraphShape extends TestJSCallGraphShape {
new Object[] { ROOT, new String[] { "tests/with.js" } }
};
public void testWith() throws IOException, IllegalArgumentException, CancelException {
@Test public void testWith() throws IOException, IllegalArgumentException, CancelException {
PropagationCallGraphBuilder B = Util.makeScriptCGBuilder("tests", "with.js");
CallGraph CG = B.makeCallGraph(B.getOptions());
verifyGraphAssertions(CG, assertionsForWith);
}
*/
public void testCrash1() throws IOException, IllegalArgumentException, CancelException {
@Test public void testCrash1() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "crash1.js");
verifyGraphAssertions(CG, null);
}
public void testCrash2() throws IOException, IllegalArgumentException, CancelException {
@Test public void testCrash2() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "crash2.js");
verifyGraphAssertions(CG, null);
}
@ -237,7 +238,7 @@ public class TestSimpleCallGraphShape extends TestJSCallGraphShape {
}
};
public void testMultivar() throws IOException, IllegalArgumentException, CancelException {
@Test public void testMultivar() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "multivar.js");
verifyGraphAssertions(CG, assertionsForMultivar);
}

View File

@ -13,11 +13,12 @@ package com.ibm.wala.cast.js.test;
import java.io.IOException;
import java.net.URL;
import com.ibm.wala.cast.js.translator.JavaScriptTranslatorFactory;
import org.junit.Test;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.util.CancelException;
public class TestSimplePageCallGraphShape extends TestJSCallGraphShape {
public abstract class TestSimplePageCallGraphShape extends TestJSCallGraphShape {
public static void main(String[] args) {
justThisTest(TestSimplePageCallGraphShape.class);
@ -34,7 +35,7 @@ public class TestSimplePageCallGraphShape extends TestJSCallGraphShape {
}
};
public void testPage1() throws IOException, IllegalArgumentException, CancelException {
@Test public void testPage1() throws IOException, IllegalArgumentException, CancelException {
URL url = getClass().getClassLoader().getResource("pages/page1.html");
CallGraph CG = Util.makeHTMLCG(url);
verifyGraphAssertions(CG, assertionsForPage1);

View File

@ -14,20 +14,22 @@ import java.net.URL;
import junit.framework.Assert;
import org.junit.Test;
import com.ibm.wala.cast.js.util.WebUtil;
import com.ibm.wala.classLoader.Module;
import com.ibm.wala.core.tests.util.WalaTestCase;
public class TestWebUtil extends WalaTestCase {
public void testAjaxslt() {
@Test public void testAjaxslt() {
URL url = getClass().getClassLoader().getResource("ajaxslt/test/xslt.html");
Assert.assertTrue(url != null);
Module mod = WebUtil.extractScriptFromHTML( url );
Assert.assertTrue(mod != null);
}
public void testAjaxpath() {
@Test public void testAjaxpath() {
URL url = getClass().getClassLoader().getResource("ajaxslt/test/xpath.html");
Assert.assertTrue(url != null);
Module mod = WebUtil.extractScriptFromHTML( url );