~ubuntu-branches/ubuntu/saucy/mozjs17/saucy

« back to all changes in this revision

Viewing changes to js/src/jsapi-tests/testErrorCopying.cpp

  • Committer: Package Import Robot
  • Author(s): Rico Tzschichholz
  • Date: 2013-05-25 12:24:23 UTC
  • Revision ID: package-import@ubuntu.com-20130525122423-zmxucrhtensw90xy
Tags: upstream-17.0.0
ImportĀ upstreamĀ versionĀ 17.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 
2
 * vim: set ts=8 sw=4 et 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
 
 
12
#include "tests.h"
 
13
#include "jscntxt.h"
 
14
 
 
15
static uint32_t column = 0;
 
16
 
 
17
static void
 
18
my_ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report)
 
19
{
 
20
    column = report->column;
 
21
}
 
22
 
 
23
BEGIN_TEST(testErrorCopying_columnCopied)
 
24
{
 
25
        //0         1         2
 
26
        //0123456789012345678901234567
 
27
    EXEC("function check() { Object; foo; }");
 
28
 
 
29
    JS::RootedValue rval(cx);
 
30
    JS_SetErrorReporter(cx, my_ErrorReporter);
 
31
    CHECK(!JS_CallFunctionName(cx, global, "check", 0, NULL, rval.address()));
 
32
    CHECK(column == 27);
 
33
    return true;
 
34
}
 
35
END_TEST(testErrorCopying_columnCopied)