| Index: test/cctest/cctest.h
|
| diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h
|
| index 01d765e2b26c7a3641b1c5a8546cb4917596f346..1ada105f5693361b88e25ea46d104637feb92235 100644
|
| --- a/test/cctest/cctest.h
|
| +++ b/test/cctest/cctest.h
|
| @@ -311,6 +311,15 @@ class LocalContext {
|
| v8::Isolate* isolate_;
|
| };
|
|
|
| +
|
| +static inline uint16_t* AsciiToTwoByteString(const char* source) {
|
| + int array_length = i::StrLength(source) + 1;
|
| + uint16_t* converted = i::NewArray<uint16_t>(array_length);
|
| + for (int i = 0; i < array_length; i++) converted[i] = source[i];
|
| + return converted;
|
| +}
|
| +
|
| +
|
| static inline v8::Local<v8::Value> v8_num(double x) {
|
| return v8::Number::New(v8::Isolate::GetCurrent(), x);
|
| }
|
| @@ -403,6 +412,52 @@ static inline v8::Local<v8::Value> CompileRunWithOrigin(
|
| }
|
|
|
|
|
| +
|
| +static inline void ExpectString(const char* code, const char* expected) {
|
| + v8::Local<v8::Value> result = CompileRun(code);
|
| + CHECK(result->IsString());
|
| + v8::String::Utf8Value utf8(result);
|
| + CHECK_EQ(expected, *utf8);
|
| +}
|
| +
|
| +
|
| +static inline void ExpectInt32(const char* code, int expected) {
|
| + v8::Local<v8::Value> result = CompileRun(code);
|
| + CHECK(result->IsInt32());
|
| + CHECK_EQ(expected, result->Int32Value());
|
| +}
|
| +
|
| +
|
| +static inline void ExpectBoolean(const char* code, bool expected) {
|
| + v8::Local<v8::Value> result = CompileRun(code);
|
| + CHECK(result->IsBoolean());
|
| + CHECK_EQ(expected, result->BooleanValue());
|
| +}
|
| +
|
| +
|
| +static inline void ExpectTrue(const char* code) {
|
| + ExpectBoolean(code, true);
|
| +}
|
| +
|
| +
|
| +static inline void ExpectFalse(const char* code) {
|
| + ExpectBoolean(code, false);
|
| +}
|
| +
|
| +
|
| +static inline void ExpectObject(const char* code,
|
| + v8::Local<v8::Value> expected) {
|
| + v8::Local<v8::Value> result = CompileRun(code);
|
| + CHECK(result->SameValue(expected));
|
| +}
|
| +
|
| +
|
| +static inline void ExpectUndefined(const char* code) {
|
| + v8::Local<v8::Value> result = CompileRun(code);
|
| + CHECK(result->IsUndefined());
|
| +}
|
| +
|
| +
|
| // Helper function that simulates a full new-space in the heap.
|
| static inline void SimulateFullSpace(v8::internal::NewSpace* space) {
|
| int new_linear_size = static_cast<int>(
|
|
|