summaryrefslogtreecommitdiff
path: root/test/simple/test-script-context.js
diff options
context:
space:
mode:
authorAntranig Basman <antranig.basman@colorado.edu>2011-06-02 13:45:30 -0600
committerBen Noordhuis <info@bnoordhuis.nl>2011-08-16 14:50:04 +0200
commitc05936ca13681059c7aeecfe3a608e4e1afa800a (patch)
tree1b0b0e2d28a9eb783ebae7744ef9f0a94618d39b /test/simple/test-script-context.js
parent72246d97a243549c337ad91ab9c113ea7716a83e (diff)
downloadnode-new-c05936ca13681059c7aeecfe3a608e4e1afa800a.tar.gz
vm: fix incorrect dispatch of vm.runInContext for argument "filename"
Adds test case and documentation for vm.runInContext and vm.createContext. Fixes #1140.
Diffstat (limited to 'test/simple/test-script-context.js')
-rw-r--r--test/simple/test-script-context.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/simple/test-script-context.js b/test/simple/test-script-context.js
index 3d054b7b7d..fe6b9b68c5 100644
--- a/test/simple/test-script-context.js
+++ b/test/simple/test-script-context.js
@@ -46,6 +46,18 @@ assert.equal('lala', context.thing);
// Issue GH-227:
Script.runInNewContext('', null, 'some.js');
+// Issue GH-1140:
+common.debug('test runInContext signature');
+var gh1140Exception;
+try {
+ Script.runInContext('throw new Error()', context, 'expected-filename.js');
+}
+catch (e) {
+ gh1140Exception = e;
+ assert.ok(/expected-filename/.test(e.stack), 'expected appearance of filename in Error stack');
+}
+assert.ok(gh1140Exception, 'expected exception from runInContext signature test');
+
// GH-558, non-context argument segfaults / raises assertion
function isTypeError(o) {
return o instanceof TypeError;