Added test case for handling of arguments array.

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4388 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
msridhar1 2012-01-06 21:43:37 +00:00
parent 5f6fc74836
commit 13202e726e
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,15 @@
function f() {
arguments[0].g();
}
f.g = function g1() {};
var o = {
f: f,
g: function g2() { }
}
var oo = {
g: function g3() { }
}
o.f(oo);

View File

@ -436,6 +436,18 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
verifyGraphAssertions(CG, assertionsForReturnThis2);
}
private static final Object[][] assertionsForArguments = new Object[][] {
new Object[] { ROOT, new String[] { "tests/arguments.js" } },
new Object[] { "suffix:arguments.js", new String[] { "suffix:f" } },
new Object[] { "suffix:f", new String[] { "suffix:g3" } } // but neither "suffix:g1" nor "suffix:g2"
};
@Test
public void testArguments() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "arguments.js");
verifyGraphAssertions(CG, assertionsForArguments);
}
private static final Object[][] assertionsForFunctionIsAFunction = new Object[][] {
new Object[] { ROOT, new String[] { "tests/Function_is_a_function.js" } },
new Object[] { "suffix:Function_is_a_function.js", new String[] { "suffix:functionCall" } } };