1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2  * vim: set ts=8 sts=4 et sw=4 tw=99:
3  *
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/. */
10 
11 #include "jsapi-tests/tests.h"
12 
BEGIN_TEST(testErrorCopying_columnCopied)13 BEGIN_TEST(testErrorCopying_columnCopied)
14 {
15         //0        1         2
16         //1234567890123456789012345678
17     EXEC("function check() { Object; foo; }");
18 
19     JS::RootedValue rval(cx);
20     CHECK(!JS_CallFunctionName(cx, global, "check", JS::HandleValueArray::empty(),
21                                &rval));
22     JS::RootedValue exn(cx);
23     CHECK(JS_GetPendingException(cx, &exn));
24     JS_ClearPendingException(cx);
25 
26     js::ErrorReport report(cx);
27     CHECK(report.init(cx, exn, js::ErrorReport::WithSideEffects));
28 
29     CHECK_EQUAL(report.report()->column, 28u);
30     return true;
31 }
32 
33 END_TEST(testErrorCopying_columnCopied)
34