Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Unified Diff: test/cctest/test-api.cc

Issue 1829833002: [V8] Add v8::Value::TypeOf to API (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 76e1150314efe5978f92dc2aa4989a01ae17e566..db6180fd2bc203d63bc48ad22de91e753fb059cc 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -6391,6 +6391,46 @@ THREADED_TEST(Equality) {
CHECK(!v8::False(isolate)->SameValue(v8::Undefined(isolate)));
}
+THREADED_TEST(TypeOf) {
+ LocalContext context;
+ v8::Isolate* isolate = context->GetIsolate();
+ v8::HandleScope scope(context->GetIsolate());
+
+ Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(isolate);
+ Local<v8::Function> fun = t1->GetFunction(context.local()).ToLocalChecked();
+
+ CHECK(v8::Undefined(isolate)
+ ->TypeOf(isolate)
+ ->Equals(context.local(), v8_str("undefined"))
+ .FromJust());
+ CHECK(v8::Null(isolate)
+ ->TypeOf(isolate)
+ ->Equals(context.local(), v8_str("object"))
+ .FromJust());
+ CHECK(v8_str("str")
+ ->TypeOf(isolate)
+ ->Equals(context.local(), v8_str("string"))
+ .FromJust());
+ CHECK(v8_num(0.0)
+ ->TypeOf(isolate)
+ ->Equals(context.local(), v8_str("number"))
+ .FromJust());
+ CHECK(v8_num(1)
+ ->TypeOf(isolate)
+ ->Equals(context.local(), v8_str("number"))
+ .FromJust());
+ CHECK(v8::Object::New(isolate)
+ ->TypeOf(isolate)
+ ->Equals(context.local(), v8_str("object"))
+ .FromJust());
+ CHECK(v8::Boolean::New(isolate, true)
+ ->TypeOf(isolate)
+ ->Equals(context.local(), v8_str("boolean"))
+ .FromJust());
+ CHECK(fun->TypeOf(isolate)
+ ->Equals(context.local(), v8_str("function"))
+ .FromJust());
+}
THREADED_TEST(MultiRun) {
LocalContext context;
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698