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

Side by Side Diff: runtime/vm/dart_api_impl_test.cc

Issue 11411271: Remove support for interfaces. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "platform/assert.h" 6 #include "platform/assert.h"
7 #include "platform/json.h" 7 #include "platform/json.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart_api_impl.h" 10 #include "vm/dart_api_impl.h"
(...skipping 2360 matching lines...) Expand 10 before | Expand all | Expand 10 after
2371 EXPECT_VALID( 2371 EXPECT_VALID(
2372 Dart_FunctionParameterCounts(sig_func, &fixed_params, &opt_params)); 2372 Dart_FunctionParameterCounts(sig_func, &fixed_params, &opt_params));
2373 EXPECT_EQ(1, fixed_params); 2373 EXPECT_EQ(1, fixed_params);
2374 EXPECT_EQ(0, opt_params); 2374 EXPECT_EQ(0, opt_params);
2375 2375
2376 // Pass the wrong class kind to Dart_ClassGetFunctionTypeSignature 2376 // Pass the wrong class kind to Dart_ClassGetFunctionTypeSignature
2377 EXPECT_ERROR(Dart_ClassGetFunctionTypeSignature(normal_cls), 2377 EXPECT_ERROR(Dart_ClassGetFunctionTypeSignature(normal_cls),
2378 "class 'SomeClass' is not a function-type class."); 2378 "class 'SomeClass' is not a function-type class.");
2379 } 2379 }
2380 2380
2381 #define CHECK_INTERFACE(handle, name) \ 2381 #define CHECK_INTERFACE(handle, name) \
srdjan 2012/11/29 23:52:12 Shall this be called CHECK_ABSTRACT_CLASS and chec
regis 2012/11/30 00:24:30 Done.
2382 { \ 2382 { \
2383 Dart_Handle tmp = (handle); \ 2383 Dart_Handle tmp = (handle); \
2384 EXPECT_VALID(tmp); \ 2384 EXPECT_VALID(tmp); \
2385 EXPECT(Dart_IsInterface(tmp)); \ 2385 EXPECT(Dart_IsClass(tmp)); \
2386 Dart_Handle intf_name = Dart_ClassName(tmp); \ 2386 Dart_Handle intf_name = Dart_ClassName(tmp); \
2387 EXPECT_VALID(intf_name); \ 2387 EXPECT_VALID(intf_name); \
2388 const char* intf_name_cstr = ""; \ 2388 const char* intf_name_cstr = ""; \
2389 EXPECT_VALID(Dart_StringToCString(intf_name, &intf_name_cstr)); \ 2389 EXPECT_VALID(Dart_StringToCString(intf_name, &intf_name_cstr)); \
2390 EXPECT_STREQ((name), intf_name_cstr); \ 2390 EXPECT_STREQ((name), intf_name_cstr); \
2391 } 2391 }
2392 2392
2393 2393
2394 TEST_CASE(ClassGetInterfaces) { 2394 TEST_CASE(ClassGetInterfaces) {
2395 const char* kScriptChars = 2395 const char* kScriptChars =
2396 "class MyClass0 {\n" 2396 "class MyClass0 {\n"
2397 "}\n" 2397 "}\n"
2398 "\n" 2398 "\n"
2399 "class MyClass1 implements MyInterface1 {\n" 2399 "class MyClass1 implements MyInterface1 {\n"
2400 "}\n" 2400 "}\n"
2401 "\n" 2401 "\n"
2402 "class MyClass2 implements MyInterface0, MyInterface1 {\n" 2402 "class MyClass2 implements MyInterface0, MyInterface1 {\n"
2403 "}\n" 2403 "}\n"
2404 "\n" 2404 "\n"
2405 "interface MyInterface0 {\n" 2405 "abstract class MyInterface0 {\n"
2406 "}\n" 2406 "}\n"
2407 "\n" 2407 "\n"
2408 "interface MyInterface1 extends MyInterface0 {\n" 2408 "abstract class MyInterface1 implements MyInterface0 {\n"
2409 "}\n"; 2409 "}\n";
2410 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 2410 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
2411 2411
2412 Dart_Handle cls0 = Dart_GetClass(lib, NewString("MyClass0")); 2412 Dart_Handle cls0 = Dart_GetClass(lib, NewString("MyClass0"));
2413 Dart_Handle cls1 = Dart_GetClass(lib, NewString("MyClass1")); 2413 Dart_Handle cls1 = Dart_GetClass(lib, NewString("MyClass1"));
2414 Dart_Handle cls2 = Dart_GetClass(lib, NewString("MyClass2")); 2414 Dart_Handle cls2 = Dart_GetClass(lib, NewString("MyClass2"));
2415 Dart_Handle intf0 = Dart_GetClass(lib, NewString("MyInterface0")); 2415 Dart_Handle intf0 = Dart_GetClass(lib, NewString("MyInterface0"));
2416 Dart_Handle intf1 = Dart_GetClass(lib, NewString("MyInterface1")); 2416 Dart_Handle intf1 = Dart_GetClass(lib, NewString("MyInterface1"));
2417 2417
2418 intptr_t len = -1; 2418 intptr_t len = -1;
(...skipping 4918 matching lines...) Expand 10 before | Expand all | Expand 10 after
7337 Dart_LoadSource(TestCase::lib(), url, source); 7337 Dart_LoadSource(TestCase::lib(), url, source);
7338 7338
7339 dart_args[0] = Dart_NewInteger(1); 7339 dart_args[0] = Dart_NewInteger(1);
7340 result = Dart_Invoke(lib1, NewString("start"), 1, dart_args); 7340 result = Dart_Invoke(lib1, NewString("start"), 1, dart_args);
7341 EXPECT_VALID(result); 7341 EXPECT_VALID(result);
7342 } 7342 }
7343 7343
7344 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 7344 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
7345 7345
7346 } // namespace dart 7346 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698