Add Javascript test for missing new in constructor call
Testcase for issue #969 and issue #626
This commit is contained in:
parent
30216c4fb8
commit
1de4a3a8f6
1 changed files with 11 additions and 0 deletions
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue