diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2021-02-28 21:48:12 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2021-02-28 22:01:32 +0000 |
commit | 1de4a3a8f6e536175bf7a14125ca2bf214bd28ba (patch) | |
tree | 42ea1d5d58dcf363c608bae65e6fce073e182e8e /Examples | |
parent | 30216c4fb8a92296283019412aa814f1c4b60d14 (diff) | |
download | swig-1de4a3a8f6e536175bf7a14125ca2bf214bd28ba.tar.gz |
Add Javascript test for missing new in constructor call
Testcase for issue #969 and issue #626
Diffstat (limited to 'Examples')
-rw-r--r-- | Examples/test-suite/javascript/class_scope_weird_runme.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Examples/test-suite/javascript/class_scope_weird_runme.js b/Examples/test-suite/javascript/class_scope_weird_runme.js index 73c118d61..ca18c1b4d 100644 --- a/Examples/test-suite/javascript/class_scope_weird_runme.js +++ b/Examples/test-suite/javascript/class_scope_weird_runme.js @@ -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"); +} |