diff options
Diffstat (limited to 'Examples/test-suite/javascript/smart_pointer_not_runme.js')
-rw-r--r-- | Examples/test-suite/javascript/smart_pointer_not_runme.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Examples/test-suite/javascript/smart_pointer_not_runme.js b/Examples/test-suite/javascript/smart_pointer_not_runme.js new file mode 100644 index 000000000..2c3a65ec1 --- /dev/null +++ b/Examples/test-suite/javascript/smart_pointer_not_runme.js @@ -0,0 +1,30 @@ +var smart_pointer_not = require("smart_pointer_not"); + +f = new smart_pointer_not.Foo(); +b = new smart_pointer_not.Bar(f); +s = new smart_pointer_not.Spam(f); +g = new smart_pointer_not.Grok(f); + +// This is the only that should work +f.getx(); + +// Accessing an inexistent property in JS +// does not throw - it returns undefined +fail = false; +try { + x = b.getx(); + fail = new Error("Error! b.x"); +} catch { } +if (fail) throw fail; + +try { + x = s.getx(); + fail = new Error("Error! b.x"); +} catch { } +if (fail) throw fail; + +try { + x = g.getx(); + fail = new Error("Error! b.x"); +} catch { } +if (fail) throw fail; |