mirror of
https://github.com/UOX3DevTeam/UOX3
synced 2026-08-13 12:27:04 -04:00
40 lines
1.2 KiB
C++
40 lines
1.2 KiB
C++
/* -*- 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)
|