DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (5216dd412535)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 * vim: set ts=8 sw=4 et tw=99:
 */

#include "tests.h"
#include "jsstr.h"

BEGIN_TEST(testIntString_bug515273)
{
    jsvalRoot v(cx);

    EVAL("'1';", v.addr());
    JSString *str = JSVAL_TO_STRING(v.value());
    CHECK(JSString::isStatic(str));
    CHECK(JS_FlatStringEqualsAscii(JS_ASSERT_STRING_IS_FLAT(str), "1"));

    EVAL("'42';", v.addr());
    str = JSVAL_TO_STRING(v.value());
    CHECK(JSString::isStatic(str));
    CHECK(JS_FlatStringEqualsAscii(JS_ASSERT_STRING_IS_FLAT(str), "42"));

    EVAL("'111';", v.addr());
    str = JSVAL_TO_STRING(v.value());
    CHECK(JSString::isStatic(str));
    CHECK(JS_FlatStringEqualsAscii(JS_ASSERT_STRING_IS_FLAT(str), "111"));

    /* Test other types of static strings. */
    EVAL("'a';", v.addr());
    str = JSVAL_TO_STRING(v.value());
    CHECK(JSString::isStatic(str));
    CHECK(JS_FlatStringEqualsAscii(JS_ASSERT_STRING_IS_FLAT(str), "a"));

    EVAL("'bc';", v.addr());
    str = JSVAL_TO_STRING(v.value());
    CHECK(JSString::isStatic(str));
    CHECK(JS_FlatStringEqualsAscii(JS_ASSERT_STRING_IS_FLAT(str), "bc"));

    return true;
}
END_TEST(testIntString_bug515273)