Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 | 6 |
| 7 #include "vm/assert.h" | 7 #include "vm/assert.h" |
| 8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
| 9 #include "vm/dart_api_state.h" | 9 #include "vm/dart_api_state.h" |
| 10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
| (...skipping 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1645 assert(!Dart_IsValidResult(result)); | 1645 assert(!Dart_IsValidResult(result)); |
| 1646 EXPECT_STREQ("Duplicate definition : 'fooC' is defined in" | 1646 EXPECT_STREQ("Duplicate definition : 'fooC' is defined in" |
| 1647 " 'libraryF.dart' and 'libraryC.dart'\n", | 1647 " 'libraryF.dart' and 'libraryC.dart'\n", |
| 1648 Dart_GetErrorCString(result)); | 1648 Dart_GetErrorCString(result)); |
| 1649 | 1649 |
| 1650 Dart_ExitScope(); // Exit the Dart API scope. | 1650 Dart_ExitScope(); // Exit the Dart API scope. |
| 1651 } | 1651 } |
| 1652 Dart_ShutdownIsolate(); | 1652 Dart_ShutdownIsolate(); |
| 1653 } | 1653 } |
| 1654 | 1654 |
| 1655 | |
| 1656 UNIT_TEST_CASE(ImportLibrary5) { | |
| 1657 const char* kScriptChars = | |
| 1658 "#import('lib.dart');" | |
| 1659 "interface Y {" | |
| 1660 " void set handler(void callback(List<int> x));" | |
| 1661 "}" | |
| 1662 "void main() {}"; | |
| 1663 const char* kLibraryChars = | |
| 1664 "#library('lib.dart');" | |
| 1665 "interface X {" | |
| 1666 " void set handler(void callback(List<int> x));" | |
| 1667 "}"; | |
| 1668 Dart_Result result; | |
| 1669 | |
| 1670 Dart_CreateIsolate(NULL, NULL); | |
| 1671 { | |
| 1672 Dart_EnterScope(); // Start a Dart API scope for invoking API functions. | |
| 1673 | |
| 1674 // Create a test library and Load up a test script in it. | |
| 1675 Dart_Handle url = Dart_NewString(TestCase::url()); | |
| 1676 Dart_Handle source = Dart_NewString(kScriptChars); | |
| 1677 result = Dart_LoadScript(url, source, library_handler); | |
| 1678 | |
| 1679 url = Dart_NewString("lib.dart"); | |
| 1680 source = Dart_NewString(kLibraryChars); | |
| 1681 Dart_LoadLibrary(url, source); | |
| 1682 | |
| 1683 result = Dart_InvokeStatic(Dart_GetResult(result), | |
| 1684 Dart_NewString(""), | |
| 1685 Dart_NewString("main"), | |
| 1686 0, | |
| 1687 NULL); | |
| 1688 assert(Dart_IsValidResult(result)); | |
| 1689 | |
| 1690 Dart_ExitScope(); // Exit the Dart API scope. | |
| 1691 } | |
| 1692 Dart_ShutdownIsolate(); | |
| 1693 } | |
|
siva
2011/10/21 17:20:47
I would also add a test case where we except an er
| |
| 1655 #endif // TARGET_ARCH_IA32. | 1694 #endif // TARGET_ARCH_IA32. |
| 1656 | 1695 |
| 1657 } // namespace dart | 1696 } // namespace dart |
| OLD | NEW |