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 "include/dart_debugger_api.h" | 5 #include "include/dart_debugger_api.h" |
6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
9 #include "vm/thread.h" | 9 #include "vm/thread.h" |
10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
(...skipping 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1880 "void foo() { return 43; } \n" | 1880 "void foo() { return 43; } \n" |
1881 " \n" | 1881 " \n" |
1882 "main() { \n" | 1882 "main() { \n" |
1883 " return foo; \n" | 1883 " return foo; \n" |
1884 "} \n"; | 1884 "} \n"; |
1885 | 1885 |
1886 LoadScript(kScriptChars); | 1886 LoadScript(kScriptChars); |
1887 Dart_Handle clo = Invoke("main"); | 1887 Dart_Handle clo = Invoke("main"); |
1888 EXPECT_VALID(clo); | 1888 EXPECT_VALID(clo); |
1889 EXPECT(Dart_IsClosure(clo)); | 1889 EXPECT(Dart_IsClosure(clo)); |
1890 Dart_Handle name; | 1890 Dart_Handle name, sig; |
1891 Dart_CodeLocation loc; | 1891 Dart_CodeLocation loc; |
1892 loc.script_url = Dart_Null(); | 1892 loc.script_url = Dart_Null(); |
1893 loc.library_id = -1; | 1893 loc.library_id = -1; |
1894 loc.token_pos = -1; | 1894 loc.token_pos = -1; |
1895 Dart_Handle res = Dart_GetClosureInfo(clo, &name, &loc); | 1895 Dart_Handle res = Dart_GetClosureInfo(clo, &name, &sig, &loc); |
1896 EXPECT_VALID(res); | 1896 EXPECT_VALID(res); |
1897 EXPECT_TRUE(res); | 1897 EXPECT_TRUE(res); |
1898 EXPECT_VALID(name); | 1898 EXPECT_VALID(name); |
1899 EXPECT(Dart_IsString(name)); | 1899 EXPECT(Dart_IsString(name)); |
1900 EXPECT_STREQ("foo", ToCString(name)); | 1900 EXPECT_STREQ("foo", ToCString(name)); |
| 1901 EXPECT(Dart_IsString(sig)); |
| 1902 EXPECT_STREQ("() => void", ToCString(sig)); |
1901 EXPECT(Dart_IsString(loc.script_url)); | 1903 EXPECT(Dart_IsString(loc.script_url)); |
1902 EXPECT_STREQ("dart:test-lib", ToCString(loc.script_url)); | 1904 EXPECT_STREQ("dart:test-lib", ToCString(loc.script_url)); |
1903 EXPECT_EQ(0, loc.token_pos); | 1905 EXPECT_EQ(0, loc.token_pos); |
1904 EXPECT(loc.library_id > 0); | 1906 EXPECT(loc.library_id > 0); |
1905 } | 1907 } |
1906 | 1908 |
1907 | 1909 |
1908 TEST_CASE(Debug_GetSupertype) { | 1910 TEST_CASE(Debug_GetSupertype) { |
1909 const char* kScriptChars = | 1911 const char* kScriptChars = |
1910 "class Test {\n" | 1912 "class Test {\n" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2044 | 2046 |
2045 Dart_Handle list_type = Dart_InstanceGetType(list_access_test_obj); | 2047 Dart_Handle list_type = Dart_InstanceGetType(list_access_test_obj); |
2046 Dart_Handle super_type = Dart_GetSupertype(list_type); | 2048 Dart_Handle super_type = Dart_GetSupertype(list_type); |
2047 EXPECT(!Dart_IsError(super_type)); | 2049 EXPECT(!Dart_IsError(super_type)); |
2048 super_type = Dart_GetSupertype(super_type); | 2050 super_type = Dart_GetSupertype(super_type); |
2049 EXPECT(!Dart_IsError(super_type)); | 2051 EXPECT(!Dart_IsError(super_type)); |
2050 EXPECT(super_type == Dart_Null()); | 2052 EXPECT(super_type == Dart_Null()); |
2051 } | 2053 } |
2052 | 2054 |
2053 } // namespace dart | 2055 } // namespace dart |
OLD | NEW |