Add Javascript test for missing new in constructor call

Testcase for issue #969 and issue #626
This commit is contained in:
William S Fulton 2021-02-28 21:48:12 +00:00
commit 1de4a3a8f6

View file

@ -4,3 +4,14 @@ f = new class_scope_weird.Foo();
g = new class_scope_weird.Foo(3);
if (f.bar(3) != 3)
throw RuntimeError;
// Test missing new keyword during constructor call
var caughtException = false;
try {
g = class_scope_weird.Foo(4);
} catch (err) {
caughtException = true;
}
if (!caughtException) {
throw new Error("Instantiation exception not thrown");
}