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 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1868 EXPECT_VALID(len); | 1868 EXPECT_VALID(len); |
1869 EXPECT(Dart_IsNumber(len)); | 1869 EXPECT(Dart_IsNumber(len)); |
1870 EXPECT_EQ(6, ToInt64(len)); | 1870 EXPECT_EQ(6, ToInt64(len)); |
1871 | 1871 |
1872 Dart_Handle error = | 1872 Dart_Handle error = |
1873 Dart_EvaluateExpr(script_lib, NewString("new NonexistingType()")); | 1873 Dart_EvaluateExpr(script_lib, NewString("new NonexistingType()")); |
1874 EXPECT(Dart_IsError(error)); | 1874 EXPECT(Dart_IsError(error)); |
1875 } | 1875 } |
1876 | 1876 |
1877 | 1877 |
| 1878 TEST_CASE(Debug_GetClosureInfo) { |
| 1879 const char* kScriptChars = |
| 1880 "void foo() { return 43; } \n" |
| 1881 " \n" |
| 1882 "main() { \n" |
| 1883 " return foo; \n" |
| 1884 "} \n"; |
| 1885 |
| 1886 LoadScript(kScriptChars); |
| 1887 Dart_Handle clo = Invoke("main"); |
| 1888 EXPECT_VALID(clo); |
| 1889 EXPECT(Dart_IsClosure(clo)); |
| 1890 Dart_Handle name; |
| 1891 Dart_CodeLocation loc; |
| 1892 loc.script_url = Dart_Null(); |
| 1893 loc.library_id = -1; |
| 1894 loc.token_pos = -1; |
| 1895 Dart_Handle res = Dart_GetClosureInfo(clo, &name, &loc); |
| 1896 EXPECT_VALID(res); |
| 1897 EXPECT_TRUE(res); |
| 1898 EXPECT_VALID(name); |
| 1899 EXPECT(Dart_IsString(name)); |
| 1900 EXPECT_STREQ("foo", ToCString(name)); |
| 1901 EXPECT(Dart_IsString(loc.script_url)); |
| 1902 EXPECT_STREQ("dart:test-lib", ToCString(loc.script_url)); |
| 1903 EXPECT_EQ(0, loc.token_pos); |
| 1904 EXPECT(loc.library_id > 0); |
| 1905 } |
| 1906 |
| 1907 |
1878 TEST_CASE(Debug_GetSupertype) { | 1908 TEST_CASE(Debug_GetSupertype) { |
1879 const char* kScriptChars = | 1909 const char* kScriptChars = |
1880 "class Test {\n" | 1910 "class Test {\n" |
1881 "}\n" | 1911 "}\n" |
1882 "class Test1 extends Test {\n" | 1912 "class Test1 extends Test {\n" |
1883 "}\n" | 1913 "}\n" |
1884 "class Test2<T> {\n" | 1914 "class Test2<T> {\n" |
1885 "}\n" | 1915 "}\n" |
1886 "class Test3 extends Test2<int> {\n" | 1916 "class Test3 extends Test2<int> {\n" |
1887 "}\n" | 1917 "}\n" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2014 | 2044 |
2015 Dart_Handle list_type = Dart_InstanceGetType(list_access_test_obj); | 2045 Dart_Handle list_type = Dart_InstanceGetType(list_access_test_obj); |
2016 Dart_Handle super_type = Dart_GetSupertype(list_type); | 2046 Dart_Handle super_type = Dart_GetSupertype(list_type); |
2017 EXPECT(!Dart_IsError(super_type)); | 2047 EXPECT(!Dart_IsError(super_type)); |
2018 super_type = Dart_GetSupertype(super_type); | 2048 super_type = Dart_GetSupertype(super_type); |
2019 EXPECT(!Dart_IsError(super_type)); | 2049 EXPECT(!Dart_IsError(super_type)); |
2020 EXPECT(super_type == Dart_Null()); | 2050 EXPECT(super_type == Dart_Null()); |
2021 } | 2051 } |
2022 | 2052 |
2023 } // namespace dart | 2053 } // namespace dart |
OLD | NEW |