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:
parent
14c4cdb251
commit
610c7e252e
|
@ -3,7 +3,7 @@ function biz() { return this; }
|
||||||
var q = biz;
|
var q = biz;
|
||||||
var o = { m: function theOne() {} }
|
var o = { m: function theOne() {} }
|
||||||
var r = q.apply(o);
|
var r = q.apply(o);
|
||||||
o.m()
|
r.m()
|
||||||
|
|
||||||
function id(y) { return y; }
|
function id(y) { return y; }
|
||||||
|
|
||||||
|
@ -14,3 +14,5 @@ s();
|
||||||
|
|
||||||
// test invoking with non-array argsList
|
// test invoking with non-array argsList
|
||||||
p.apply(null, o);
|
p.apply(null, o);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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();
|
|
@ -328,6 +328,16 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape {
|
||||||
verifyGraphAssertions(CG, assertionsForFunctionApply);
|
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[][] {
|
private static final Object[][] assertionsForComplexCall = new Object[][] {
|
||||||
new Object[] { ROOT, new String[] { "tests/complex_call.js" } },
|
new Object[] { ROOT, new String[] { "tests/complex_call.js" } },
|
||||||
new Object[] { "suffix:call.js", new String[] { "suffix:f3" } } };
|
new Object[] { "suffix:call.js", new String[] { "suffix:f3" } } };
|
||||||
|
|
Loading…
Reference in New Issue