mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
517 B
27 lines
517 B
9 years ago
|
'use strict';
|
||
|
require('../common');
|
||
|
const assert = require('assert');
|
||
|
const vm = require('vm');
|
||
|
|
||
|
function a() {
|
||
|
try {
|
||
|
return a();
|
||
|
} catch (e) {
|
||
|
// Throw an exception as near to the recursion-based RangeError as possible.
|
||
|
return vm.runInThisContext('() => 42')();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
assert.strictEqual(a(), 42);
|
||
|
|
||
|
function b() {
|
||
|
try {
|
||
|
return b();
|
||
|
} catch (e) {
|
||
|
// This writes a lot of noise to stderr, but it still works.
|
||
|
return vm.runInNewContext('() => 42')();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
assert.strictEqual(b(), 42);
|