| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "bin/builtin.h" | 5 #include "bin/builtin.h" |
| 6 #include "include/dart_api.h" | 6 #include "include/dart_api.h" |
| 7 #include "include/dart_mirrors_api.h" | 7 #include "include/dart_mirrors_api.h" |
| 8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/json.h" | 10 #include "platform/json.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 const Type& null_type_obj = Api::UnwrapTypeHandle(isolate, type); | 258 const Type& null_type_obj = Api::UnwrapTypeHandle(isolate, type); |
| 259 EXPECT(null_type_obj.raw() == Type::NullType()); | 259 EXPECT(null_type_obj.raw() == Type::NullType()); |
| 260 | 260 |
| 261 Dart_Handle instance = Dart_True(); | 261 Dart_Handle instance = Dart_True(); |
| 262 type = Dart_InstanceGetType(instance); | 262 type = Dart_InstanceGetType(instance); |
| 263 EXPECT_VALID(type); | 263 EXPECT_VALID(type); |
| 264 EXPECT(Dart_IsType(type)); | 264 EXPECT(Dart_IsType(type)); |
| 265 const Type& bool_type_obj = Api::UnwrapTypeHandle(isolate, type); | 265 const Type& bool_type_obj = Api::UnwrapTypeHandle(isolate, type); |
| 266 EXPECT(bool_type_obj.raw() == Type::BoolType()); | 266 EXPECT(bool_type_obj.raw() == Type::BoolType()); |
| 267 | 267 |
| 268 Dart_Handle cls_name = Dart_ClassName(type); | 268 Dart_Handle cls_name = Dart_TypeName(type); |
| 269 EXPECT_VALID(cls_name); | 269 EXPECT_VALID(cls_name); |
| 270 const char* cls_name_cstr = ""; | 270 const char* cls_name_cstr = ""; |
| 271 EXPECT_VALID(Dart_StringToCString(cls_name, &cls_name_cstr)); | 271 EXPECT_VALID(Dart_StringToCString(cls_name, &cls_name_cstr)); |
| 272 EXPECT_STREQ("bool", cls_name_cstr); | 272 EXPECT_STREQ("bool", cls_name_cstr); |
| 273 | 273 |
| 274 Dart_Handle qual_cls_name = Dart_QualifiedClassName(type); | 274 Dart_Handle qual_cls_name = Dart_QualifiedTypeName(type); |
| 275 EXPECT_VALID(qual_cls_name); | 275 EXPECT_VALID(qual_cls_name); |
| 276 const char* qual_cls_name_cstr = ""; | 276 const char* qual_cls_name_cstr = ""; |
| 277 EXPECT_VALID(Dart_StringToCString(qual_cls_name, &qual_cls_name_cstr)); | 277 EXPECT_VALID(Dart_StringToCString(qual_cls_name, &qual_cls_name_cstr)); |
| 278 EXPECT_STREQ("Library:'dart:core' Class: bool", qual_cls_name_cstr); | 278 EXPECT_STREQ("Library:'dart:core' Class: bool", qual_cls_name_cstr); |
| 279 | 279 |
| 280 // Errors propagate. | 280 // Errors propagate. |
| 281 Dart_Handle error = Dart_NewApiError("MyError"); | 281 Dart_Handle error = Dart_NewApiError("MyError"); |
| 282 Dart_Handle error_type = Dart_InstanceGetType(error); | 282 Dart_Handle error_type = Dart_InstanceGetType(error); |
| 283 EXPECT_ERROR(error_type, "MyError"); | 283 EXPECT_ERROR(error_type, "MyError"); |
| 284 | 284 |
| (...skipping 2415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2700 EXPECT_EQ(&MyMessageNotifyCallback, isolate->message_notify_callback()); | 2700 EXPECT_EQ(&MyMessageNotifyCallback, isolate->message_notify_callback()); |
| 2701 Dart_ShutdownIsolate(); | 2701 Dart_ShutdownIsolate(); |
| 2702 } | 2702 } |
| 2703 | 2703 |
| 2704 | 2704 |
| 2705 #define CHECK_CLASS(handle, name) \ | 2705 #define CHECK_CLASS(handle, name) \ |
| 2706 { \ | 2706 { \ |
| 2707 Dart_Handle tmp = (handle); \ | 2707 Dart_Handle tmp = (handle); \ |
| 2708 EXPECT_VALID(tmp); \ | 2708 EXPECT_VALID(tmp); \ |
| 2709 EXPECT(Dart_IsClass(tmp)); \ | 2709 EXPECT(Dart_IsClass(tmp)); \ |
| 2710 Dart_Handle intf_name = Dart_ClassName(tmp); \ | 2710 Dart_Handle intf_name = Dart_TypeName(tmp); \ |
| 2711 EXPECT_VALID(intf_name); \ | 2711 EXPECT_VALID(intf_name); \ |
| 2712 const char* intf_name_cstr = ""; \ | 2712 const char* intf_name_cstr = ""; \ |
| 2713 EXPECT_VALID(Dart_StringToCString(intf_name, &intf_name_cstr)); \ | 2713 EXPECT_VALID(Dart_StringToCString(intf_name, &intf_name_cstr)); \ |
| 2714 EXPECT_STREQ((name), intf_name_cstr); \ | 2714 EXPECT_STREQ((name), intf_name_cstr); \ |
| 2715 } | 2715 } |
| 2716 | 2716 |
| 2717 | 2717 |
| 2718 TEST_CASE(TypeGetNonParamtericTypes) { | 2718 TEST_CASE(TypeGetNonParamtericTypes) { |
| 2719 const char* kScriptChars = | 2719 const char* kScriptChars = |
| 2720 "class MyClass0 {\n" | 2720 "class MyClass0 {\n" |
| (...skipping 4589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7310 NewString("main"), | 7310 NewString("main"), |
| 7311 0, | 7311 0, |
| 7312 NULL); | 7312 NULL); |
| 7313 int64_t value = 0; | 7313 int64_t value = 0; |
| 7314 result = Dart_IntegerToInt64(result, &value); | 7314 result = Dart_IntegerToInt64(result, &value); |
| 7315 EXPECT_VALID(result); | 7315 EXPECT_VALID(result); |
| 7316 EXPECT_EQ(8, value); | 7316 EXPECT_EQ(8, value); |
| 7317 } | 7317 } |
| 7318 | 7318 |
| 7319 } // namespace dart | 7319 } // namespace dart |
| OLD | NEW |