|
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 |
|
13 static uint32_t column = 0; |
|
14 |
|
15 BEGIN_TEST(testErrorCopying_columnCopied) |
|
16 { |
|
17 //0 1 2 |
|
18 //0123456789012345678901234567 |
|
19 EXEC("function check() { Object; foo; }"); |
|
20 |
|
21 JS::RootedValue rval(cx); |
|
22 JS_SetErrorReporter(cx, my_ErrorReporter); |
|
23 CHECK(!JS_CallFunctionName(cx, global, "check", JS::HandleValueArray::empty(), |
|
24 &rval)); |
|
25 CHECK(column == 27); |
|
26 return true; |
|
27 } |
|
28 |
|
29 static void |
|
30 my_ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report) |
|
31 { |
|
32 column = report->column; |
|
33 } |
|
34 |
|
35 END_TEST(testErrorCopying_columnCopied) |