OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 "include/dart_tools_api.h" | 6 #include "include/dart_tools_api.h" |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
10 #include "vm/lockers.h" | 10 #include "vm/lockers.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 "main() {\n" | 221 "main() {\n" |
222 " new Foo();\n" | 222 " new Foo();\n" |
223 " return 44;\n" | 223 " return 44;\n" |
224 "}\n"; | 224 "}\n"; |
225 | 225 |
226 lib = TestCase::ReloadTestScript(kReloadScript); | 226 lib = TestCase::ReloadTestScript(kReloadScript); |
227 EXPECT_ERROR(lib, "Number of instance fields changed"); | 227 EXPECT_ERROR(lib, "Number of instance fields changed"); |
228 } | 228 } |
229 | 229 |
230 | 230 |
| 231 TEST_CASE(IsolateReload_ClassFieldAdded2) { |
| 232 const char* kScript = |
| 233 "class Foo {\n" |
| 234 " var x;\n" |
| 235 " var y;\n" |
| 236 "}\n" |
| 237 "main() {\n" |
| 238 " new Foo();\n" |
| 239 " return 44;\n" |
| 240 "}\n"; |
| 241 |
| 242 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); |
| 243 EXPECT_VALID(lib); |
| 244 |
| 245 EXPECT_EQ(44, SimpleInvoke(lib, "main")); |
| 246 |
| 247 const char* kReloadScript = |
| 248 "class Foo {\n" |
| 249 " var x;\n" |
| 250 " var y;\n" |
| 251 " var z;\n" |
| 252 "}\n" |
| 253 "main() {\n" |
| 254 " new Foo();\n" |
| 255 " return 44;\n" |
| 256 "}\n"; |
| 257 |
| 258 lib = TestCase::ReloadTestScript(kReloadScript); |
| 259 EXPECT_ERROR(lib, "Number of instance fields changed"); |
| 260 } |
| 261 |
| 262 |
231 TEST_CASE(IsolateReload_ClassFieldRemoved) { | 263 TEST_CASE(IsolateReload_ClassFieldRemoved) { |
232 const char* kScript = | 264 const char* kScript = |
233 "class Foo {\n" | 265 "class Foo {\n" |
234 " var x;\n" | 266 " var x;\n" |
235 " var y;\n" | 267 " var y;\n" |
236 "}\n" | 268 "}\n" |
237 "main() {\n" | 269 "main() {\n" |
238 " new Foo();\n" | 270 " new Foo();\n" |
239 " return 44;\n" | 271 " return 44;\n" |
240 "}\n"; | 272 "}\n"; |
(...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1823 | 1855 |
1824 // ...and the non-core subclass is still named AIterator. | 1856 // ...and the non-core subclass is still named AIterator. |
1825 new_subclass = subclasses.At(subclasses.Length() - 1); | 1857 new_subclass = subclasses.At(subclasses.Length() - 1); |
1826 name = Class::Cast(new_subclass).Name(); | 1858 name = Class::Cast(new_subclass).Name(); |
1827 EXPECT_STREQ("AIterator", name.ToCString()); | 1859 EXPECT_STREQ("AIterator", name.ToCString()); |
1828 } | 1860 } |
1829 | 1861 |
1830 #endif // !PRODUCT | 1862 #endif // !PRODUCT |
1831 | 1863 |
1832 } // namespace dart | 1864 } // namespace dart |
OLD | NEW |