| Index: test/mjsunit/stack-traces-custom-lazy.js
|
| diff --git a/test/intl/date-format/format-test.js b/test/mjsunit/stack-traces-custom-lazy.js
|
| similarity index 76%
|
| copy from test/intl/date-format/format-test.js
|
| copy to test/mjsunit/stack-traces-custom-lazy.js
|
| index 9817c97ed975283f2313e7b1ece8a0b110365e84..91d97f3739dc746434731352a0ec7ade0d839484 100644
|
| --- a/test/intl/date-format/format-test.js
|
| +++ b/test/mjsunit/stack-traces-custom-lazy.js
|
| @@ -25,22 +25,25 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -// Test formatting method with specified date, invalid input.
|
| -
|
| -var dtf = new Intl.DateTimeFormat('en-US', {timeZone: 'UTC'});
|
| -
|
| -var someDate = dtf.format(144313200000);
|
| -assertEquals('7/29/1974', someDate);
|
| -
|
| -var invalidValues = [NaN, Infinity, -Infinity];
|
| -invalidValues.forEach(function(value) {
|
| - var error;
|
| +function testPrepareStackTrace(closure) {
|
| + var error = undefined;
|
| try {
|
| - dtf.format(value);
|
| + closure();
|
| + assertUnreachable();
|
| } catch (e) {
|
| error = e;
|
| }
|
|
|
| - assertTrue(error !== undefined);
|
| - assertEquals('RangeError', error.name);
|
| -});
|
| + // We expect custom formatting to be lazy. Setting the custom
|
| + // function right before calling error.stack should be fine.
|
| + Error.prepareStackTrace = function(e, frames) {
|
| + return "bar";
|
| + }
|
| +
|
| + assertEquals("bar", error.stack);
|
| + Error.prepareStackTrace = undefined;
|
| +}
|
| +
|
| +testPrepareStackTrace(function() { throw new Error("foo"); });
|
| +testPrepareStackTrace(function f() { f(); });
|
| +
|
|
|