diff --git a/testsrc/org/mozilla/javascript/tests/es6/NativeReflectTest.java b/testsrc/org/mozilla/javascript/tests/es6/NativeReflectTest.java index 94c3cc8a34..619cd4186b 100644 --- a/testsrc/org/mozilla/javascript/tests/es6/NativeReflectTest.java +++ b/testsrc/org/mozilla/javascript/tests/es6/NativeReflectTest.java @@ -165,6 +165,44 @@ public void constructNoConstructorFunction() { // found no way to check a function for constructor } + @Test + public void constructorArgs() { + final String script = + " var res = '';\n" + + "function foo(a, b) {\n" + + " res += 'foo - ';\n" + + " for (let i = 0; i < arguments.length; i++) {\n" + + " res += arguments[i] + ' ';\n" + + " }\n" + + "}\n" + + "Reflect.construct(foo, [1, 2]);\n" + + "res;"; + + testString("foo - 1 2 ", script); + } + + @Test + public void constructorArgsWithTarget() { + final String script = + " var res = '';\n" + + "function foo(a, b) {\n" + + " res += 'foo - ';\n" + + " for (let i = 0; i < arguments.length; i++) {\n" + + " res += arguments[i] + ' ';\n" + + " }\n" + + "}\n" + + "function bar(a, b) {\n" + + " res += 'bar - ';\n" + + " for (let i = 0; i < arguments.length; i++) {\n" + + " res += arguments[i] + ' ';\n" + + " }\n" + + "}\n" + + "Reflect.construct(foo, [6, 7, 8], bar);\n" + + "res;"; + + testString("foo - 6 7 8 ", script); + } + @Test public void defineProperty() { String js =