| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
package org.mozilla.javascript.tests; |
| 6 |
|
| 7 |
import org.junit.Assert; |
| 8 |
import org.mozilla.javascript.Function; |
| 9 |
import org.mozilla.javascript.ContextFactory; |
| 10 |
import org.mozilla.javascript.ContextAction; |
| 11 |
import org.mozilla.javascript.Context; |
| 12 |
import org.junit.Test; |
| 13 |
|
| 14 |
public class Bug496585Test { |
| 15 |
public String method(String one, Function function) { |
| 16 |
return "string+function"; |
| 17 |
} |
| 18 |
|
| 19 |
public String method(String... strings) { |
| 20 |
return "string[]"; |
| 21 |
} |
| 22 |
|
| 23 |
@Test |
| 24 |
public void callOverloadedFunction() { |
| 25 |
new ContextFactory().call(new ContextAction() { |
| 26 |
public Object run(Context cx) { |
| 27 |
cx.getWrapFactory().setJavaPrimitiveWrap(false); |
| 28 |
Assert.assertEquals("string[]", cx.evaluateString( |
| 29 |
cx.initStandardObjects(), |
| 30 |
"new org.mozilla.javascript.tests.Bug496585Test().method('one', 'two', 'three')", |
| 31 |
"<test>", 1, null)); |
| 32 |
Assert.assertEquals("string+function", cx.evaluateString( |
| 33 |
cx.initStandardObjects(), |
| 34 |
"new org.mozilla.javascript.tests.Bug496585Test().method('one', function() {})", |
| 35 |
"<test>", 1, null)); |
| 36 |
return null; |
| 37 |
} |
| 38 |
}); |
| 39 |
} |
| 40 |
} |