1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "js/CallAndConstruct.h" // JS::Construct
6 #include "jsapi-tests/tests.h"
8 BEGIN_TEST(testNewTargetInvokeConstructor
) {
9 JS::RootedValue
func(cx
);
12 "(function(expected) { if (expected !== new.target) throw new "
13 "Error('whoops'); })",
16 JS::RootedValueArray
<1> args(cx
);
19 JS::RootedObject
obj(cx
);
21 CHECK(JS::Construct(cx
, func
, args
, &obj
));
25 END_TEST(testNewTargetInvokeConstructor
)