Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index 8fd87434c1b27aaeb5c31ce8af06026aa834cc62..18f795ec8a07fac4b4c18119fc8ae26b6ff1ab77 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -1542,6 +1542,34 @@ THREADED_TEST(IsNativeError) { |
} |
+THREADED_TEST(IsGeneratorFunctionOrObject) { |
+ LocalContext env; |
+ v8::HandleScope scope(env->GetIsolate()); |
+ |
+ CompileRun("function *gen() { yield 1; }\nfunction func() {}"); |
+ v8::Handle<Value> gen = CompileRun("gen"); |
+ v8::Handle<Value> genObj = CompileRun("gen()"); |
+ v8::Handle<Value> object = CompileRun("{a:42}"); |
+ v8::Handle<Value> func = CompileRun("func"); |
+ |
+ CHECK(gen->IsGeneratorFunction()); |
+ CHECK(gen->IsFunction()); |
+ CHECK(!gen->IsGeneratorObject()); |
+ |
+ CHECK(!genObj->IsGeneratorFunction()); |
+ CHECK(!genObj->IsFunction()); |
+ CHECK(genObj->IsGeneratorObject()); |
+ |
+ CHECK(!object->IsGeneratorFunction()); |
+ CHECK(!object->IsFunction()); |
+ CHECK(!object->IsGeneratorObject()); |
+ |
+ CHECK(!func->IsGeneratorFunction()); |
+ CHECK(func->IsFunction()); |
+ CHECK(!func->IsGeneratorObject()); |
+} |
+ |
+ |
THREADED_TEST(ArgumentsObject) { |
LocalContext env; |
v8::HandleScope scope(env->GetIsolate()); |