Bug 1832850 - Part 5: Move the allocateObject definition into gc/Nursery.h r=jandem
[gecko.git] / js / src / jsapi-tests / testErrorCopying.cpp
blobbe451c27ba7accdf3a5d4fca91ef1844003cb9b0
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: set ts=8 sts=2 et sw=2 tw=80:
4 * Tests that the column number of error reports is properly copied over from
5 * other reports when invoked from the C++ api.
6 */
7 /* This Source Code Form is subject to the terms of the Mozilla Public
8 * License, v. 2.0. If a copy of the MPL was not distributed with this
9 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
11 #include "js/CallAndConstruct.h"
12 #include "js/Exception.h"
13 #include "jsapi-tests/tests.h"
15 BEGIN_TEST(testErrorCopying_columnCopied) {
16 // 0 1 2
17 // 1234567890123456789012345678
18 EXEC("function check() { Object; foo; }");
20 JS::RootedValue rval(cx);
21 CHECK(!JS_CallFunctionName(cx, global, "check", JS::HandleValueArray::empty(),
22 &rval));
23 JS::ExceptionStack exnStack(cx);
24 CHECK(JS::StealPendingExceptionStack(cx, &exnStack));
26 JS::ErrorReportBuilder report(cx);
27 CHECK(report.init(cx, exnStack, JS::ErrorReportBuilder::WithSideEffects));
29 CHECK_EQUAL(report.report()->column, 28u);
30 return true;
33 END_TEST(testErrorCopying_columnCopied)