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.
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
) {
17 // 1234567890123456789012345678
18 EXEC("function check() { Object; foo; }");
20 JS::RootedValue
rval(cx
);
21 CHECK(!JS_CallFunctionName(cx
, global
, "check", JS::HandleValueArray::empty(),
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);
33 END_TEST(testErrorCopying_columnCopied
)