| Index: test/cctest/test-api.cc
|
| diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
|
| index 6a5e6f89cad6e6641b3ed5126a484c1710e8393e..87860f430fcf907281c1218018615b7f5778d96d 100644
|
| --- a/test/cctest/test-api.cc
|
| +++ b/test/cctest/test-api.cc
|
| @@ -16450,6 +16450,13 @@ TEST(PrimaryStubCache) {
|
| }
|
|
|
|
|
| +static int fatal_error_callback_counter = 0;
|
| +static void CountingErrorCallback(const char* location, const char* message) {
|
| + printf("CountingErrorCallback(\"%s\", \"%s\")\n", location, message);
|
| + fatal_error_callback_counter++;
|
| +}
|
| +
|
| +
|
| TEST(StaticGetters) {
|
| v8::HandleScope scope;
|
| LocalContext context;
|
| @@ -16466,24 +16473,12 @@ TEST(StaticGetters) {
|
| i::Handle<i::Object> false_value = FACTORY->false_value();
|
| CHECK(*v8::Utils::OpenHandle(*v8::False()) == *false_value);
|
| CHECK(*v8::Utils::OpenHandle(*v8::False(isolate)) == *false_value);
|
| -}
|
| -
|
|
|
| -static int fatal_error_callback_counter = 0;
|
| -static void CountingErrorCallback(const char* location, const char* message) {
|
| - printf("CountingErrorCallback(\"%s\", \"%s\")\n", location, message);
|
| - fatal_error_callback_counter++;
|
| -}
|
| -
|
| -
|
| -TEST(StaticGettersAfterDeath) {
|
| - v8::HandleScope scope;
|
| - LocalContext context;
|
| - v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
| + // Test after-death behavior.
|
| CHECK(i::Internals::IsInitialized(isolate));
|
| CHECK_EQ(0, fatal_error_callback_counter);
|
| v8::V8::SetFatalErrorHandler(CountingErrorCallback);
|
| - v8::Utils::ReportApiFailure("StaticGettersAfterDeath()", "Kill V8");
|
| + v8::Utils::ReportApiFailure("StaticGetters()", "Kill V8");
|
| i::Isolate::Current()->TearDown();
|
| CHECK(!i::Internals::IsInitialized(isolate));
|
| CHECK_EQ(1, fatal_error_callback_counter);
|
| @@ -16522,3 +16517,26 @@ TEST(IsolateEmbedderData) {
|
| CHECK_EQ(data2, isolate->GetData());
|
| CHECK_EQ(data2, ISOLATE->GetData());
|
| }
|
| +
|
| +
|
| +TEST(StringEmpty) {
|
| + v8::HandleScope scope;
|
| + LocalContext context;
|
| + v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
| + i::Handle<i::Object> empty_string = FACTORY->empty_symbol();
|
| + CHECK(*v8::Utils::OpenHandle(*v8::String::Empty()) == *empty_string);
|
| + CHECK(*v8::Utils::OpenHandle(*v8::String::Empty(isolate)) == *empty_string);
|
| +
|
| + // Test after-death behavior.
|
| + CHECK(i::Internals::IsInitialized(isolate));
|
| + CHECK_EQ(0, fatal_error_callback_counter);
|
| + v8::V8::SetFatalErrorHandler(CountingErrorCallback);
|
| + v8::Utils::ReportApiFailure("StringEmpty()", "Kill V8");
|
| + i::Isolate::Current()->TearDown();
|
| + CHECK(!i::Internals::IsInitialized(isolate));
|
| + CHECK_EQ(1, fatal_error_callback_counter);
|
| + CHECK(v8::String::Empty().IsEmpty());
|
| + CHECK_EQ(2, fatal_error_callback_counter);
|
| + CHECK(v8::String::Empty(isolate).IsEmpty());
|
| + CHECK_EQ(3, fatal_error_callback_counter);
|
| +}
|
|
|