add a test for Function.apply() with the arguments array

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4336 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
msridhar1 2012-01-06 21:27:21 +00:00
parent 14c4cdb251
commit 610c7e252e
3 changed files with 22 additions and 1 deletions

View File

@ -3,7 +3,7 @@ function biz() { return this; }
var q = biz;
var o = { m: function theOne() {} }
var r = q.apply(o);
o.m()
r.m()
function id(y) { return y; }
@ -14,3 +14,5 @@ s();
// test invoking with non-array argsList
p.apply(null, o);

View File

@ -0,0 +1,9 @@
// test use of arguments array
function useArgs() {
return arguments[2];
}
var o = {}
function theThree() {}
var a = useArgs;
var b = a.apply(o, [o,o,theThree]);
b();

View File

@ -328,6 +328,16 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
verifyGraphAssertions(CG, assertionsForFunctionApply);
}
private static final Object[][] assertionsForFunctionApply2 = new Object[][] {
new Object[] { ROOT, new String[] { "tests/function_apply2.js" } },
new Object[] { "suffix:function_apply2.js", new String[] { "suffix:theThree" } } };
@Test
public void testFunctionDotApply2() throws IOException, IllegalArgumentException, CancelException {
CallGraph CG = Util.makeScriptCG("tests", "function_apply2.js");
verifyGraphAssertions(CG, assertionsForFunctionApply2);
}
private static final Object[][] assertionsForComplexCall = new Object[][] {
new Object[] { ROOT, new String[] { "tests/complex_call.js" } },
new Object[] { "suffix:call.js", new String[] { "suffix:f3" } } };