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

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

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 months 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
« no previous file with comments | « runtime/vm/isolate_reload.cc ('k') | runtime/vm/isolate_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 13 matching lines...) Expand all
24 int64_t SimpleInvoke(Dart_Handle lib, const char* method) { 24 int64_t SimpleInvoke(Dart_Handle lib, const char* method) {
25 Dart_Handle result = Dart_Invoke(lib, NewString(method), 0, NULL); 25 Dart_Handle result = Dart_Invoke(lib, NewString(method), 0, NULL);
26 EXPECT_VALID(result); 26 EXPECT_VALID(result);
27 EXPECT(Dart_IsInteger(result)); 27 EXPECT(Dart_IsInteger(result));
28 int64_t integer_result = 0; 28 int64_t integer_result = 0;
29 result = Dart_IntegerToInt64(result, &integer_result); 29 result = Dart_IntegerToInt64(result, &integer_result);
30 EXPECT_VALID(result); 30 EXPECT_VALID(result);
31 return integer_result; 31 return integer_result;
32 } 32 }
33 33
34
35 const char* SimpleInvokeStr(Dart_Handle lib, const char* method) { 34 const char* SimpleInvokeStr(Dart_Handle lib, const char* method) {
36 Dart_Handle result = Dart_Invoke(lib, NewString(method), 0, NULL); 35 Dart_Handle result = Dart_Invoke(lib, NewString(method), 0, NULL);
37 const char* result_str = NULL; 36 const char* result_str = NULL;
38 EXPECT(Dart_IsString(result)); 37 EXPECT(Dart_IsString(result));
39 EXPECT_VALID(Dart_StringToCString(result, &result_str)); 38 EXPECT_VALID(Dart_StringToCString(result, &result_str));
40 return result_str; 39 return result_str;
41 } 40 }
42 41
43
44 Dart_Handle SimpleInvokeError(Dart_Handle lib, const char* method) { 42 Dart_Handle SimpleInvokeError(Dart_Handle lib, const char* method) {
45 Dart_Handle result = Dart_Invoke(lib, NewString(method), 0, NULL); 43 Dart_Handle result = Dart_Invoke(lib, NewString(method), 0, NULL);
46 EXPECT(Dart_IsError(result)); 44 EXPECT(Dart_IsError(result));
47 return result; 45 return result;
48 } 46 }
49 47
50
51 TEST_CASE(IsolateReload_FunctionReplacement) { 48 TEST_CASE(IsolateReload_FunctionReplacement) {
52 const char* kScript = 49 const char* kScript =
53 "main() {\n" 50 "main() {\n"
54 " return 4;\n" 51 " return 4;\n"
55 "}\n"; 52 "}\n";
56 53
57 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 54 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
58 EXPECT_VALID(lib); 55 EXPECT_VALID(lib);
59 56
60 EXPECT_EQ(4, SimpleInvoke(lib, "main")); 57 EXPECT_EQ(4, SimpleInvoke(lib, "main"));
61 58
62 const char* kReloadScript = 59 const char* kReloadScript =
63 "var _unused;" 60 "var _unused;"
64 "main() {\n" 61 "main() {\n"
65 " return 10;\n" 62 " return 10;\n"
66 "}\n"; 63 "}\n";
67 64
68 lib = TestCase::ReloadTestScript(kReloadScript); 65 lib = TestCase::ReloadTestScript(kReloadScript);
69 EXPECT_VALID(lib); 66 EXPECT_VALID(lib);
70 EXPECT_EQ(10, SimpleInvoke(lib, "main")); 67 EXPECT_EQ(10, SimpleInvoke(lib, "main"));
71 } 68 }
72 69
73
74 TEST_CASE(IsolateReload_BadClass) { 70 TEST_CASE(IsolateReload_BadClass) {
75 const char* kScript = 71 const char* kScript =
76 "class Foo {\n" 72 "class Foo {\n"
77 " final a;\n" 73 " final a;\n"
78 " Foo(this.a);\n" 74 " Foo(this.a);\n"
79 "}\n" 75 "}\n"
80 "main() {\n" 76 "main() {\n"
81 " new Foo(5);\n" 77 " new Foo(5);\n"
82 " return 4;\n" 78 " return 4;\n"
83 "}\n"; 79 "}\n";
(...skipping 11 matching lines...) Expand all
95 "main() {\n" 91 "main() {\n"
96 " new Foo(5);\n" 92 " new Foo(5);\n"
97 " return 10;\n" 93 " return 10;\n"
98 "}\n"; 94 "}\n";
99 95
100 Dart_Handle result = TestCase::ReloadTestScript(kReloadScript); 96 Dart_Handle result = TestCase::ReloadTestScript(kReloadScript);
101 EXPECT_ERROR(result, "unexpected token"); 97 EXPECT_ERROR(result, "unexpected token");
102 EXPECT_EQ(4, SimpleInvoke(lib, "main")); 98 EXPECT_EQ(4, SimpleInvoke(lib, "main"));
103 } 99 }
104 100
105
106 TEST_CASE(IsolateReload_StaticValuePreserved) { 101 TEST_CASE(IsolateReload_StaticValuePreserved) {
107 const char* kScript = 102 const char* kScript =
108 "init() => 'old value';\n" 103 "init() => 'old value';\n"
109 "var value = init();\n" 104 "var value = init();\n"
110 "main() {\n" 105 "main() {\n"
111 " return 'init()=${init()},value=${value}';\n" 106 " return 'init()=${init()},value=${value}';\n"
112 "}\n"; 107 "}\n";
113 108
114 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 109 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
115 EXPECT_VALID(lib); 110 EXPECT_VALID(lib);
116 EXPECT_STREQ("init()=old value,value=old value", 111 EXPECT_STREQ("init()=old value,value=old value",
117 SimpleInvokeStr(lib, "main")); 112 SimpleInvokeStr(lib, "main"));
118 113
119 const char* kReloadScript = 114 const char* kReloadScript =
120 "var _unused;" 115 "var _unused;"
121 "init() => 'new value';\n" 116 "init() => 'new value';\n"
122 "var value = init();\n" 117 "var value = init();\n"
123 "main() {\n" 118 "main() {\n"
124 " return 'init()=${init()},value=${value}';\n" 119 " return 'init()=${init()},value=${value}';\n"
125 "}\n"; 120 "}\n";
126 121
127 lib = TestCase::ReloadTestScript(kReloadScript); 122 lib = TestCase::ReloadTestScript(kReloadScript);
128 EXPECT_VALID(lib); 123 EXPECT_VALID(lib);
129 EXPECT_STREQ("init()=new value,value=old value", 124 EXPECT_STREQ("init()=new value,value=old value",
130 SimpleInvokeStr(lib, "main")); 125 SimpleInvokeStr(lib, "main"));
131 } 126 }
132 127
133
134 TEST_CASE(IsolateReload_SavedClosure) { 128 TEST_CASE(IsolateReload_SavedClosure) {
135 // Create a closure in main which only exists in the original source. 129 // Create a closure in main which only exists in the original source.
136 const char* kScript = 130 const char* kScript =
137 "magic() {\n" 131 "magic() {\n"
138 " var x = 'ante';\n" 132 " var x = 'ante';\n"
139 " return x + 'diluvian';\n" 133 " return x + 'diluvian';\n"
140 "}\n" 134 "}\n"
141 "var closure;\n" 135 "var closure;\n"
142 "main() {\n" 136 "main() {\n"
143 " closure = () { return magic().toString() + '!'; };\n" 137 " closure = () { return magic().toString() + '!'; };\n"
(...skipping 14 matching lines...) Expand all
158 "var closure;\n" 152 "var closure;\n"
159 "main() {\n" 153 "main() {\n"
160 " return closure();\n" 154 " return closure();\n"
161 "}\n"; 155 "}\n";
162 156
163 lib = TestCase::ReloadTestScript(kReloadScript); 157 lib = TestCase::ReloadTestScript(kReloadScript);
164 EXPECT_VALID(lib); 158 EXPECT_VALID(lib);
165 EXPECT_STREQ("postapocalyptic!", SimpleInvokeStr(lib, "main")); 159 EXPECT_STREQ("postapocalyptic!", SimpleInvokeStr(lib, "main"));
166 } 160 }
167 161
168
169 TEST_CASE(IsolateReload_TopLevelFieldAdded) { 162 TEST_CASE(IsolateReload_TopLevelFieldAdded) {
170 const char* kScript = 163 const char* kScript =
171 "var value1 = 10;\n" 164 "var value1 = 10;\n"
172 "main() {\n" 165 "main() {\n"
173 " return 'value1=${value1}';\n" 166 " return 'value1=${value1}';\n"
174 "}\n"; 167 "}\n";
175 168
176 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 169 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
177 EXPECT_VALID(lib); 170 EXPECT_VALID(lib);
178 EXPECT_STREQ("value1=10", SimpleInvokeStr(lib, "main")); 171 EXPECT_STREQ("value1=10", SimpleInvokeStr(lib, "main"));
179 172
180 const char* kReloadScript = 173 const char* kReloadScript =
181 "var value1 = 10;\n" 174 "var value1 = 10;\n"
182 "var value2 = 20;\n" 175 "var value2 = 20;\n"
183 "main() {\n" 176 "main() {\n"
184 " return 'value1=${value1},value2=${value2}';\n" 177 " return 'value1=${value1},value2=${value2}';\n"
185 "}\n"; 178 "}\n";
186 179
187 lib = TestCase::ReloadTestScript(kReloadScript); 180 lib = TestCase::ReloadTestScript(kReloadScript);
188 EXPECT_VALID(lib); 181 EXPECT_VALID(lib);
189 EXPECT_STREQ("value1=10,value2=20", SimpleInvokeStr(lib, "main")); 182 EXPECT_STREQ("value1=10,value2=20", SimpleInvokeStr(lib, "main"));
190 } 183 }
191 184
192
193 TEST_CASE(IsolateReload_ClassFieldAdded) { 185 TEST_CASE(IsolateReload_ClassFieldAdded) {
194 const char* kScript = 186 const char* kScript =
195 "class Foo {\n" 187 "class Foo {\n"
196 " var x;\n" 188 " var x;\n"
197 "}\n" 189 "}\n"
198 "main() {\n" 190 "main() {\n"
199 " new Foo();\n" 191 " new Foo();\n"
200 " return 44;\n" 192 " return 44;\n"
201 "}\n"; 193 "}\n";
202 194
203 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 195 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
204 EXPECT_VALID(lib); 196 EXPECT_VALID(lib);
205 EXPECT_EQ(44, SimpleInvoke(lib, "main")); 197 EXPECT_EQ(44, SimpleInvoke(lib, "main"));
206 198
207 const char* kReloadScript = 199 const char* kReloadScript =
208 "class Foo {\n" 200 "class Foo {\n"
209 " var x;\n" 201 " var x;\n"
210 " var y;\n" 202 " var y;\n"
211 "}\n" 203 "}\n"
212 "main() {\n" 204 "main() {\n"
213 " new Foo();\n" 205 " new Foo();\n"
214 " return 44;\n" 206 " return 44;\n"
215 "}\n"; 207 "}\n";
216 208
217 lib = TestCase::ReloadTestScript(kReloadScript); 209 lib = TestCase::ReloadTestScript(kReloadScript);
218 EXPECT_VALID(lib); 210 EXPECT_VALID(lib);
219 EXPECT_EQ(44, SimpleInvoke(lib, "main")); 211 EXPECT_EQ(44, SimpleInvoke(lib, "main"));
220 } 212 }
221 213
222
223 TEST_CASE(IsolateReload_ClassFieldAdded2) { 214 TEST_CASE(IsolateReload_ClassFieldAdded2) {
224 const char* kScript = 215 const char* kScript =
225 "class Foo {\n" 216 "class Foo {\n"
226 " var x;\n" 217 " var x;\n"
227 " var y;\n" 218 " var y;\n"
228 "}\n" 219 "}\n"
229 "main() {\n" 220 "main() {\n"
230 " new Foo();\n" 221 " new Foo();\n"
231 " return 44;\n" 222 " return 44;\n"
232 "}\n"; 223 "}\n";
(...skipping 11 matching lines...) Expand all
244 "main() {\n" 235 "main() {\n"
245 " new Foo();\n" 236 " new Foo();\n"
246 " return 44;\n" 237 " return 44;\n"
247 "}\n"; 238 "}\n";
248 239
249 lib = TestCase::ReloadTestScript(kReloadScript); 240 lib = TestCase::ReloadTestScript(kReloadScript);
250 EXPECT_VALID(lib); 241 EXPECT_VALID(lib);
251 EXPECT_EQ(44, SimpleInvoke(lib, "main")); 242 EXPECT_EQ(44, SimpleInvoke(lib, "main"));
252 } 243 }
253 244
254
255 TEST_CASE(IsolateReload_ClassFieldRemoved) { 245 TEST_CASE(IsolateReload_ClassFieldRemoved) {
256 const char* kScript = 246 const char* kScript =
257 "class Foo {\n" 247 "class Foo {\n"
258 " var x;\n" 248 " var x;\n"
259 " var y;\n" 249 " var y;\n"
260 "}\n" 250 "}\n"
261 "main() {\n" 251 "main() {\n"
262 " new Foo();\n" 252 " new Foo();\n"
263 " return 44;\n" 253 " return 44;\n"
264 "}\n"; 254 "}\n";
265 255
266 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 256 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
267 EXPECT_VALID(lib); 257 EXPECT_VALID(lib);
268 EXPECT_EQ(44, SimpleInvoke(lib, "main")); 258 EXPECT_EQ(44, SimpleInvoke(lib, "main"));
269 259
270 const char* kReloadScript = 260 const char* kReloadScript =
271 "class Foo {\n" 261 "class Foo {\n"
272 " var x;\n" 262 " var x;\n"
273 "}\n" 263 "}\n"
274 "main() {\n" 264 "main() {\n"
275 " new Foo();\n" 265 " new Foo();\n"
276 " return 44;\n" 266 " return 44;\n"
277 "}\n"; 267 "}\n";
278 268
279 lib = TestCase::ReloadTestScript(kReloadScript); 269 lib = TestCase::ReloadTestScript(kReloadScript);
280 EXPECT_VALID(lib); 270 EXPECT_VALID(lib);
281 EXPECT_EQ(44, SimpleInvoke(lib, "main")); 271 EXPECT_EQ(44, SimpleInvoke(lib, "main"));
282 } 272 }
283 273
284
285 TEST_CASE(IsolateReload_ClassAdded) { 274 TEST_CASE(IsolateReload_ClassAdded) {
286 const char* kScript = 275 const char* kScript =
287 "main() {\n" 276 "main() {\n"
288 " return 'hello';\n" 277 " return 'hello';\n"
289 "}\n"; 278 "}\n";
290 279
291 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 280 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
292 EXPECT_VALID(lib); 281 EXPECT_VALID(lib);
293 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main")); 282 EXPECT_STREQ("hello", SimpleInvokeStr(lib, "main"));
294 283
295 const char* kReloadScript = 284 const char* kReloadScript =
296 "var _unused;" 285 "var _unused;"
297 "class A {\n" 286 "class A {\n"
298 " toString() => 'hello from A';\n" 287 " toString() => 'hello from A';\n"
299 "}\n" 288 "}\n"
300 "main() {\n" 289 "main() {\n"
301 " return new A().toString();\n" 290 " return new A().toString();\n"
302 "}\n"; 291 "}\n";
303 292
304 lib = TestCase::ReloadTestScript(kReloadScript); 293 lib = TestCase::ReloadTestScript(kReloadScript);
305 EXPECT_VALID(lib); 294 EXPECT_VALID(lib);
306 EXPECT_STREQ("hello from A", SimpleInvokeStr(lib, "main")); 295 EXPECT_STREQ("hello from A", SimpleInvokeStr(lib, "main"));
307 } 296 }
308 297
309
310 TEST_CASE(IsolateReload_LibraryImportAdded) { 298 TEST_CASE(IsolateReload_LibraryImportAdded) {
311 const char* kScript = 299 const char* kScript =
312 "main() {\n" 300 "main() {\n"
313 " return max(3, 4);\n" 301 " return max(3, 4);\n"
314 "}\n"; 302 "}\n";
315 303
316 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 304 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
317 EXPECT_VALID(lib); 305 EXPECT_VALID(lib);
318 EXPECT_ERROR(SimpleInvokeError(lib, "main"), "max"); 306 EXPECT_ERROR(SimpleInvokeError(lib, "main"), "max");
319 307
320 const char* kReloadScript = 308 const char* kReloadScript =
321 "import 'dart:math';\n" 309 "import 'dart:math';\n"
322 "main() {\n" 310 "main() {\n"
323 " return max(3, 4);\n" 311 " return max(3, 4);\n"
324 "}\n"; 312 "}\n";
325 313
326 lib = TestCase::ReloadTestScript(kReloadScript); 314 lib = TestCase::ReloadTestScript(kReloadScript);
327 EXPECT_VALID(lib); 315 EXPECT_VALID(lib);
328 EXPECT_EQ(4, SimpleInvoke(lib, "main")); 316 EXPECT_EQ(4, SimpleInvoke(lib, "main"));
329 } 317 }
330 318
331
332 TEST_CASE(IsolateReload_LibraryImportRemoved) { 319 TEST_CASE(IsolateReload_LibraryImportRemoved) {
333 const char* kScript = 320 const char* kScript =
334 "import 'dart:math';\n" 321 "import 'dart:math';\n"
335 "main() {\n" 322 "main() {\n"
336 " return max(3, 4);\n" 323 " return max(3, 4);\n"
337 "}\n"; 324 "}\n";
338 325
339 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 326 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
340 EXPECT_VALID(lib); 327 EXPECT_VALID(lib);
341 EXPECT_EQ(4, SimpleInvoke(lib, "main")); 328 EXPECT_EQ(4, SimpleInvoke(lib, "main"));
342 329
343 const char* kReloadScript = 330 const char* kReloadScript =
344 "main() {\n" 331 "main() {\n"
345 " return max(3, 4);\n" 332 " return max(3, 4);\n"
346 "}\n"; 333 "}\n";
347 334
348 lib = TestCase::ReloadTestScript(kReloadScript); 335 lib = TestCase::ReloadTestScript(kReloadScript);
349 EXPECT_VALID(lib); 336 EXPECT_VALID(lib);
350 337
351 EXPECT_ERROR(SimpleInvokeError(lib, "main"), "max"); 338 EXPECT_ERROR(SimpleInvokeError(lib, "main"), "max");
352 } 339 }
353 340
354
355 TEST_CASE(IsolateReload_LibraryDebuggable) { 341 TEST_CASE(IsolateReload_LibraryDebuggable) {
356 const char* kScript = 342 const char* kScript =
357 "main() {\n" 343 "main() {\n"
358 " return 1;\n" 344 " return 1;\n"
359 "}\n"; 345 "}\n";
360 346
361 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 347 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
362 EXPECT_VALID(lib); 348 EXPECT_VALID(lib);
363 349
364 // The library is by default debuggable. Make it not debuggable. 350 // The library is by default debuggable. Make it not debuggable.
(...skipping 18 matching lines...) Expand all
383 369
384 EXPECT_EQ(2, SimpleInvoke(lib, "main")); 370 EXPECT_EQ(2, SimpleInvoke(lib, "main"));
385 371
386 // Library debuggability is preserved. 372 // Library debuggability is preserved.
387 intptr_t new_lib_id = -1; 373 intptr_t new_lib_id = -1;
388 EXPECT_VALID(Dart_LibraryId(lib, &new_lib_id)); 374 EXPECT_VALID(Dart_LibraryId(lib, &new_lib_id));
389 EXPECT_VALID(Dart_GetLibraryDebuggable(new_lib_id, &debuggable)); 375 EXPECT_VALID(Dart_GetLibraryDebuggable(new_lib_id, &debuggable));
390 EXPECT_EQ(false, debuggable); 376 EXPECT_EQ(false, debuggable);
391 } 377 }
392 378
393
394 TEST_CASE(IsolateReload_ImplicitConstructorChanged) { 379 TEST_CASE(IsolateReload_ImplicitConstructorChanged) {
395 // Note that we are checking that the value 20 gets cleared from the 380 // Note that we are checking that the value 20 gets cleared from the
396 // compile-time constants cache. To make this test work, "20" and 381 // compile-time constants cache. To make this test work, "20" and
397 // "10" need to be at the same token position. 382 // "10" need to be at the same token position.
398 const char* kScript = 383 const char* kScript =
399 "class A {\n" 384 "class A {\n"
400 " int field = 20;\n" 385 " int field = 20;\n"
401 "}\n" 386 "}\n"
402 "var savedA = new A();\n" 387 "var savedA = new A();\n"
403 "main() {\n" 388 "main() {\n"
(...skipping 13 matching lines...) Expand all
417 "main() {\n" 402 "main() {\n"
418 " var newA = new A();\n" 403 " var newA = new A();\n"
419 " return 'saved:${savedA.field} new:${newA.field}';\n" 404 " return 'saved:${savedA.field} new:${newA.field}';\n"
420 "}\n"; 405 "}\n";
421 406
422 lib = TestCase::ReloadTestScript(kReloadScript); 407 lib = TestCase::ReloadTestScript(kReloadScript);
423 EXPECT_VALID(lib); 408 EXPECT_VALID(lib);
424 EXPECT_STREQ("saved:20 new:10", SimpleInvokeStr(lib, "main")); 409 EXPECT_STREQ("saved:20 new:10", SimpleInvokeStr(lib, "main"));
425 } 410 }
426 411
427
428 TEST_CASE(IsolateReload_ConstructorChanged) { 412 TEST_CASE(IsolateReload_ConstructorChanged) {
429 const char* kScript = 413 const char* kScript =
430 "class A {\n" 414 "class A {\n"
431 " int field;\n" 415 " int field;\n"
432 " A() { field = 20; }\n" 416 " A() { field = 20; }\n"
433 "}\n" 417 "}\n"
434 "var savedA = new A();\n" 418 "var savedA = new A();\n"
435 "main() {\n" 419 "main() {\n"
436 " var newA = new A();\n" 420 " var newA = new A();\n"
437 " return 'saved:${savedA.field} new:${newA.field}';\n" 421 " return 'saved:${savedA.field} new:${newA.field}';\n"
(...skipping 13 matching lines...) Expand all
451 "main() {\n" 435 "main() {\n"
452 " var newA = new A();\n" 436 " var newA = new A();\n"
453 " return 'saved:${savedA.field} new:${newA.field}';\n" 437 " return 'saved:${savedA.field} new:${newA.field}';\n"
454 "}\n"; 438 "}\n";
455 439
456 lib = TestCase::ReloadTestScript(kReloadScript); 440 lib = TestCase::ReloadTestScript(kReloadScript);
457 EXPECT_VALID(lib); 441 EXPECT_VALID(lib);
458 EXPECT_STREQ("saved:20 new:10", SimpleInvokeStr(lib, "main")); 442 EXPECT_STREQ("saved:20 new:10", SimpleInvokeStr(lib, "main"));
459 } 443 }
460 444
461
462 TEST_CASE(IsolateReload_SuperClassChanged) { 445 TEST_CASE(IsolateReload_SuperClassChanged) {
463 const char* kScript = 446 const char* kScript =
464 "class A {\n" 447 "class A {\n"
465 "}\n" 448 "}\n"
466 "class B extends A {\n" 449 "class B extends A {\n"
467 "}\n" 450 "}\n"
468 "var list = [ new A(), new B() ];\n" 451 "var list = [ new A(), new B() ];\n"
469 "main() {\n" 452 "main() {\n"
470 " return (list.map((x) => '${x is A}/${x is B}')).toString();\n" 453 " return (list.map((x) => '${x is A}/${x is B}')).toString();\n"
471 "}\n"; 454 "}\n";
(...skipping 11 matching lines...) Expand all
483 "var list = [ new A(), new B() ];\n" 466 "var list = [ new A(), new B() ];\n"
484 "main() {\n" 467 "main() {\n"
485 " return (list.map((x) => '${x is A}/${x is B}')).toString();\n" 468 " return (list.map((x) => '${x is A}/${x is B}')).toString();\n"
486 "}\n"; 469 "}\n";
487 470
488 lib = TestCase::ReloadTestScript(kReloadScript); 471 lib = TestCase::ReloadTestScript(kReloadScript);
489 EXPECT_VALID(lib); 472 EXPECT_VALID(lib);
490 EXPECT_STREQ("(true/true, false/true)", SimpleInvokeStr(lib, "main")); 473 EXPECT_STREQ("(true/true, false/true)", SimpleInvokeStr(lib, "main"));
491 } 474 }
492 475
493
494 TEST_CASE(IsolateReload_Generics) { 476 TEST_CASE(IsolateReload_Generics) {
495 // Reload a program with generics without changing the source. We 477 // Reload a program with generics without changing the source. We
496 // do this to produce duplication TypeArguments and make sure that 478 // do this to produce duplication TypeArguments and make sure that
497 // the system doesn't die. 479 // the system doesn't die.
498 const char* kScript = 480 const char* kScript =
499 "class A {\n" 481 "class A {\n"
500 "}\n" 482 "}\n"
501 "class B<T extends A> {\n" 483 "class B<T extends A> {\n"
502 "}\n" 484 "}\n"
503 "main() {\n" 485 "main() {\n"
(...skipping 11 matching lines...) Expand all
515 "}\n" 497 "}\n"
516 "main() {\n" 498 "main() {\n"
517 " return new B<A>().toString();\n" 499 " return new B<A>().toString();\n"
518 "}\n"; 500 "}\n";
519 501
520 lib = TestCase::ReloadTestScript(kReloadScript); 502 lib = TestCase::ReloadTestScript(kReloadScript);
521 EXPECT_VALID(lib); 503 EXPECT_VALID(lib);
522 EXPECT_STREQ("Instance of 'B<A>'", SimpleInvokeStr(lib, "main")); 504 EXPECT_STREQ("Instance of 'B<A>'", SimpleInvokeStr(lib, "main"));
523 } 505 }
524 506
525
526 TEST_CASE(IsolateReload_TypeIdentity) { 507 TEST_CASE(IsolateReload_TypeIdentity) {
527 const char* kScript = 508 const char* kScript =
528 "import 'test:isolate_reload_helper';\n" 509 "import 'test:isolate_reload_helper';\n"
529 "class T { }\n" 510 "class T { }\n"
530 "getType() => T;\n" 511 "getType() => T;\n"
531 "main() {\n" 512 "main() {\n"
532 " var oldType = getType();\n" 513 " var oldType = getType();\n"
533 " reloadTest();\n" 514 " reloadTest();\n"
534 " var newType = getType();\n" 515 " var newType = getType();\n"
535 " return identical(oldType, newType).toString();\n" 516 " return identical(oldType, newType).toString();\n"
(...skipping 11 matching lines...) Expand all
547 " reloadTest();\n" 528 " reloadTest();\n"
548 " var newType = getType();\n" 529 " var newType = getType();\n"
549 " return identical(oldType, newType).toString();\n" 530 " return identical(oldType, newType).toString();\n"
550 "}\n"; 531 "}\n";
551 532
552 TestCase::SetReloadTestScript(kReloadScript); 533 TestCase::SetReloadTestScript(kReloadScript);
553 534
554 EXPECT_STREQ("true", SimpleInvokeStr(lib, "main")); 535 EXPECT_STREQ("true", SimpleInvokeStr(lib, "main"));
555 } 536 }
556 537
557
558 TEST_CASE(IsolateReload_TypeIdentityGeneric) { 538 TEST_CASE(IsolateReload_TypeIdentityGeneric) {
559 const char* kScript = 539 const char* kScript =
560 "import 'test:isolate_reload_helper';\n" 540 "import 'test:isolate_reload_helper';\n"
561 "class T<G> { }\n" 541 "class T<G> { }\n"
562 "getType() => new T<int>().runtimeType;\n" 542 "getType() => new T<int>().runtimeType;\n"
563 "main() {\n" 543 "main() {\n"
564 " var oldType = getType();\n" 544 " var oldType = getType();\n"
565 " reloadTest();\n" 545 " reloadTest();\n"
566 " var newType = getType();\n" 546 " var newType = getType();\n"
567 " return identical(oldType, newType).toString();\n" 547 " return identical(oldType, newType).toString();\n"
(...skipping 11 matching lines...) Expand all
579 " reloadTest();\n" 559 " reloadTest();\n"
580 " var newType = getType();\n" 560 " var newType = getType();\n"
581 " return identical(oldType, newType).toString();\n" 561 " return identical(oldType, newType).toString();\n"
582 "}\n"; 562 "}\n";
583 563
584 TestCase::SetReloadTestScript(kReloadScript); 564 TestCase::SetReloadTestScript(kReloadScript);
585 565
586 EXPECT_STREQ("true", SimpleInvokeStr(lib, "main")); 566 EXPECT_STREQ("true", SimpleInvokeStr(lib, "main"));
587 } 567 }
588 568
589
590 TEST_CASE(IsolateReload_TypeIdentityParameter) { 569 TEST_CASE(IsolateReload_TypeIdentityParameter) {
591 const char* kScript = 570 const char* kScript =
592 "import 'dart:mirrors';\n" 571 "import 'dart:mirrors';\n"
593 "import 'test:isolate_reload_helper';\n" 572 "import 'test:isolate_reload_helper';\n"
594 "class T<G> { }\n" 573 "class T<G> { }\n"
595 "getTypeVar() => reflectType(T).typeVariables[0];\n" 574 "getTypeVar() => reflectType(T).typeVariables[0];\n"
596 "main() {\n" 575 "main() {\n"
597 " var oldType = getTypeVar();\n" 576 " var oldType = getTypeVar();\n"
598 " reloadTest();\n" 577 " reloadTest();\n"
599 " var newType = getTypeVar();\n" 578 " var newType = getTypeVar();\n"
(...skipping 13 matching lines...) Expand all
613 " reloadTest();\n" 592 " reloadTest();\n"
614 " var newType = getTypeVar();\n" 593 " var newType = getTypeVar();\n"
615 " return (oldType == newType).toString();\n" 594 " return (oldType == newType).toString();\n"
616 "}\n"; 595 "}\n";
617 596
618 TestCase::SetReloadTestScript(kReloadScript); 597 TestCase::SetReloadTestScript(kReloadScript);
619 598
620 EXPECT_STREQ("true", SimpleInvokeStr(lib, "main")); 599 EXPECT_STREQ("true", SimpleInvokeStr(lib, "main"));
621 } 600 }
622 601
623
624 TEST_CASE(IsolateReload_MixinChanged) { 602 TEST_CASE(IsolateReload_MixinChanged) {
625 const char* kScript = 603 const char* kScript =
626 "class Mixin1 {\n" 604 "class Mixin1 {\n"
627 " var field = 'mixin1';\n" 605 " var field = 'mixin1';\n"
628 " func() => 'mixin1';\n" 606 " func() => 'mixin1';\n"
629 "}\n" 607 "}\n"
630 "class B extends Object with Mixin1 {\n" 608 "class B extends Object with Mixin1 {\n"
631 "}\n" 609 "}\n"
632 "var saved = new B();\n" 610 "var saved = new B();\n"
633 "main() {\n" 611 "main() {\n"
(...skipping 22 matching lines...) Expand all
656 EXPECT_VALID(lib); 634 EXPECT_VALID(lib);
657 635
658 // The saved instance of B retains its old field value from mixin1, 636 // The saved instance of B retains its old field value from mixin1,
659 // but it gets the new implementation of func from mixin2. 637 // but it gets the new implementation of func from mixin2.
660 EXPECT_STREQ( 638 EXPECT_STREQ(
661 "saved:field=mixin1,func=mixin2 " 639 "saved:field=mixin1,func=mixin2 "
662 "newer:field=mixin2,func=mixin2", 640 "newer:field=mixin2,func=mixin2",
663 SimpleInvokeStr(lib, "main")); 641 SimpleInvokeStr(lib, "main"));
664 } 642 }
665 643
666
667 TEST_CASE(IsolateReload_ComplexInheritanceChange) { 644 TEST_CASE(IsolateReload_ComplexInheritanceChange) {
668 const char* kScript = 645 const char* kScript =
669 "class A {\n" 646 "class A {\n"
670 " String name;\n" 647 " String name;\n"
671 " A(this.name);\n" 648 " A(this.name);\n"
672 "}\n" 649 "}\n"
673 "class B extends A {\n" 650 "class B extends A {\n"
674 " B(name) : super(name);\n" 651 " B(name) : super(name);\n"
675 "}\n" 652 "}\n"
676 "class C extends B {\n" 653 "class C extends B {\n"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 lib = TestCase::ReloadTestScript(kReloadScript2); 723 lib = TestCase::ReloadTestScript(kReloadScript2);
747 EXPECT_VALID(lib); 724 EXPECT_VALID(lib);
748 EXPECT_STREQ( 725 EXPECT_STREQ(
749 "(a is A(true)/ B(false)/ C(false)/ X(true)," 726 "(a is A(true)/ B(false)/ C(false)/ X(true),"
750 " b is A(false)/ B(true)/ C(false)/ X(true)," 727 " b is A(false)/ B(true)/ C(false)/ X(true),"
751 " c is A(true)/ B(false)/ C(true)/ X(true)," 728 " c is A(true)/ B(false)/ C(true)/ X(true),"
752 " x is A(false)/ B(false)/ C(false)/ X(true))", 729 " x is A(false)/ B(false)/ C(false)/ X(true))",
753 SimpleInvokeStr(lib, "main")); 730 SimpleInvokeStr(lib, "main"));
754 } 731 }
755 732
756
757 TEST_CASE(IsolateReload_LiveStack) { 733 TEST_CASE(IsolateReload_LiveStack) {
758 const char* kScript = 734 const char* kScript =
759 "import 'test:isolate_reload_helper';\n" 735 "import 'test:isolate_reload_helper';\n"
760 "helper() => 7;\n" 736 "helper() => 7;\n"
761 "alpha() { var x = helper(); reloadTest(); return x + helper(); }\n" 737 "alpha() { var x = helper(); reloadTest(); return x + helper(); }\n"
762 "foo() => alpha();\n" 738 "foo() => alpha();\n"
763 "bar() => foo();\n" 739 "bar() => foo();\n"
764 "main() {\n" 740 "main() {\n"
765 " return bar();\n" 741 " return bar();\n"
766 "}\n"; 742 "}\n";
(...skipping 13 matching lines...) Expand all
780 756
781 TestCase::SetReloadTestScript(kReloadScript); 757 TestCase::SetReloadTestScript(kReloadScript);
782 758
783 EXPECT_EQ(107, SimpleInvoke(lib, "main")); 759 EXPECT_EQ(107, SimpleInvoke(lib, "main"));
784 760
785 lib = TestCase::GetReloadErrorOrRootLibrary(); 761 lib = TestCase::GetReloadErrorOrRootLibrary();
786 EXPECT_VALID(lib); 762 EXPECT_VALID(lib);
787 EXPECT_EQ(105, SimpleInvoke(lib, "main")); 763 EXPECT_EQ(105, SimpleInvoke(lib, "main"));
788 } 764 }
789 765
790
791 TEST_CASE(IsolateReload_LibraryLookup) { 766 TEST_CASE(IsolateReload_LibraryLookup) {
792 const char* kImportScript = "importedFunc() => 'a';\n"; 767 const char* kImportScript = "importedFunc() => 'a';\n";
793 TestCase::AddTestLib("test:lib1", kImportScript); 768 TestCase::AddTestLib("test:lib1", kImportScript);
794 769
795 const char* kScript = 770 const char* kScript =
796 "main() {\n" 771 "main() {\n"
797 " return importedFunc();\n" 772 " return importedFunc();\n"
798 "}\n"; 773 "}\n";
799 Dart_Handle result; 774 Dart_Handle result;
800 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 775 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
(...skipping 21 matching lines...) Expand all
822 797
823 // Reload and remove 'dart:math' from isolate. 798 // Reload and remove 'dart:math' from isolate.
824 lib = TestCase::ReloadTestScript(kScript); 799 lib = TestCase::ReloadTestScript(kScript);
825 EXPECT_VALID(lib); 800 EXPECT_VALID(lib);
826 801
827 // Fail to find 'test:lib1' in the isolate. 802 // Fail to find 'test:lib1' in the isolate.
828 result = Dart_LookupLibrary(NewString("test:lib1")); 803 result = Dart_LookupLibrary(NewString("test:lib1"));
829 EXPECT(Dart_IsError(result)); 804 EXPECT(Dart_IsError(result));
830 } 805 }
831 806
832
833 TEST_CASE(IsolateReload_LibraryHide) { 807 TEST_CASE(IsolateReload_LibraryHide) {
834 const char* kImportScript = "importedFunc() => 'a';\n"; 808 const char* kImportScript = "importedFunc() => 'a';\n";
835 TestCase::AddTestLib("test:lib1", kImportScript); 809 TestCase::AddTestLib("test:lib1", kImportScript);
836 810
837 // Import 'test:lib1' with importedFunc hidden. Will result in an 811 // Import 'test:lib1' with importedFunc hidden. Will result in an
838 // error. 812 // error.
839 const char* kScript = 813 const char* kScript =
840 "import 'test:lib1' hide importedFunc;\n" 814 "import 'test:lib1' hide importedFunc;\n"
841 "main() {\n" 815 "main() {\n"
842 " return importedFunc();\n" 816 " return importedFunc();\n"
(...skipping 10 matching lines...) Expand all
853 "import 'test:lib1';\n" 827 "import 'test:lib1';\n"
854 "main() {\n" 828 "main() {\n"
855 " return importedFunc();\n" 829 " return importedFunc();\n"
856 "}\n"; 830 "}\n";
857 831
858 lib = TestCase::ReloadTestScript(kReloadScript); 832 lib = TestCase::ReloadTestScript(kReloadScript);
859 EXPECT_VALID(lib); 833 EXPECT_VALID(lib);
860 EXPECT_STREQ("a", SimpleInvokeStr(lib, "main")); 834 EXPECT_STREQ("a", SimpleInvokeStr(lib, "main"));
861 } 835 }
862 836
863
864 TEST_CASE(IsolateReload_LibraryShow) { 837 TEST_CASE(IsolateReload_LibraryShow) {
865 const char* kImportScript = 838 const char* kImportScript =
866 "importedFunc() => 'a';\n" 839 "importedFunc() => 'a';\n"
867 "importedIntFunc() => 4;\n"; 840 "importedIntFunc() => 4;\n";
868 TestCase::AddTestLib("test:lib1", kImportScript); 841 TestCase::AddTestLib("test:lib1", kImportScript);
869 842
870 // Import 'test:lib1' with importedIntFunc visible. Will result in 843 // Import 'test:lib1' with importedIntFunc visible. Will result in
871 // an error when 'main' is invoked. 844 // an error when 'main' is invoked.
872 const char* kScript = 845 const char* kScript =
873 "import 'test:lib1' show importedIntFunc;\n" 846 "import 'test:lib1' show importedIntFunc;\n"
874 "main() {\n" 847 "main() {\n"
875 " return importedFunc();\n" 848 " return importedFunc();\n"
876 "}\n" 849 "}\n"
877 "mainInt() {\n" 850 "mainInt() {\n"
878 " return importedIntFunc();\n" 851 " return importedIntFunc();\n"
879 "}\n"; 852 "}\n";
880 853
881
882 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 854 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
883 EXPECT_VALID(lib); 855 EXPECT_VALID(lib);
884 856
885 // Works. 857 // Works.
886 EXPECT_EQ(4, SimpleInvoke(lib, "mainInt")); 858 EXPECT_EQ(4, SimpleInvoke(lib, "mainInt"));
887 // Results in an error. 859 // Results in an error.
888 EXPECT_ERROR(SimpleInvokeError(lib, "main"), "importedFunc"); 860 EXPECT_ERROR(SimpleInvokeError(lib, "main"), "importedFunc");
889 861
890 // Import 'test:lib1' with importedFunc visible. Will result in 862 // Import 'test:lib1' with importedFunc visible. Will result in
891 // an error when 'mainInt' is invoked. 863 // an error when 'mainInt' is invoked.
892 const char* kReloadScript = 864 const char* kReloadScript =
893 "import 'test:lib1' show importedFunc;\n" 865 "import 'test:lib1' show importedFunc;\n"
894 "main() {\n" 866 "main() {\n"
895 " return importedFunc();\n" 867 " return importedFunc();\n"
896 "}\n" 868 "}\n"
897 "mainInt() {\n" 869 "mainInt() {\n"
898 " return importedIntFunc();\n" 870 " return importedIntFunc();\n"
899 "}\n"; 871 "}\n";
900 872
901 lib = TestCase::ReloadTestScript(kReloadScript); 873 lib = TestCase::ReloadTestScript(kReloadScript);
902 EXPECT_VALID(lib); 874 EXPECT_VALID(lib);
903 875
904 // Works. 876 // Works.
905 EXPECT_STREQ("a", SimpleInvokeStr(lib, "main")); 877 EXPECT_STREQ("a", SimpleInvokeStr(lib, "main"));
906 // Results in an error. 878 // Results in an error.
907 EXPECT_ERROR(SimpleInvokeError(lib, "mainInt"), "importedIntFunc"); 879 EXPECT_ERROR(SimpleInvokeError(lib, "mainInt"), "importedIntFunc");
908 } 880 }
909 881
910
911 // Verifies that we clear the ICs for the functions live on the stack in a way 882 // Verifies that we clear the ICs for the functions live on the stack in a way
912 // that is compatible with the fast path smi stubs. 883 // that is compatible with the fast path smi stubs.
913 TEST_CASE(IsolateReload_SmiFastPathStubs) { 884 TEST_CASE(IsolateReload_SmiFastPathStubs) {
914 const char* kImportScript = "importedIntFunc() => 4;\n"; 885 const char* kImportScript = "importedIntFunc() => 4;\n";
915 TestCase::AddTestLib("test:lib1", kImportScript); 886 TestCase::AddTestLib("test:lib1", kImportScript);
916 887
917 const char* kScript = 888 const char* kScript =
918 "import 'test:isolate_reload_helper';\n" 889 "import 'test:isolate_reload_helper';\n"
919 "import 'test:lib1' show importedIntFunc;\n" 890 "import 'test:lib1' show importedIntFunc;\n"
920 "main() {\n" 891 "main() {\n"
921 " var x = importedIntFunc();\n" 892 " var x = importedIntFunc();\n"
922 " var y = importedIntFunc();\n" 893 " var y = importedIntFunc();\n"
923 " reloadTest();\n" 894 " reloadTest();\n"
924 " return x + y;\n" 895 " return x + y;\n"
925 "}\n"; 896 "}\n";
926 897
927
928 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 898 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
929 EXPECT_VALID(lib); 899 EXPECT_VALID(lib);
930 900
931 // Identity reload. 901 // Identity reload.
932 TestCase::SetReloadTestScript(kScript); 902 TestCase::SetReloadTestScript(kScript);
933 903
934 EXPECT_EQ(8, SimpleInvoke(lib, "main")); 904 EXPECT_EQ(8, SimpleInvoke(lib, "main"));
935 } 905 }
936 906
937
938 // Verifies that we assign the correct patch classes for imported 907 // Verifies that we assign the correct patch classes for imported
939 // mixins when we reload. 908 // mixins when we reload.
940 TEST_CASE(IsolateReload_ImportedMixinFunction) { 909 TEST_CASE(IsolateReload_ImportedMixinFunction) {
941 const char* kImportScript = 910 const char* kImportScript =
942 "class ImportedMixin {\n" 911 "class ImportedMixin {\n"
943 " mixinFunc() => 'mixin';\n" 912 " mixinFunc() => 'mixin';\n"
944 "}\n"; 913 "}\n";
945 TestCase::AddTestLib("test:lib1", kImportScript); 914 TestCase::AddTestLib("test:lib1", kImportScript);
946 915
947 const char* kScript = 916 const char* kScript =
(...skipping 17 matching lines...) Expand all
965 "var func;\n" 934 "var func;\n"
966 "main() {\n" 935 "main() {\n"
967 " return func();\n" 936 " return func();\n"
968 "}\n"; 937 "}\n";
969 938
970 lib = TestCase::ReloadTestScript(kReloadScript); 939 lib = TestCase::ReloadTestScript(kReloadScript);
971 EXPECT_VALID(lib); 940 EXPECT_VALID(lib);
972 EXPECT_STREQ("mixin", SimpleInvokeStr(lib, "main")); 941 EXPECT_STREQ("mixin", SimpleInvokeStr(lib, "main"));
973 } 942 }
974 943
975
976 TEST_CASE(IsolateReload_TopLevelParseError) { 944 TEST_CASE(IsolateReload_TopLevelParseError) {
977 const char* kScript = 945 const char* kScript =
978 "main() {\n" 946 "main() {\n"
979 " return 4;\n" 947 " return 4;\n"
980 "}\n"; 948 "}\n";
981 949
982 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 950 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
983 EXPECT_VALID(lib); 951 EXPECT_VALID(lib);
984 EXPECT_EQ(4, SimpleInvoke(lib, "main")); 952 EXPECT_EQ(4, SimpleInvoke(lib, "main"));
985 953
986 const char* kReloadScript = 954 const char* kReloadScript =
987 "kjsadkfjaksldfjklsadf;\n" 955 "kjsadkfjaksldfjklsadf;\n"
988 "main() {\n" 956 "main() {\n"
989 " return 4;\n" 957 " return 4;\n"
990 "}\n"; 958 "}\n";
991 959
992 lib = TestCase::ReloadTestScript(kReloadScript); 960 lib = TestCase::ReloadTestScript(kReloadScript);
993 EXPECT_ERROR(lib, "unexpected token"); 961 EXPECT_ERROR(lib, "unexpected token");
994 } 962 }
995 963
996
997 TEST_CASE(IsolateReload_PendingUnqualifiedCall_StaticToInstance) { 964 TEST_CASE(IsolateReload_PendingUnqualifiedCall_StaticToInstance) {
998 const char* kScript = 965 const char* kScript =
999 "import 'test:isolate_reload_helper';\n" 966 "import 'test:isolate_reload_helper';\n"
1000 "class C {\n" 967 "class C {\n"
1001 " static foo() => 'static';\n" 968 " static foo() => 'static';\n"
1002 " test() {\n" 969 " test() {\n"
1003 " reloadTest();\n" 970 " reloadTest();\n"
1004 " return foo();\n" 971 " return foo();\n"
1005 " }\n" 972 " }\n"
1006 "}\n" 973 "}\n"
(...skipping 19 matching lines...) Expand all
1026 993
1027 TestCase::SetReloadTestScript(kReloadScript); 994 TestCase::SetReloadTestScript(kReloadScript);
1028 995
1029 EXPECT_STREQ("instance", SimpleInvokeStr(lib, "main")); 996 EXPECT_STREQ("instance", SimpleInvokeStr(lib, "main"));
1030 997
1031 lib = TestCase::GetReloadErrorOrRootLibrary(); 998 lib = TestCase::GetReloadErrorOrRootLibrary();
1032 EXPECT_VALID(lib); 999 EXPECT_VALID(lib);
1033 EXPECT_STREQ("instance", SimpleInvokeStr(lib, "main")); 1000 EXPECT_STREQ("instance", SimpleInvokeStr(lib, "main"));
1034 } 1001 }
1035 1002
1036
1037 TEST_CASE(IsolateReload_PendingUnqualifiedCall_InstanceToStatic) { 1003 TEST_CASE(IsolateReload_PendingUnqualifiedCall_InstanceToStatic) {
1038 const char* kScript = 1004 const char* kScript =
1039 "import 'test:isolate_reload_helper';\n" 1005 "import 'test:isolate_reload_helper';\n"
1040 "class C {\n" 1006 "class C {\n"
1041 " foo() => 'instance';\n" 1007 " foo() => 'instance';\n"
1042 " test() {\n" 1008 " test() {\n"
1043 " reloadTest();\n" 1009 " reloadTest();\n"
1044 " return foo();\n" 1010 " return foo();\n"
1045 " }\n" 1011 " }\n"
1046 "}\n" 1012 "}\n"
(...skipping 19 matching lines...) Expand all
1066 1032
1067 TestCase::SetReloadTestScript(kReloadScript); 1033 TestCase::SetReloadTestScript(kReloadScript);
1068 1034
1069 EXPECT_STREQ("static", SimpleInvokeStr(lib, "main")); 1035 EXPECT_STREQ("static", SimpleInvokeStr(lib, "main"));
1070 1036
1071 lib = TestCase::GetReloadErrorOrRootLibrary(); 1037 lib = TestCase::GetReloadErrorOrRootLibrary();
1072 EXPECT_VALID(lib); 1038 EXPECT_VALID(lib);
1073 EXPECT_STREQ("static", SimpleInvokeStr(lib, "main")); 1039 EXPECT_STREQ("static", SimpleInvokeStr(lib, "main"));
1074 } 1040 }
1075 1041
1076
1077 TEST_CASE(IsolateReload_PendingConstructorCall_AbstractToConcrete) { 1042 TEST_CASE(IsolateReload_PendingConstructorCall_AbstractToConcrete) {
1078 const char* kScript = 1043 const char* kScript =
1079 "import 'test:isolate_reload_helper';\n" 1044 "import 'test:isolate_reload_helper';\n"
1080 "abstract class Foo {}\n" 1045 "abstract class Foo {}\n"
1081 "class C {\n" 1046 "class C {\n"
1082 " test() {\n" 1047 " test() {\n"
1083 " reloadTest();\n" 1048 " reloadTest();\n"
1084 " return new Foo();\n" 1049 " return new Foo();\n"
1085 " }\n" 1050 " }\n"
1086 "}\n" 1051 "}\n"
(...skipping 29 matching lines...) Expand all
1116 1081
1117 TestCase::SetReloadTestScript(kReloadScript); 1082 TestCase::SetReloadTestScript(kReloadScript);
1118 1083
1119 EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main")); 1084 EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main"));
1120 1085
1121 lib = TestCase::GetReloadErrorOrRootLibrary(); 1086 lib = TestCase::GetReloadErrorOrRootLibrary();
1122 EXPECT_VALID(lib); 1087 EXPECT_VALID(lib);
1123 EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main")); 1088 EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main"));
1124 } 1089 }
1125 1090
1126
1127 TEST_CASE(IsolateReload_PendingConstructorCall_ConcreteToAbstract) { 1091 TEST_CASE(IsolateReload_PendingConstructorCall_ConcreteToAbstract) {
1128 const char* kScript = 1092 const char* kScript =
1129 "import 'test:isolate_reload_helper';\n" 1093 "import 'test:isolate_reload_helper';\n"
1130 "class Foo {}\n" 1094 "class Foo {}\n"
1131 "class C {\n" 1095 "class C {\n"
1132 " test() {\n" 1096 " test() {\n"
1133 " reloadTest();\n" 1097 " reloadTest();\n"
1134 " return new Foo();\n" 1098 " return new Foo();\n"
1135 " }\n" 1099 " }\n"
1136 "}\n" 1100 "}\n"
(...skipping 29 matching lines...) Expand all
1166 1130
1167 TestCase::SetReloadTestScript(kReloadScript); 1131 TestCase::SetReloadTestScript(kReloadScript);
1168 1132
1169 EXPECT_STREQ("exception", SimpleInvokeStr(lib, "main")); 1133 EXPECT_STREQ("exception", SimpleInvokeStr(lib, "main"));
1170 1134
1171 lib = TestCase::GetReloadErrorOrRootLibrary(); 1135 lib = TestCase::GetReloadErrorOrRootLibrary();
1172 EXPECT_VALID(lib); 1136 EXPECT_VALID(lib);
1173 EXPECT_STREQ("exception", SimpleInvokeStr(lib, "main")); 1137 EXPECT_STREQ("exception", SimpleInvokeStr(lib, "main"));
1174 } 1138 }
1175 1139
1176
1177 TEST_CASE(IsolateReload_PendingStaticCall_DefinedToNSM) { 1140 TEST_CASE(IsolateReload_PendingStaticCall_DefinedToNSM) {
1178 const char* kScript = 1141 const char* kScript =
1179 "import 'test:isolate_reload_helper';\n" 1142 "import 'test:isolate_reload_helper';\n"
1180 "class C {\n" 1143 "class C {\n"
1181 " static foo() => 'static'\n" 1144 " static foo() => 'static'\n"
1182 " test() {\n" 1145 " test() {\n"
1183 " reloadTest();\n" 1146 " reloadTest();\n"
1184 " return C.foo();\n" 1147 " return C.foo();\n"
1185 " }\n" 1148 " }\n"
1186 "}\n" 1149 "}\n"
(...skipping 26 matching lines...) Expand all
1213 1176
1214 TestCase::SetReloadTestScript(kReloadScript); 1177 TestCase::SetReloadTestScript(kReloadScript);
1215 1178
1216 EXPECT_STREQ("exception", SimpleInvokeStr(lib, "main")); 1179 EXPECT_STREQ("exception", SimpleInvokeStr(lib, "main"));
1217 1180
1218 lib = TestCase::GetReloadErrorOrRootLibrary(); 1181 lib = TestCase::GetReloadErrorOrRootLibrary();
1219 EXPECT_VALID(lib); 1182 EXPECT_VALID(lib);
1220 EXPECT_STREQ("exception", SimpleInvokeStr(lib, "main")); 1183 EXPECT_STREQ("exception", SimpleInvokeStr(lib, "main"));
1221 } 1184 }
1222 1185
1223
1224 TEST_CASE(IsolateReload_PendingStaticCall_NSMToDefined) { 1186 TEST_CASE(IsolateReload_PendingStaticCall_NSMToDefined) {
1225 const char* kScript = 1187 const char* kScript =
1226 "import 'test:isolate_reload_helper';\n" 1188 "import 'test:isolate_reload_helper';\n"
1227 "class C {\n" 1189 "class C {\n"
1228 " test() {\n" 1190 " test() {\n"
1229 " reloadTest();\n" 1191 " reloadTest();\n"
1230 " return C.foo();\n" 1192 " return C.foo();\n"
1231 " }\n" 1193 " }\n"
1232 "}\n" 1194 "}\n"
1233 "main() {\n" 1195 "main() {\n"
(...skipping 26 matching lines...) Expand all
1260 1222
1261 TestCase::SetReloadTestScript(kReloadScript); 1223 TestCase::SetReloadTestScript(kReloadScript);
1262 1224
1263 EXPECT_STREQ("static", SimpleInvokeStr(lib, "main")); 1225 EXPECT_STREQ("static", SimpleInvokeStr(lib, "main"));
1264 1226
1265 lib = TestCase::GetReloadErrorOrRootLibrary(); 1227 lib = TestCase::GetReloadErrorOrRootLibrary();
1266 EXPECT_VALID(lib); 1228 EXPECT_VALID(lib);
1267 EXPECT_STREQ("static", SimpleInvokeStr(lib, "main")); 1229 EXPECT_STREQ("static", SimpleInvokeStr(lib, "main"));
1268 } 1230 }
1269 1231
1270
1271 TEST_CASE(IsolateReload_PendingSuperCall) { 1232 TEST_CASE(IsolateReload_PendingSuperCall) {
1272 const char* kScript = 1233 const char* kScript =
1273 "import 'test:isolate_reload_helper';\n" 1234 "import 'test:isolate_reload_helper';\n"
1274 "class S {\n" 1235 "class S {\n"
1275 " foo() => 1;\n" 1236 " foo() => 1;\n"
1276 "}\n" 1237 "}\n"
1277 "class C extends S {\n" 1238 "class C extends S {\n"
1278 " foo() => 100;\n" 1239 " foo() => 100;\n"
1279 " test() {\n" 1240 " test() {\n"
1280 " var n = super.foo();\n" 1241 " var n = super.foo();\n"
(...skipping 23 matching lines...) Expand all
1304 "}\n" 1265 "}\n"
1305 "main() {\n" 1266 "main() {\n"
1306 " return new C().test();\n" 1267 " return new C().test();\n"
1307 "}\n"; 1268 "}\n";
1308 1269
1309 TestCase::SetReloadTestScript(kReloadScript); 1270 TestCase::SetReloadTestScript(kReloadScript);
1310 1271
1311 EXPECT_EQ(11, SimpleInvoke(lib, "main")); 1272 EXPECT_EQ(11, SimpleInvoke(lib, "main"));
1312 } 1273 }
1313 1274
1314
1315 TEST_CASE(IsolateReload_TearOff_Instance_Equality) { 1275 TEST_CASE(IsolateReload_TearOff_Instance_Equality) {
1316 const char* kScript = 1276 const char* kScript =
1317 "import 'test:isolate_reload_helper';\n" 1277 "import 'test:isolate_reload_helper';\n"
1318 "class C {\n" 1278 "class C {\n"
1319 " foo() => 'old';\n" 1279 " foo() => 'old';\n"
1320 "}\n" 1280 "}\n"
1321 "main() {\n" 1281 "main() {\n"
1322 " var c = new C();\n" 1282 " var c = new C();\n"
1323 " var f1 = c.foo;\n" 1283 " var f1 = c.foo;\n"
1324 " reloadTest();\n" 1284 " reloadTest();\n"
(...skipping 18 matching lines...) Expand all
1343 "}\n"; 1303 "}\n";
1344 1304
1345 TestCase::SetReloadTestScript(kReloadScript); 1305 TestCase::SetReloadTestScript(kReloadScript);
1346 1306
1347 EXPECT_STREQ("new new true false", SimpleInvokeStr(lib, "main")); 1307 EXPECT_STREQ("new new true false", SimpleInvokeStr(lib, "main"));
1348 1308
1349 lib = TestCase::GetReloadErrorOrRootLibrary(); 1309 lib = TestCase::GetReloadErrorOrRootLibrary();
1350 EXPECT_VALID(lib); 1310 EXPECT_VALID(lib);
1351 } 1311 }
1352 1312
1353
1354 TEST_CASE(IsolateReload_TearOff_Class_Identity) { 1313 TEST_CASE(IsolateReload_TearOff_Class_Identity) {
1355 const char* kScript = 1314 const char* kScript =
1356 "import 'test:isolate_reload_helper';\n" 1315 "import 'test:isolate_reload_helper';\n"
1357 "class C {\n" 1316 "class C {\n"
1358 " static foo() => 'old';\n" 1317 " static foo() => 'old';\n"
1359 "}\n" 1318 "}\n"
1360 "getFoo() => C.foo;\n" 1319 "getFoo() => C.foo;\n"
1361 "main() {\n" 1320 "main() {\n"
1362 " var f1 = getFoo();\n" 1321 " var f1 = getFoo();\n"
1363 " reloadTest();\n" 1322 " reloadTest();\n"
(...skipping 18 matching lines...) Expand all
1382 "}\n"; 1341 "}\n";
1383 1342
1384 TestCase::SetReloadTestScript(kReloadScript); 1343 TestCase::SetReloadTestScript(kReloadScript);
1385 1344
1386 EXPECT_STREQ("new new true true", SimpleInvokeStr(lib, "main")); 1345 EXPECT_STREQ("new new true true", SimpleInvokeStr(lib, "main"));
1387 1346
1388 lib = TestCase::GetReloadErrorOrRootLibrary(); 1347 lib = TestCase::GetReloadErrorOrRootLibrary();
1389 EXPECT_VALID(lib); 1348 EXPECT_VALID(lib);
1390 } 1349 }
1391 1350
1392
1393 TEST_CASE(IsolateReload_TearOff_Library_Identity) { 1351 TEST_CASE(IsolateReload_TearOff_Library_Identity) {
1394 const char* kScript = 1352 const char* kScript =
1395 "import 'test:isolate_reload_helper';\n" 1353 "import 'test:isolate_reload_helper';\n"
1396 "foo() => 'old';\n" 1354 "foo() => 'old';\n"
1397 "getFoo() => foo;\n" 1355 "getFoo() => foo;\n"
1398 "main() {\n" 1356 "main() {\n"
1399 " var f1 = getFoo();\n" 1357 " var f1 = getFoo();\n"
1400 " reloadTest();\n" 1358 " reloadTest();\n"
1401 " var f2 = getFoo();\n" 1359 " var f2 = getFoo();\n"
1402 " return '${f1()} ${f2()} ${f1 == f2} ${identical(f1, f2)}';\n" 1360 " return '${f1()} ${f2()} ${f1 == f2} ${identical(f1, f2)}';\n"
(...skipping 14 matching lines...) Expand all
1417 "}\n"; 1375 "}\n";
1418 1376
1419 TestCase::SetReloadTestScript(kReloadScript); 1377 TestCase::SetReloadTestScript(kReloadScript);
1420 1378
1421 EXPECT_STREQ("new new true true", SimpleInvokeStr(lib, "main")); 1379 EXPECT_STREQ("new new true true", SimpleInvokeStr(lib, "main"));
1422 1380
1423 lib = TestCase::GetReloadErrorOrRootLibrary(); 1381 lib = TestCase::GetReloadErrorOrRootLibrary();
1424 EXPECT_VALID(lib); 1382 EXPECT_VALID(lib);
1425 } 1383 }
1426 1384
1427
1428 TEST_CASE(IsolateReload_TearOff_List_Set) { 1385 TEST_CASE(IsolateReload_TearOff_List_Set) {
1429 const char* kScript = 1386 const char* kScript =
1430 "import 'test:isolate_reload_helper';\n" 1387 "import 'test:isolate_reload_helper';\n"
1431 "class C {\n" 1388 "class C {\n"
1432 " foo() => 'old';\n" 1389 " foo() => 'old';\n"
1433 "}\n" 1390 "}\n"
1434 "List list = new List(2);\n" 1391 "List list = new List(2);\n"
1435 "Set set = new Set();\n" 1392 "Set set = new Set();\n"
1436 "main() {\n" 1393 "main() {\n"
1437 " var c = new C();\n" 1394 " var c = new C();\n"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 1438
1482 TestCase::SetReloadTestScript(kReloadScript); 1439 TestCase::SetReloadTestScript(kReloadScript);
1483 1440
1484 EXPECT_STREQ("new new true true true new true true true", 1441 EXPECT_STREQ("new new true true true new true true true",
1485 SimpleInvokeStr(lib, "main")); 1442 SimpleInvokeStr(lib, "main"));
1486 1443
1487 lib = TestCase::GetReloadErrorOrRootLibrary(); 1444 lib = TestCase::GetReloadErrorOrRootLibrary();
1488 EXPECT_VALID(lib); 1445 EXPECT_VALID(lib);
1489 } 1446 }
1490 1447
1491
1492 TEST_CASE(IsolateReload_DanglingGetter_Instance) { 1448 TEST_CASE(IsolateReload_DanglingGetter_Instance) {
1493 const char* kScript = 1449 const char* kScript =
1494 "import 'test:isolate_reload_helper';\n" 1450 "import 'test:isolate_reload_helper';\n"
1495 "class C {\n" 1451 "class C {\n"
1496 " var x = 3;\n" 1452 " var x = 3;\n"
1497 " var y = 4;\n" 1453 " var y = 4;\n"
1498 "}\n" 1454 "}\n"
1499 "invoke(f) {\n" 1455 "invoke(f) {\n"
1500 " try {\n" 1456 " try {\n"
1501 " return f();\n" 1457 " return f();\n"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 1496
1541 EXPECT_STREQ( 1497 EXPECT_STREQ(
1542 "NoSuchMethodError: Class 'int' has no instance method 'call'. " 1498 "NoSuchMethodError: Class 'int' has no instance method 'call'. "
1543 "NoSuchMethodError: Class 'int' has no instance method 'call'.", 1499 "NoSuchMethodError: Class 'int' has no instance method 'call'.",
1544 SimpleInvokeStr(lib, "main")); 1500 SimpleInvokeStr(lib, "main"));
1545 1501
1546 lib = TestCase::GetReloadErrorOrRootLibrary(); 1502 lib = TestCase::GetReloadErrorOrRootLibrary();
1547 EXPECT_VALID(lib); 1503 EXPECT_VALID(lib);
1548 } 1504 }
1549 1505
1550
1551 TEST_CASE(IsolateReload_DanglingGetter_Class) { 1506 TEST_CASE(IsolateReload_DanglingGetter_Class) {
1552 const char* kScript = 1507 const char* kScript =
1553 "import 'test:isolate_reload_helper';\n" 1508 "import 'test:isolate_reload_helper';\n"
1554 "class C {\n" 1509 "class C {\n"
1555 " static var x;\n" 1510 " static var x;\n"
1556 " static var y;\n" 1511 " static var y;\n"
1557 "}\n" 1512 "}\n"
1558 "invoke(f) {\n" 1513 "invoke(f) {\n"
1559 " try {\n" 1514 " try {\n"
1560 " return f();\n" 1515 " return f();\n"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1601 1556
1602 EXPECT_STREQ( 1557 EXPECT_STREQ(
1603 "NoSuchMethodError: Class 'int' has no instance method 'call'. " 1558 "NoSuchMethodError: Class 'int' has no instance method 'call'. "
1604 "NoSuchMethodError: Class 'int' has no instance method 'call'.", 1559 "NoSuchMethodError: Class 'int' has no instance method 'call'.",
1605 SimpleInvokeStr(lib, "main")); 1560 SimpleInvokeStr(lib, "main"));
1606 1561
1607 lib = TestCase::GetReloadErrorOrRootLibrary(); 1562 lib = TestCase::GetReloadErrorOrRootLibrary();
1608 EXPECT_VALID(lib); 1563 EXPECT_VALID(lib);
1609 } 1564 }
1610 1565
1611
1612 static void IsolateReload_DanlingGetter_LibraryReload( 1566 static void IsolateReload_DanlingGetter_LibraryReload(
1613 Dart_NativeArguments native_args) { 1567 Dart_NativeArguments native_args) {
1614 const char* kImportScript2 = "var x;\n"; 1568 const char* kImportScript2 = "var x;\n";
1615 TestCase::AddTestLib("test:other", kImportScript2); 1569 TestCase::AddTestLib("test:other", kImportScript2);
1616 1570
1617 DART_CHECK_VALID(TestCase::TriggerReload()); 1571 DART_CHECK_VALID(TestCase::TriggerReload());
1618 } 1572 }
1619 1573
1620
1621 static Dart_NativeFunction IsolateReload_DanlingGetter_LibraryNativeResolver( 1574 static Dart_NativeFunction IsolateReload_DanlingGetter_LibraryNativeResolver(
1622 Dart_Handle name, 1575 Dart_Handle name,
1623 int num_of_arguments, 1576 int num_of_arguments,
1624 bool* auto_setup_scope) { 1577 bool* auto_setup_scope) {
1625 return IsolateReload_DanlingGetter_LibraryReload; 1578 return IsolateReload_DanlingGetter_LibraryReload;
1626 } 1579 }
1627 1580
1628
1629 TEST_CASE(IsolateReload_DanglingGetter_Library) { 1581 TEST_CASE(IsolateReload_DanglingGetter_Library) {
1630 const char* kImportScript = 1582 const char* kImportScript =
1631 "var x;\n" 1583 "var x;\n"
1632 "var y;\n"; 1584 "var y;\n";
1633 TestCase::AddTestLib("test:other", kImportScript); 1585 TestCase::AddTestLib("test:other", kImportScript);
1634 1586
1635 const char* kScript = 1587 const char* kScript =
1636 "import 'test:other' as prefix;\n" 1588 "import 'test:other' as prefix;\n"
1637 "reloadTest() native 'ReloadTest';\n" 1589 "reloadTest() native 'ReloadTest';\n"
1638 "invoke(f) {\n" 1590 "invoke(f) {\n"
(...skipping 21 matching lines...) Expand all
1660 TestCase::SetReloadTestScript(kScript); // Root library does not change. 1612 TestCase::SetReloadTestScript(kScript); // Root library does not change.
1661 1613
1662 EXPECT_STREQ("4 NoSuchMethodError: No top-level getter 'y' declared.", 1614 EXPECT_STREQ("4 NoSuchMethodError: No top-level getter 'y' declared.",
1663 SimpleInvokeStr(lib, "main")); 1615 SimpleInvokeStr(lib, "main"));
1664 1616
1665 lib = TestCase::GetReloadErrorOrRootLibrary(); 1617 lib = TestCase::GetReloadErrorOrRootLibrary();
1666 EXPECT_VALID(lib); 1618 EXPECT_VALID(lib);
1667 FLAG_support_deprecated_tearoff_syntax = false; 1619 FLAG_support_deprecated_tearoff_syntax = false;
1668 } 1620 }
1669 1621
1670
1671 TEST_CASE(IsolateReload_DanglingSetter_Instance) { 1622 TEST_CASE(IsolateReload_DanglingSetter_Instance) {
1672 const char* kScript = 1623 const char* kScript =
1673 "import 'test:isolate_reload_helper';\n" 1624 "import 'test:isolate_reload_helper';\n"
1674 "class C {\n" 1625 "class C {\n"
1675 " var x = 3;\n" 1626 " var x = 3;\n"
1676 " var y = 4;\n" 1627 " var y = 4;\n"
1677 "}\n" 1628 "}\n"
1678 "invoke(f, a) {\n" 1629 "invoke(f, a) {\n"
1679 " try {\n" 1630 " try {\n"
1680 " return f(a);\n" 1631 " return f(a);\n"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1719 TestCase::SetReloadTestScript(kReloadScript); 1670 TestCase::SetReloadTestScript(kReloadScript);
1720 1671
1721 EXPECT_STREQ("null NoSuchMethodError: Class 'C' has no instance setter 'y='.", 1672 EXPECT_STREQ("null NoSuchMethodError: Class 'C' has no instance setter 'y='.",
1722 SimpleInvokeStr(lib, "main")); 1673 SimpleInvokeStr(lib, "main"));
1723 1674
1724 lib = TestCase::GetReloadErrorOrRootLibrary(); 1675 lib = TestCase::GetReloadErrorOrRootLibrary();
1725 EXPECT_VALID(lib); 1676 EXPECT_VALID(lib);
1726 FLAG_support_deprecated_tearoff_syntax = false; 1677 FLAG_support_deprecated_tearoff_syntax = false;
1727 } 1678 }
1728 1679
1729
1730 TEST_CASE(IsolateReload_DanglingSetter_Class) { 1680 TEST_CASE(IsolateReload_DanglingSetter_Class) {
1731 const char* kScript = 1681 const char* kScript =
1732 "import 'test:isolate_reload_helper';\n" 1682 "import 'test:isolate_reload_helper';\n"
1733 "class C {\n" 1683 "class C {\n"
1734 " static var x;\n" 1684 " static var x;\n"
1735 " static var y;\n" 1685 " static var y;\n"
1736 "}\n" 1686 "}\n"
1737 "invoke(f, a) {\n" 1687 "invoke(f, a) {\n"
1738 " try {\n" 1688 " try {\n"
1739 " return f(a);\n" 1689 " return f(a);\n"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1782 EXPECT_STREQ( 1732 EXPECT_STREQ(
1783 "5 NoSuchMethodError: No static setter 'y=' declared in " 1733 "5 NoSuchMethodError: No static setter 'y=' declared in "
1784 "class 'C'.", 1734 "class 'C'.",
1785 SimpleInvokeStr(lib, "main")); 1735 SimpleInvokeStr(lib, "main"));
1786 1736
1787 lib = TestCase::GetReloadErrorOrRootLibrary(); 1737 lib = TestCase::GetReloadErrorOrRootLibrary();
1788 EXPECT_VALID(lib); 1738 EXPECT_VALID(lib);
1789 FLAG_support_deprecated_tearoff_syntax = false; 1739 FLAG_support_deprecated_tearoff_syntax = false;
1790 } 1740 }
1791 1741
1792
1793 static void IsolateReload_DanlingSetter_LibraryReload( 1742 static void IsolateReload_DanlingSetter_LibraryReload(
1794 Dart_NativeArguments native_args) { 1743 Dart_NativeArguments native_args) {
1795 const char* kImportScript2 = "var x;\n"; 1744 const char* kImportScript2 = "var x;\n";
1796 TestCase::AddTestLib("test:other", kImportScript2); 1745 TestCase::AddTestLib("test:other", kImportScript2);
1797 1746
1798 DART_CHECK_VALID(TestCase::TriggerReload()); 1747 DART_CHECK_VALID(TestCase::TriggerReload());
1799 } 1748 }
1800 1749
1801
1802 static Dart_NativeFunction IsolateReload_DanlingSetter_LibraryNativeResolver( 1750 static Dart_NativeFunction IsolateReload_DanlingSetter_LibraryNativeResolver(
1803 Dart_Handle name, 1751 Dart_Handle name,
1804 int num_of_arguments, 1752 int num_of_arguments,
1805 bool* auto_setup_scope) { 1753 bool* auto_setup_scope) {
1806 return IsolateReload_DanlingSetter_LibraryReload; 1754 return IsolateReload_DanlingSetter_LibraryReload;
1807 } 1755 }
1808 1756
1809
1810 TEST_CASE(IsolateReload_DanglingSetter_Library) { 1757 TEST_CASE(IsolateReload_DanglingSetter_Library) {
1811 const char* kImportScript = 1758 const char* kImportScript =
1812 "var x;\n" 1759 "var x;\n"
1813 "var y;\n"; 1760 "var y;\n";
1814 TestCase::AddTestLib("test:other", kImportScript); 1761 TestCase::AddTestLib("test:other", kImportScript);
1815 1762
1816 const char* kScript = 1763 const char* kScript =
1817 "import 'test:other' as prefix;\n" 1764 "import 'test:other' as prefix;\n"
1818 "reloadTest() native 'ReloadTest';\n" 1765 "reloadTest() native 'ReloadTest';\n"
1819 "invoke(f, a) {\n" 1766 "invoke(f, a) {\n"
(...skipping 21 matching lines...) Expand all
1841 TestCase::SetReloadTestScript(kScript); // Root library does not change. 1788 TestCase::SetReloadTestScript(kScript); // Root library does not change.
1842 1789
1843 EXPECT_STREQ("5 NoSuchMethodError: No top-level setter 'y=' declared.", 1790 EXPECT_STREQ("5 NoSuchMethodError: No top-level setter 'y=' declared.",
1844 SimpleInvokeStr(lib, "main")); 1791 SimpleInvokeStr(lib, "main"));
1845 1792
1846 lib = TestCase::GetReloadErrorOrRootLibrary(); 1793 lib = TestCase::GetReloadErrorOrRootLibrary();
1847 EXPECT_VALID(lib); 1794 EXPECT_VALID(lib);
1848 FLAG_support_deprecated_tearoff_syntax = false; 1795 FLAG_support_deprecated_tearoff_syntax = false;
1849 } 1796 }
1850 1797
1851
1852 TEST_CASE(IsolateReload_TearOff_AddArguments) { 1798 TEST_CASE(IsolateReload_TearOff_AddArguments) {
1853 const char* kScript = 1799 const char* kScript =
1854 "import 'test:isolate_reload_helper';\n" 1800 "import 'test:isolate_reload_helper';\n"
1855 "class C {\n" 1801 "class C {\n"
1856 " foo(x) => x;\n" 1802 " foo(x) => x;\n"
1857 "}\n" 1803 "}\n"
1858 "invoke(f, a) {\n" 1804 "invoke(f, a) {\n"
1859 " try {\n" 1805 " try {\n"
1860 " return f(a);\n" 1806 " return f(a);\n"
1861 " } catch (e) {\n" 1807 " } catch (e) {\n"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 1845
1900 EXPECT_STREQ( 1846 EXPECT_STREQ(
1901 "1 NoSuchMethodError: Class 'C' has no instance method " 1847 "1 NoSuchMethodError: Class 'C' has no instance method "
1902 "'foo' with matching arguments.", 1848 "'foo' with matching arguments.",
1903 SimpleInvokeStr(lib, "main")); 1849 SimpleInvokeStr(lib, "main"));
1904 1850
1905 lib = TestCase::GetReloadErrorOrRootLibrary(); 1851 lib = TestCase::GetReloadErrorOrRootLibrary();
1906 EXPECT_VALID(lib); 1852 EXPECT_VALID(lib);
1907 } 1853 }
1908 1854
1909
1910 TEST_CASE(IsolateReload_TearOff_AddArguments2) { 1855 TEST_CASE(IsolateReload_TearOff_AddArguments2) {
1911 const char* kScript = 1856 const char* kScript =
1912 "import 'test:isolate_reload_helper';\n" 1857 "import 'test:isolate_reload_helper';\n"
1913 "class C {\n" 1858 "class C {\n"
1914 " static foo(x) => x;\n" 1859 " static foo(x) => x;\n"
1915 "}\n" 1860 "}\n"
1916 "invoke(f, a) {\n" 1861 "invoke(f, a) {\n"
1917 " try {\n" 1862 " try {\n"
1918 " return f(a);\n" 1863 " return f(a);\n"
1919 " } catch (e) {\n" 1864 " } catch (e) {\n"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1955 1900
1956 EXPECT_STREQ( 1901 EXPECT_STREQ(
1957 "1 NoSuchMethodError: Closure call with mismatched arguments: " 1902 "1 NoSuchMethodError: Closure call with mismatched arguments: "
1958 "function 'C.foo'", 1903 "function 'C.foo'",
1959 SimpleInvokeStr(lib, "main")); 1904 SimpleInvokeStr(lib, "main"));
1960 1905
1961 lib = TestCase::GetReloadErrorOrRootLibrary(); 1906 lib = TestCase::GetReloadErrorOrRootLibrary();
1962 EXPECT_VALID(lib); 1907 EXPECT_VALID(lib);
1963 } 1908 }
1964 1909
1965
1966 TEST_CASE(IsolateReload_EnumEquality) { 1910 TEST_CASE(IsolateReload_EnumEquality) {
1967 const char* kScript = 1911 const char* kScript =
1968 "enum Fruit {\n" 1912 "enum Fruit {\n"
1969 " Apple,\n" 1913 " Apple,\n"
1970 " Banana,\n" 1914 " Banana,\n"
1971 "}\n" 1915 "}\n"
1972 "var x;\n" 1916 "var x;\n"
1973 "main() {\n" 1917 "main() {\n"
1974 " x = Fruit.Banana;\n" 1918 " x = Fruit.Banana;\n"
1975 " return Fruit.Apple.toString();\n" 1919 " return Fruit.Apple.toString();\n"
(...skipping 16 matching lines...) Expand all
1992 " } else {\n" 1936 " } else {\n"
1993 " return 'no';\n" 1937 " return 'no';\n"
1994 " }\n" 1938 " }\n"
1995 "}\n"; 1939 "}\n";
1996 1940
1997 lib = TestCase::ReloadTestScript(kReloadScript); 1941 lib = TestCase::ReloadTestScript(kReloadScript);
1998 EXPECT_VALID(lib); 1942 EXPECT_VALID(lib);
1999 EXPECT_STREQ("yes", SimpleInvokeStr(lib, "main")); 1943 EXPECT_STREQ("yes", SimpleInvokeStr(lib, "main"));
2000 } 1944 }
2001 1945
2002
2003 TEST_CASE(IsolateReload_EnumIdentical) { 1946 TEST_CASE(IsolateReload_EnumIdentical) {
2004 const char* kScript = 1947 const char* kScript =
2005 "enum Fruit {\n" 1948 "enum Fruit {\n"
2006 " Apple,\n" 1949 " Apple,\n"
2007 " Banana,\n" 1950 " Banana,\n"
2008 "}\n" 1951 "}\n"
2009 "var x;\n" 1952 "var x;\n"
2010 "main() {\n" 1953 "main() {\n"
2011 " x = Fruit.Banana;\n" 1954 " x = Fruit.Banana;\n"
2012 " return Fruit.Apple.toString();\n" 1955 " return Fruit.Apple.toString();\n"
(...skipping 15 matching lines...) Expand all
2028 " } else {\n" 1971 " } else {\n"
2029 " return 'no';\n" 1972 " return 'no';\n"
2030 " }\n" 1973 " }\n"
2031 "}\n"; 1974 "}\n";
2032 1975
2033 lib = TestCase::ReloadTestScript(kReloadScript); 1976 lib = TestCase::ReloadTestScript(kReloadScript);
2034 EXPECT_VALID(lib); 1977 EXPECT_VALID(lib);
2035 EXPECT_STREQ("yes", SimpleInvokeStr(lib, "main")); 1978 EXPECT_STREQ("yes", SimpleInvokeStr(lib, "main"));
2036 } 1979 }
2037 1980
2038
2039 TEST_CASE(IsolateReload_EnumReorderIdentical) { 1981 TEST_CASE(IsolateReload_EnumReorderIdentical) {
2040 const char* kScript = 1982 const char* kScript =
2041 "enum Fruit {\n" 1983 "enum Fruit {\n"
2042 " Apple,\n" 1984 " Apple,\n"
2043 " Banana,\n" 1985 " Banana,\n"
2044 "}\n" 1986 "}\n"
2045 "var x;\n" 1987 "var x;\n"
2046 "main() {\n" 1988 "main() {\n"
2047 " x = Fruit.Banana;\n" 1989 " x = Fruit.Banana;\n"
2048 " return Fruit.Apple.toString();\n" 1990 " return Fruit.Apple.toString();\n"
(...skipping 15 matching lines...) Expand all
2064 " } else {\n" 2006 " } else {\n"
2065 " return 'no';\n" 2007 " return 'no';\n"
2066 " }\n" 2008 " }\n"
2067 "}\n"; 2009 "}\n";
2068 2010
2069 lib = TestCase::ReloadTestScript(kReloadScript); 2011 lib = TestCase::ReloadTestScript(kReloadScript);
2070 EXPECT_VALID(lib); 2012 EXPECT_VALID(lib);
2071 EXPECT_STREQ("yes", SimpleInvokeStr(lib, "main")); 2013 EXPECT_STREQ("yes", SimpleInvokeStr(lib, "main"));
2072 } 2014 }
2073 2015
2074
2075 TEST_CASE(IsolateReload_EnumAddition) { 2016 TEST_CASE(IsolateReload_EnumAddition) {
2076 const char* kScript = 2017 const char* kScript =
2077 "enum Fruit {\n" 2018 "enum Fruit {\n"
2078 " Apple,\n" 2019 " Apple,\n"
2079 " Banana,\n" 2020 " Banana,\n"
2080 "}\n" 2021 "}\n"
2081 "var x;\n" 2022 "var x;\n"
2082 "main() {\n" 2023 "main() {\n"
2083 " return Fruit.Apple.toString();\n" 2024 " return Fruit.Apple.toString();\n"
2084 "}\n"; 2025 "}\n";
(...skipping 15 matching lines...) Expand all
2100 " r += '${Fruit.Banana.index}/${Fruit.Banana}';\n" 2041 " r += '${Fruit.Banana.index}/${Fruit.Banana}';\n"
2101 " return r;\n" 2042 " return r;\n"
2102 "}\n"; 2043 "}\n";
2103 2044
2104 lib = TestCase::ReloadTestScript(kReloadScript); 2045 lib = TestCase::ReloadTestScript(kReloadScript);
2105 EXPECT_VALID(lib); 2046 EXPECT_VALID(lib);
2106 EXPECT_STREQ("0/Fruit.Apple 1/Fruit.Cantalope 2/Fruit.Banana", 2047 EXPECT_STREQ("0/Fruit.Apple 1/Fruit.Cantalope 2/Fruit.Banana",
2107 SimpleInvokeStr(lib, "main")); 2048 SimpleInvokeStr(lib, "main"));
2108 } 2049 }
2109 2050
2110
2111 TEST_CASE(IsolateReload_EnumToNotEnum) { 2051 TEST_CASE(IsolateReload_EnumToNotEnum) {
2112 const char* kScript = 2052 const char* kScript =
2113 "enum Fruit {\n" 2053 "enum Fruit {\n"
2114 " Apple\n" 2054 " Apple\n"
2115 "}\n" 2055 "}\n"
2116 "main() {\n" 2056 "main() {\n"
2117 " return Fruit.Apple.toString();\n" 2057 " return Fruit.Apple.toString();\n"
2118 "}\n"; 2058 "}\n";
2119 2059
2120 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 2060 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
2121 EXPECT_VALID(lib); 2061 EXPECT_VALID(lib);
2122 EXPECT_STREQ("Fruit.Apple", SimpleInvokeStr(lib, "main")); 2062 EXPECT_STREQ("Fruit.Apple", SimpleInvokeStr(lib, "main"));
2123 2063
2124 const char* kReloadScript = 2064 const char* kReloadScript =
2125 "class Fruit {\n" 2065 "class Fruit {\n"
2126 " final int zero = 0;\n" 2066 " final int zero = 0;\n"
2127 "}\n" 2067 "}\n"
2128 "main() {\n" 2068 "main() {\n"
2129 "}\n"; 2069 "}\n";
2130 2070
2131 Dart_Handle result = TestCase::ReloadTestScript(kReloadScript); 2071 Dart_Handle result = TestCase::ReloadTestScript(kReloadScript);
2132 EXPECT_ERROR(result, "Enum class cannot be redefined to be a non-enum class"); 2072 EXPECT_ERROR(result, "Enum class cannot be redefined to be a non-enum class");
2133 } 2073 }
2134 2074
2135
2136 TEST_CASE(IsolateReload_NotEnumToEnum) { 2075 TEST_CASE(IsolateReload_NotEnumToEnum) {
2137 const char* kScript = 2076 const char* kScript =
2138 "class Fruit {\n" 2077 "class Fruit {\n"
2139 " final int zero = 0;\n" 2078 " final int zero = 0;\n"
2140 "}\n" 2079 "}\n"
2141 "main() {\n" 2080 "main() {\n"
2142 " return 'yes';\n" 2081 " return 'yes';\n"
2143 "}\n"; 2082 "}\n";
2144 2083
2145 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 2084 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
2146 EXPECT_VALID(lib); 2085 EXPECT_VALID(lib);
2147 EXPECT_STREQ("yes", SimpleInvokeStr(lib, "main")); 2086 EXPECT_STREQ("yes", SimpleInvokeStr(lib, "main"));
2148 2087
2149 const char* kReloadScript = 2088 const char* kReloadScript =
2150 "enum Fruit {\n" 2089 "enum Fruit {\n"
2151 " Apple\n" 2090 " Apple\n"
2152 "}\n" 2091 "}\n"
2153 "main() {\n" 2092 "main() {\n"
2154 " return Fruit.Apple.toString();\n" 2093 " return Fruit.Apple.toString();\n"
2155 "}\n"; 2094 "}\n";
2156 2095
2157 Dart_Handle result = TestCase::ReloadTestScript(kReloadScript); 2096 Dart_Handle result = TestCase::ReloadTestScript(kReloadScript);
2158 EXPECT_ERROR(result, "Class cannot be redefined to be a enum class"); 2097 EXPECT_ERROR(result, "Class cannot be redefined to be a enum class");
2159 } 2098 }
2160 2099
2161
2162 TEST_CASE(IsolateReload_EnumDelete) { 2100 TEST_CASE(IsolateReload_EnumDelete) {
2163 const char* kScript = 2101 const char* kScript =
2164 "enum Fruit {\n" 2102 "enum Fruit {\n"
2165 " Apple,\n" 2103 " Apple,\n"
2166 " Banana,\n" 2104 " Banana,\n"
2167 " Cantalope,\n" 2105 " Cantalope,\n"
2168 "}\n" 2106 "}\n"
2169 "var x;\n" 2107 "var x;\n"
2170 "main() {\n" 2108 "main() {\n"
2171 " x = Fruit.Cantalope;\n" 2109 " x = Fruit.Cantalope;\n"
(...skipping 17 matching lines...) Expand all
2189 " String r = '$x ${x.hashCode is int} ${x.index}';\n" 2127 " String r = '$x ${x.hashCode is int} ${x.index}';\n"
2190 " return r;\n" 2128 " return r;\n"
2191 "}\n"; 2129 "}\n";
2192 2130
2193 lib = TestCase::ReloadTestScript(kReloadScript); 2131 lib = TestCase::ReloadTestScript(kReloadScript);
2194 EXPECT_VALID(lib); 2132 EXPECT_VALID(lib);
2195 EXPECT_STREQ("Deleted enum value from Fruit true -1", 2133 EXPECT_STREQ("Deleted enum value from Fruit true -1",
2196 SimpleInvokeStr(lib, "main")); 2134 SimpleInvokeStr(lib, "main"));
2197 } 2135 }
2198 2136
2199
2200 TEST_CASE(IsolateReload_EnumIdentityReload) { 2137 TEST_CASE(IsolateReload_EnumIdentityReload) {
2201 const char* kScript = 2138 const char* kScript =
2202 "enum Fruit {\n" 2139 "enum Fruit {\n"
2203 " Apple,\n" 2140 " Apple,\n"
2204 " Banana,\n" 2141 " Banana,\n"
2205 " Cantalope,\n" 2142 " Cantalope,\n"
2206 "}\n" 2143 "}\n"
2207 "var x;\n" 2144 "var x;\n"
2208 "var y;\n" 2145 "var y;\n"
2209 "var z;\n" 2146 "var z;\n"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2248 " r += '${identical(w, Fruit.values[x[Fruit.Cantalope]])} ';\n" 2185 " r += '${identical(w, Fruit.values[x[Fruit.Cantalope]])} ';\n"
2249 " return r;\n" 2186 " return r;\n"
2250 "}\n"; 2187 "}\n";
2251 2188
2252 lib = TestCase::ReloadTestScript(kReloadScript); 2189 lib = TestCase::ReloadTestScript(kReloadScript);
2253 EXPECT_VALID(lib); 2190 EXPECT_VALID(lib);
2254 EXPECT_STREQ("true true true true true true true true true ", 2191 EXPECT_STREQ("true true true true true true true true true ",
2255 SimpleInvokeStr(lib, "main")); 2192 SimpleInvokeStr(lib, "main"));
2256 } 2193 }
2257 2194
2258
2259 TEST_CASE(IsolateReload_ConstantIdentical) { 2195 TEST_CASE(IsolateReload_ConstantIdentical) {
2260 const char* kScript = 2196 const char* kScript =
2261 "class Fruit {\n" 2197 "class Fruit {\n"
2262 " final String name;\n" 2198 " final String name;\n"
2263 " const Fruit(this.name);\n" 2199 " const Fruit(this.name);\n"
2264 " String toString() => name;\n" 2200 " String toString() => name;\n"
2265 "}\n" 2201 "}\n"
2266 "var x;\n" 2202 "var x;\n"
2267 "main() {\n" 2203 "main() {\n"
2268 " x = const Fruit('Pear');\n" 2204 " x = const Fruit('Pear');\n"
(...skipping 17 matching lines...) Expand all
2286 " } else {\n" 2222 " } else {\n"
2287 " return 'no';\n" 2223 " return 'no';\n"
2288 " }\n" 2224 " }\n"
2289 "}\n"; 2225 "}\n";
2290 2226
2291 lib = TestCase::ReloadTestScript(kReloadScript); 2227 lib = TestCase::ReloadTestScript(kReloadScript);
2292 EXPECT_VALID(lib); 2228 EXPECT_VALID(lib);
2293 EXPECT_STREQ("yes", SimpleInvokeStr(lib, "main")); 2229 EXPECT_STREQ("yes", SimpleInvokeStr(lib, "main"));
2294 } 2230 }
2295 2231
2296
2297 TEST_CASE(IsolateReload_EnumValuesToString) { 2232 TEST_CASE(IsolateReload_EnumValuesToString) {
2298 const char* kScript = 2233 const char* kScript =
2299 "enum Fruit {\n" 2234 "enum Fruit {\n"
2300 " Apple,\n" 2235 " Apple,\n"
2301 " Banana,\n" 2236 " Banana,\n"
2302 "}\n" 2237 "}\n"
2303 "var x;\n" 2238 "var x;\n"
2304 "main() {\n" 2239 "main() {\n"
2305 " String r = '';\n" 2240 " String r = '';\n"
2306 " r += Fruit.Apple.toString();\n" 2241 " r += Fruit.Apple.toString();\n"
(...skipping 24 matching lines...) Expand all
2331 " r += Fruit.Banana.toString();\n" 2266 " r += Fruit.Banana.toString();\n"
2332 " return r;\n" 2267 " return r;\n"
2333 "}\n"; 2268 "}\n";
2334 2269
2335 lib = TestCase::ReloadTestScript(kReloadScript); 2270 lib = TestCase::ReloadTestScript(kReloadScript);
2336 EXPECT_VALID(lib); 2271 EXPECT_VALID(lib);
2337 EXPECT_STREQ("Fruit.Apple Fruit.Cantalope Fruit.Banana", 2272 EXPECT_STREQ("Fruit.Apple Fruit.Cantalope Fruit.Banana",
2338 SimpleInvokeStr(lib, "main")); 2273 SimpleInvokeStr(lib, "main"));
2339 } 2274 }
2340 2275
2341
2342 TEST_CASE(IsolateReload_DirectSubclasses_Success) { 2276 TEST_CASE(IsolateReload_DirectSubclasses_Success) {
2343 Object& new_subclass = Object::Handle(); 2277 Object& new_subclass = Object::Handle();
2344 String& name = String::Handle(); 2278 String& name = String::Handle();
2345 2279
2346 // Lookup the Iterator class by name from the dart core library. 2280 // Lookup the Iterator class by name from the dart core library.
2347 ObjectStore* object_store = Isolate::Current()->object_store(); 2281 ObjectStore* object_store = Isolate::Current()->object_store();
2348 const Library& core_lib = Library::Handle(object_store->core_library()); 2282 const Library& core_lib = Library::Handle(object_store->core_library());
2349 name = String::New("Iterator"); 2283 name = String::New("Iterator");
2350 const Class& iterator_cls = Class::Handle(core_lib.LookupClass(name)); 2284 const Class& iterator_cls = Class::Handle(core_lib.LookupClass(name));
2351 2285
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2388 2322
2389 // Iterator still has only one non-core subclass (AIterator is gone). 2323 // Iterator still has only one non-core subclass (AIterator is gone).
2390 EXPECT_EQ(saved_subclass_count + 1, subclasses.Length()); 2324 EXPECT_EQ(saved_subclass_count + 1, subclasses.Length());
2391 2325
2392 // The new subclass is named BIterator. 2326 // The new subclass is named BIterator.
2393 new_subclass = subclasses.At(subclasses.Length() - 1); 2327 new_subclass = subclasses.At(subclasses.Length() - 1);
2394 name = Class::Cast(new_subclass).Name(); 2328 name = Class::Cast(new_subclass).Name();
2395 EXPECT_STREQ("BIterator", name.ToCString()); 2329 EXPECT_STREQ("BIterator", name.ToCString());
2396 } 2330 }
2397 2331
2398
2399 TEST_CASE(IsolateReload_DirectSubclasses_GhostSubclass) { 2332 TEST_CASE(IsolateReload_DirectSubclasses_GhostSubclass) {
2400 Object& new_subclass = Object::Handle(); 2333 Object& new_subclass = Object::Handle();
2401 String& name = String::Handle(); 2334 String& name = String::Handle();
2402 2335
2403 // Lookup the Iterator class by name from the dart core library. 2336 // Lookup the Iterator class by name from the dart core library.
2404 ObjectStore* object_store = Isolate::Current()->object_store(); 2337 ObjectStore* object_store = Isolate::Current()->object_store();
2405 const Library& core_lib = Library::Handle(object_store->core_library()); 2338 const Library& core_lib = Library::Handle(object_store->core_library());
2406 name = String::New("Iterator"); 2339 name = String::New("Iterator");
2407 const Class& iterator_cls = Class::Handle(core_lib.LookupClass(name)); 2340 const Class& iterator_cls = Class::Handle(core_lib.LookupClass(name));
2408 2341
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2447 // The non-core subclasses are AIterator and BIterator. 2380 // The non-core subclasses are AIterator and BIterator.
2448 new_subclass = subclasses.At(subclasses.Length() - 2); 2381 new_subclass = subclasses.At(subclasses.Length() - 2);
2449 name = Class::Cast(new_subclass).Name(); 2382 name = Class::Cast(new_subclass).Name();
2450 EXPECT_STREQ("AIterator", name.ToCString()); 2383 EXPECT_STREQ("AIterator", name.ToCString());
2451 2384
2452 new_subclass = subclasses.At(subclasses.Length() - 1); 2385 new_subclass = subclasses.At(subclasses.Length() - 1);
2453 name = Class::Cast(new_subclass).Name(); 2386 name = Class::Cast(new_subclass).Name();
2454 EXPECT_STREQ("BIterator", name.ToCString()); 2387 EXPECT_STREQ("BIterator", name.ToCString());
2455 } 2388 }
2456 2389
2457
2458 // Make sure that we restore the direct subclass info when we revert. 2390 // Make sure that we restore the direct subclass info when we revert.
2459 TEST_CASE(IsolateReload_DirectSubclasses_Failure) { 2391 TEST_CASE(IsolateReload_DirectSubclasses_Failure) {
2460 Object& new_subclass = Object::Handle(); 2392 Object& new_subclass = Object::Handle();
2461 String& name = String::Handle(); 2393 String& name = String::Handle();
2462 2394
2463 // Lookup the Iterator class by name from the dart core library. 2395 // Lookup the Iterator class by name from the dart core library.
2464 ObjectStore* object_store = Isolate::Current()->object_store(); 2396 ObjectStore* object_store = Isolate::Current()->object_store();
2465 const Library& core_lib = Library::Handle(object_store->core_library()); 2397 const Library& core_lib = Library::Handle(object_store->core_library());
2466 name = String::New("Iterator"); 2398 name = String::New("Iterator");
2467 const Class& iterator_cls = Class::Handle(core_lib.LookupClass(name)); 2399 const Class& iterator_cls = Class::Handle(core_lib.LookupClass(name));
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 // the list of subclasses, which would be bad. Make sure that 2447 // the list of subclasses, which would be bad. Make sure that
2516 // Iterator still has only one non-core subclass... 2448 // Iterator still has only one non-core subclass...
2517 EXPECT_EQ(saved_subclass_count + 1, subclasses.Length()); 2449 EXPECT_EQ(saved_subclass_count + 1, subclasses.Length());
2518 2450
2519 // ...and the non-core subclass is still named AIterator. 2451 // ...and the non-core subclass is still named AIterator.
2520 new_subclass = subclasses.At(subclasses.Length() - 1); 2452 new_subclass = subclasses.At(subclasses.Length() - 1);
2521 name = Class::Cast(new_subclass).Name(); 2453 name = Class::Cast(new_subclass).Name();
2522 EXPECT_STREQ("AIterator", name.ToCString()); 2454 EXPECT_STREQ("AIterator", name.ToCString());
2523 } 2455 }
2524 2456
2525
2526 // Tests reload succeeds when instance format changes. 2457 // Tests reload succeeds when instance format changes.
2527 // Change: Foo {a, b, c:42} -> Foo {c:42} 2458 // Change: Foo {a, b, c:42} -> Foo {c:42}
2528 // Validate: c keeps the value in the retained Foo object. 2459 // Validate: c keeps the value in the retained Foo object.
2529 TEST_CASE(IsolateReload_ChangeInstanceFormat0) { 2460 TEST_CASE(IsolateReload_ChangeInstanceFormat0) {
2530 const char* kScript = 2461 const char* kScript =
2531 "class Foo {\n" 2462 "class Foo {\n"
2532 " var a;\n" 2463 " var a;\n"
2533 " var b;\n" 2464 " var b;\n"
2534 " var c;\n" 2465 " var c;\n"
2535 "}\n" 2466 "}\n"
(...skipping 15 matching lines...) Expand all
2551 "var f;\n" 2482 "var f;\n"
2552 "main() {\n" 2483 "main() {\n"
2553 " return f.c;\n" 2484 " return f.c;\n"
2554 "}\n"; 2485 "}\n";
2555 2486
2556 lib = TestCase::ReloadTestScript(kReloadScript); 2487 lib = TestCase::ReloadTestScript(kReloadScript);
2557 EXPECT_VALID(lib); 2488 EXPECT_VALID(lib);
2558 EXPECT_EQ(42, SimpleInvoke(lib, "main")); 2489 EXPECT_EQ(42, SimpleInvoke(lib, "main"));
2559 } 2490 }
2560 2491
2561
2562 // Tests reload succeeds when instance format changes. 2492 // Tests reload succeeds when instance format changes.
2563 // Change: Foo {} -> Foo {c:null} 2493 // Change: Foo {} -> Foo {c:null}
2564 // Validate: c is initialized to null the retained Foo object. 2494 // Validate: c is initialized to null the retained Foo object.
2565 TEST_CASE(IsolateReload_ChangeInstanceFormat1) { 2495 TEST_CASE(IsolateReload_ChangeInstanceFormat1) {
2566 const char* kScript = 2496 const char* kScript =
2567 "class Foo {\n" 2497 "class Foo {\n"
2568 "}\n" 2498 "}\n"
2569 "var f;\n" 2499 "var f;\n"
2570 "main() {\n" 2500 "main() {\n"
2571 " f = new Foo();\n" 2501 " f = new Foo();\n"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2619 " } catch (e) {\n" 2549 " } catch (e) {\n"
2620 " return 24;\n" 2550 " return 24;\n"
2621 " }\n" 2551 " }\n"
2622 "}\n"; 2552 "}\n";
2623 2553
2624 lib = TestCase::ReloadTestScript(kReloadScript); 2554 lib = TestCase::ReloadTestScript(kReloadScript);
2625 EXPECT_VALID(lib); 2555 EXPECT_VALID(lib);
2626 EXPECT_EQ(24, SimpleInvoke(lib, "main")); 2556 EXPECT_EQ(24, SimpleInvoke(lib, "main"));
2627 } 2557 }
2628 2558
2629
2630 // Tests reload succeeds when instance format changes. 2559 // Tests reload succeeds when instance format changes.
2631 // Change: Foo {a, b, c:42, d} -> Foo {c:42, g} 2560 // Change: Foo {a, b, c:42, d} -> Foo {c:42, g}
2632 // Validate: c keeps the value in the retained Foo object. 2561 // Validate: c keeps the value in the retained Foo object.
2633 TEST_CASE(IsolateReload_ChangeInstanceFormat3) { 2562 TEST_CASE(IsolateReload_ChangeInstanceFormat3) {
2634 const char* kScript = 2563 const char* kScript =
2635 "class Foo<A,B> {\n" 2564 "class Foo<A,B> {\n"
2636 " var a;\n" 2565 " var a;\n"
2637 " var b;\n" 2566 " var b;\n"
2638 " var c;\n" 2567 " var c;\n"
2639 " var d;\n" 2568 " var d;\n"
(...skipping 20 matching lines...) Expand all
2660 "var f;\n" 2589 "var f;\n"
2661 "main() {\n" 2590 "main() {\n"
2662 " return f.c;\n" 2591 " return f.c;\n"
2663 "}\n"; 2592 "}\n";
2664 2593
2665 lib = TestCase::ReloadTestScript(kReloadScript); 2594 lib = TestCase::ReloadTestScript(kReloadScript);
2666 EXPECT_VALID(lib); 2595 EXPECT_VALID(lib);
2667 EXPECT_EQ(3, SimpleInvoke(lib, "main")); 2596 EXPECT_EQ(3, SimpleInvoke(lib, "main"));
2668 } 2597 }
2669 2598
2670
2671 // Tests reload succeeds when instance format changes. 2599 // Tests reload succeeds when instance format changes.
2672 // Change: Bar {c:42}, Foo : Bar {d, e} -> Foo {c:42} 2600 // Change: Bar {c:42}, Foo : Bar {d, e} -> Foo {c:42}
2673 // Validate: c keeps the value in the retained Foo object. 2601 // Validate: c keeps the value in the retained Foo object.
2674 TEST_CASE(IsolateReload_ChangeInstanceFormat4) { 2602 TEST_CASE(IsolateReload_ChangeInstanceFormat4) {
2675 const char* kScript = 2603 const char* kScript =
2676 "class Bar{\n" 2604 "class Bar{\n"
2677 " var c;\n" 2605 " var c;\n"
2678 "}\n" 2606 "}\n"
2679 "class Foo extends Bar{\n" 2607 "class Foo extends Bar{\n"
2680 " var d;\n" 2608 " var d;\n"
(...skipping 17 matching lines...) Expand all
2698 "var f;\n" 2626 "var f;\n"
2699 "main() {\n" 2627 "main() {\n"
2700 " return f.c;\n" 2628 " return f.c;\n"
2701 "}\n"; 2629 "}\n";
2702 2630
2703 lib = TestCase::ReloadTestScript(kReloadScript); 2631 lib = TestCase::ReloadTestScript(kReloadScript);
2704 EXPECT_VALID(lib); 2632 EXPECT_VALID(lib);
2705 EXPECT_EQ(44, SimpleInvoke(lib, "main")); 2633 EXPECT_EQ(44, SimpleInvoke(lib, "main"));
2706 } 2634 }
2707 2635
2708
2709 // Tests reload succeeds when instance format changes. 2636 // Tests reload succeeds when instance format changes.
2710 // Change: Bar {a, b}, Foo : Bar {c:42} -> Bar {c:42}, Foo : Bar {} 2637 // Change: Bar {a, b}, Foo : Bar {c:42} -> Bar {c:42}, Foo : Bar {}
2711 // Validate: c keeps the value in the retained Foo object. 2638 // Validate: c keeps the value in the retained Foo object.
2712 TEST_CASE(IsolateReload_ChangeInstanceFormat5) { 2639 TEST_CASE(IsolateReload_ChangeInstanceFormat5) {
2713 const char* kScript = 2640 const char* kScript =
2714 "class Bar{\n" 2641 "class Bar{\n"
2715 " var a;\n" 2642 " var a;\n"
2716 " var b;\n" 2643 " var b;\n"
2717 "}\n" 2644 "}\n"
2718 "class Foo extends Bar{\n" 2645 "class Foo extends Bar{\n"
(...skipping 19 matching lines...) Expand all
2738 "var f;\n" 2665 "var f;\n"
2739 "main() {\n" 2666 "main() {\n"
2740 " return f.c;\n" 2667 " return f.c;\n"
2741 "}\n"; 2668 "}\n";
2742 2669
2743 lib = TestCase::ReloadTestScript(kReloadScript); 2670 lib = TestCase::ReloadTestScript(kReloadScript);
2744 EXPECT_VALID(lib); 2671 EXPECT_VALID(lib);
2745 EXPECT_EQ(44, SimpleInvoke(lib, "main")); 2672 EXPECT_EQ(44, SimpleInvoke(lib, "main"));
2746 } 2673 }
2747 2674
2748
2749 // Tests reload fails when type parameters change. 2675 // Tests reload fails when type parameters change.
2750 // Change: Foo<A,B> {a, b} -> Foo<A> {a} 2676 // Change: Foo<A,B> {a, b} -> Foo<A> {a}
2751 // Validate: the right error message is returned. 2677 // Validate: the right error message is returned.
2752 TEST_CASE(IsolateReload_ChangeInstanceFormat6) { 2678 TEST_CASE(IsolateReload_ChangeInstanceFormat6) {
2753 const char* kScript = 2679 const char* kScript =
2754 "class Foo<A, B> {\n" 2680 "class Foo<A, B> {\n"
2755 " var a;\n" 2681 " var a;\n"
2756 " var b;\n" 2682 " var b;\n"
2757 "}\n" 2683 "}\n"
2758 "main() {\n" 2684 "main() {\n"
(...skipping 28 matching lines...) Expand all
2787 EXPECT_VALID(lib); 2713 EXPECT_VALID(lib);
2788 2714
2789 const char* kReloadScript = 2715 const char* kReloadScript =
2790 "class Foo<A> {\n" 2716 "class Foo<A> {\n"
2791 " var a;\n" 2717 " var a;\n"
2792 "}\n"; 2718 "}\n";
2793 lib = TestCase::ReloadTestScript(kReloadScript); 2719 lib = TestCase::ReloadTestScript(kReloadScript);
2794 EXPECT_VALID(lib); 2720 EXPECT_VALID(lib);
2795 } 2721 }
2796 2722
2797
2798 // Regression for handle sharing bug: Change the shape of two classes and see 2723 // Regression for handle sharing bug: Change the shape of two classes and see
2799 // that their instances don't change class. 2724 // that their instances don't change class.
2800 TEST_CASE(IsolateReload_ChangeInstanceFormat8) { 2725 TEST_CASE(IsolateReload_ChangeInstanceFormat8) {
2801 const char* kScript = 2726 const char* kScript =
2802 "class A{\n" 2727 "class A{\n"
2803 " var x;\n" 2728 " var x;\n"
2804 "}\n" 2729 "}\n"
2805 "class B {\n" 2730 "class B {\n"
2806 " var x, y, z, w;\n" 2731 " var x, y, z, w;\n"
2807 "}\n" 2732 "}\n"
(...skipping 18 matching lines...) Expand all
2826 "var a, b;\n" 2751 "var a, b;\n"
2827 "main() {\n" 2752 "main() {\n"
2828 " return '$a $b';\n" 2753 " return '$a $b';\n"
2829 "}\n"; 2754 "}\n";
2830 2755
2831 lib = TestCase::ReloadTestScript(kReloadScript); 2756 lib = TestCase::ReloadTestScript(kReloadScript);
2832 EXPECT_VALID(lib); 2757 EXPECT_VALID(lib);
2833 EXPECT_STREQ("Instance of 'A' Instance of 'B'", SimpleInvokeStr(lib, "main")); 2758 EXPECT_STREQ("Instance of 'A' Instance of 'B'", SimpleInvokeStr(lib, "main"));
2834 } 2759 }
2835 2760
2836
2837 TEST_CASE(IsolateReload_ShapeChangeRetainsHash) { 2761 TEST_CASE(IsolateReload_ShapeChangeRetainsHash) {
2838 const char* kScript = 2762 const char* kScript =
2839 "class A{\n" 2763 "class A{\n"
2840 " var x;\n" 2764 " var x;\n"
2841 "}\n" 2765 "}\n"
2842 "var a, hash1, hash2;\n" 2766 "var a, hash1, hash2;\n"
2843 "main() {\n" 2767 "main() {\n"
2844 " a = new A();\n" 2768 " a = new A();\n"
2845 " hash1 = a.hashCode;\n" 2769 " hash1 = a.hashCode;\n"
2846 " return 'okay';\n" 2770 " return 'okay';\n"
(...skipping 11 matching lines...) Expand all
2858 "main() {\n" 2782 "main() {\n"
2859 " hash2 = a.hashCode;\n" 2783 " hash2 = a.hashCode;\n"
2860 " return (hash1 == hash2).toString();\n" 2784 " return (hash1 == hash2).toString();\n"
2861 "}\n"; 2785 "}\n";
2862 2786
2863 lib = TestCase::ReloadTestScript(kReloadScript); 2787 lib = TestCase::ReloadTestScript(kReloadScript);
2864 EXPECT_VALID(lib); 2788 EXPECT_VALID(lib);
2865 EXPECT_STREQ("true", SimpleInvokeStr(lib, "main")); 2789 EXPECT_STREQ("true", SimpleInvokeStr(lib, "main"));
2866 } 2790 }
2867 2791
2868
2869 TEST_CASE(IsolateReload_StaticTearOffRetainsHash) { 2792 TEST_CASE(IsolateReload_StaticTearOffRetainsHash) {
2870 const char* kScript = 2793 const char* kScript =
2871 "foo() {}\n" 2794 "foo() {}\n"
2872 "var hash1, hash2;\n" 2795 "var hash1, hash2;\n"
2873 "main() {\n" 2796 "main() {\n"
2874 " hash1 = foo.hashCode;\n" 2797 " hash1 = foo.hashCode;\n"
2875 " return 'okay';\n" 2798 " return 'okay';\n"
2876 "}\n"; 2799 "}\n";
2877 2800
2878 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 2801 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
2879 EXPECT_VALID(lib); 2802 EXPECT_VALID(lib);
2880 EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main")); 2803 EXPECT_STREQ("okay", SimpleInvokeStr(lib, "main"));
2881 2804
2882 const char* kReloadScript = 2805 const char* kReloadScript =
2883 "foo() {}\n" 2806 "foo() {}\n"
2884 "var hash1, hash2;\n" 2807 "var hash1, hash2;\n"
2885 "main() {\n" 2808 "main() {\n"
2886 " hash2 = foo.hashCode;\n" 2809 " hash2 = foo.hashCode;\n"
2887 " return (hash1 == hash2).toString();\n" 2810 " return (hash1 == hash2).toString();\n"
2888 "}\n"; 2811 "}\n";
2889 2812
2890 lib = TestCase::ReloadTestScript(kReloadScript); 2813 lib = TestCase::ReloadTestScript(kReloadScript);
2891 EXPECT_VALID(lib); 2814 EXPECT_VALID(lib);
2892 EXPECT_STREQ("true", SimpleInvokeStr(lib, "main")); 2815 EXPECT_STREQ("true", SimpleInvokeStr(lib, "main"));
2893 } 2816 }
2894 2817
2895
2896 static bool NothingModifiedCallback(const char* url, int64_t since) { 2818 static bool NothingModifiedCallback(const char* url, int64_t since) {
2897 return false; 2819 return false;
2898 } 2820 }
2899 2821
2900
2901 TEST_CASE(IsolateReload_NoLibsModified) { 2822 TEST_CASE(IsolateReload_NoLibsModified) {
2902 const char* kImportScript = "importedFunc() => 'fancy';"; 2823 const char* kImportScript = "importedFunc() => 'fancy';";
2903 TestCase::AddTestLib("test:lib1", kImportScript); 2824 TestCase::AddTestLib("test:lib1", kImportScript);
2904 2825
2905 const char* kScript = 2826 const char* kScript =
2906 "import 'test:lib1';\n" 2827 "import 'test:lib1';\n"
2907 "main() {\n" 2828 "main() {\n"
2908 " return importedFunc() + ' feast';\n" 2829 " return importedFunc() + ' feast';\n"
2909 "}\n"; 2830 "}\n";
2910 2831
(...skipping 12 matching lines...) Expand all
2923 2844
2924 Dart_SetFileModifiedCallback(&NothingModifiedCallback); 2845 Dart_SetFileModifiedCallback(&NothingModifiedCallback);
2925 lib = TestCase::ReloadTestScript(kReloadScript); 2846 lib = TestCase::ReloadTestScript(kReloadScript);
2926 EXPECT_VALID(lib); 2847 EXPECT_VALID(lib);
2927 Dart_SetFileModifiedCallback(NULL); 2848 Dart_SetFileModifiedCallback(NULL);
2928 2849
2929 // No reload occurred because no files were "modified". 2850 // No reload occurred because no files were "modified".
2930 EXPECT_STREQ("fancy feast", SimpleInvokeStr(lib, "main")); 2851 EXPECT_STREQ("fancy feast", SimpleInvokeStr(lib, "main"));
2931 } 2852 }
2932 2853
2933
2934 static bool MainModifiedCallback(const char* url, int64_t since) { 2854 static bool MainModifiedCallback(const char* url, int64_t since) {
2935 if (strcmp(url, "test-lib") == 0) { 2855 if (strcmp(url, "test-lib") == 0) {
2936 return true; 2856 return true;
2937 } 2857 }
2938 return false; 2858 return false;
2939 } 2859 }
2940 2860
2941
2942 TEST_CASE(IsolateReload_MainLibModified) { 2861 TEST_CASE(IsolateReload_MainLibModified) {
2943 const char* kImportScript = "importedFunc() => 'fancy';"; 2862 const char* kImportScript = "importedFunc() => 'fancy';";
2944 TestCase::AddTestLib("test:lib1", kImportScript); 2863 TestCase::AddTestLib("test:lib1", kImportScript);
2945 2864
2946 const char* kScript = 2865 const char* kScript =
2947 "import 'test:lib1';\n" 2866 "import 'test:lib1';\n"
2948 "main() {\n" 2867 "main() {\n"
2949 " return importedFunc() + ' feast';\n" 2868 " return importedFunc() + ' feast';\n"
2950 "}\n"; 2869 "}\n";
2951 2870
(...skipping 12 matching lines...) Expand all
2964 2883
2965 Dart_SetFileModifiedCallback(&MainModifiedCallback); 2884 Dart_SetFileModifiedCallback(&MainModifiedCallback);
2966 lib = TestCase::ReloadTestScript(kReloadScript); 2885 lib = TestCase::ReloadTestScript(kReloadScript);
2967 EXPECT_VALID(lib); 2886 EXPECT_VALID(lib);
2968 Dart_SetFileModifiedCallback(NULL); 2887 Dart_SetFileModifiedCallback(NULL);
2969 2888
2970 // Imported library is not reloaded. 2889 // Imported library is not reloaded.
2971 EXPECT_STREQ("fancy pants", SimpleInvokeStr(lib, "main")); 2890 EXPECT_STREQ("fancy pants", SimpleInvokeStr(lib, "main"));
2972 } 2891 }
2973 2892
2974
2975 static bool ImportModifiedCallback(const char* url, int64_t since) { 2893 static bool ImportModifiedCallback(const char* url, int64_t since) {
2976 if (strcmp(url, "test:lib1") == 0) { 2894 if (strcmp(url, "test:lib1") == 0) {
2977 return true; 2895 return true;
2978 } 2896 }
2979 return false; 2897 return false;
2980 } 2898 }
2981 2899
2982
2983 TEST_CASE(IsolateReload_ImportedLibModified) { 2900 TEST_CASE(IsolateReload_ImportedLibModified) {
2984 const char* kImportScript = "importedFunc() => 'fancy';"; 2901 const char* kImportScript = "importedFunc() => 'fancy';";
2985 TestCase::AddTestLib("test:lib1", kImportScript); 2902 TestCase::AddTestLib("test:lib1", kImportScript);
2986 2903
2987 const char* kScript = 2904 const char* kScript =
2988 "import 'test:lib1';\n" 2905 "import 'test:lib1';\n"
2989 "main() {\n" 2906 "main() {\n"
2990 " return importedFunc() + ' feast';\n" 2907 " return importedFunc() + ' feast';\n"
2991 "}\n"; 2908 "}\n";
2992 2909
(...skipping 12 matching lines...) Expand all
3005 2922
3006 Dart_SetFileModifiedCallback(&ImportModifiedCallback); 2923 Dart_SetFileModifiedCallback(&ImportModifiedCallback);
3007 lib = TestCase::ReloadTestScript(kReloadScript); 2924 lib = TestCase::ReloadTestScript(kReloadScript);
3008 EXPECT_VALID(lib); 2925 EXPECT_VALID(lib);
3009 Dart_SetFileModifiedCallback(NULL); 2926 Dart_SetFileModifiedCallback(NULL);
3010 2927
3011 // Modification of an imported library propagates to the importing library. 2928 // Modification of an imported library propagates to the importing library.
3012 EXPECT_STREQ("bossy pants", SimpleInvokeStr(lib, "main")); 2929 EXPECT_STREQ("bossy pants", SimpleInvokeStr(lib, "main"));
3013 } 2930 }
3014 2931
3015
3016 TEST_CASE(IsolateReload_PrefixImportedLibModified) { 2932 TEST_CASE(IsolateReload_PrefixImportedLibModified) {
3017 const char* kImportScript = "importedFunc() => 'fancy';"; 2933 const char* kImportScript = "importedFunc() => 'fancy';";
3018 TestCase::AddTestLib("test:lib1", kImportScript); 2934 TestCase::AddTestLib("test:lib1", kImportScript);
3019 2935
3020 const char* kScript = 2936 const char* kScript =
3021 "import 'test:lib1' as cobra;\n" 2937 "import 'test:lib1' as cobra;\n"
3022 "main() {\n" 2938 "main() {\n"
3023 " return cobra.importedFunc() + ' feast';\n" 2939 " return cobra.importedFunc() + ' feast';\n"
3024 "}\n"; 2940 "}\n";
3025 2941
(...skipping 13 matching lines...) Expand all
3039 Dart_SetFileModifiedCallback(&ImportModifiedCallback); 2955 Dart_SetFileModifiedCallback(&ImportModifiedCallback);
3040 lib = TestCase::ReloadTestScript(kReloadScript); 2956 lib = TestCase::ReloadTestScript(kReloadScript);
3041 EXPECT_VALID(lib); 2957 EXPECT_VALID(lib);
3042 Dart_SetFileModifiedCallback(NULL); 2958 Dart_SetFileModifiedCallback(NULL);
3043 2959
3044 // Modification of an prefix-imported library propagates to the 2960 // Modification of an prefix-imported library propagates to the
3045 // importing library. 2961 // importing library.
3046 EXPECT_STREQ("bossy pants", SimpleInvokeStr(lib, "main")); 2962 EXPECT_STREQ("bossy pants", SimpleInvokeStr(lib, "main"));
3047 } 2963 }
3048 2964
3049
3050 static bool ExportModifiedCallback(const char* url, int64_t since) { 2965 static bool ExportModifiedCallback(const char* url, int64_t since) {
3051 if (strcmp(url, "test:exportlib") == 0) { 2966 if (strcmp(url, "test:exportlib") == 0) {
3052 return true; 2967 return true;
3053 } 2968 }
3054 return false; 2969 return false;
3055 } 2970 }
3056 2971
3057
3058 TEST_CASE(IsolateReload_ExportedLibModified) { 2972 TEST_CASE(IsolateReload_ExportedLibModified) {
3059 const char* kImportScript = "export 'test:exportlib';"; 2973 const char* kImportScript = "export 'test:exportlib';";
3060 TestCase::AddTestLib("test:importlib", kImportScript); 2974 TestCase::AddTestLib("test:importlib", kImportScript);
3061 2975
3062 const char* kExportScript = "exportedFunc() => 'fancy';"; 2976 const char* kExportScript = "exportedFunc() => 'fancy';";
3063 TestCase::AddTestLib("test:exportlib", kExportScript); 2977 TestCase::AddTestLib("test:exportlib", kExportScript);
3064 2978
3065 const char* kScript = 2979 const char* kScript =
3066 "import 'test:importlib';\n" 2980 "import 'test:importlib';\n"
3067 "main() {\n" 2981 "main() {\n"
(...skipping 15 matching lines...) Expand all
3083 2997
3084 Dart_SetFileModifiedCallback(&ExportModifiedCallback); 2998 Dart_SetFileModifiedCallback(&ExportModifiedCallback);
3085 lib = TestCase::ReloadTestScript(kReloadScript); 2999 lib = TestCase::ReloadTestScript(kReloadScript);
3086 EXPECT_VALID(lib); 3000 EXPECT_VALID(lib);
3087 Dart_SetFileModifiedCallback(NULL); 3001 Dart_SetFileModifiedCallback(NULL);
3088 3002
3089 // Modification of an exported library propagates. 3003 // Modification of an exported library propagates.
3090 EXPECT_STREQ("bossy pants", SimpleInvokeStr(lib, "main")); 3004 EXPECT_STREQ("bossy pants", SimpleInvokeStr(lib, "main"));
3091 } 3005 }
3092 3006
3093
3094 TEST_CASE(IsolateReload_SimpleConstFieldUpdate) { 3007 TEST_CASE(IsolateReload_SimpleConstFieldUpdate) {
3095 const char* kScript = 3008 const char* kScript =
3096 "const value = 'a';\n" 3009 "const value = 'a';\n"
3097 "main() {\n" 3010 "main() {\n"
3098 " return 'value=${value}';\n" 3011 " return 'value=${value}';\n"
3099 "}\n"; 3012 "}\n";
3100 3013
3101 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 3014 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
3102 EXPECT_VALID(lib); 3015 EXPECT_VALID(lib);
3103 EXPECT_STREQ("value=a", SimpleInvokeStr(lib, "main")); 3016 EXPECT_STREQ("value=a", SimpleInvokeStr(lib, "main"));
3104 3017
3105 const char* kReloadScript = 3018 const char* kReloadScript =
3106 "const value = 'b';\n" 3019 "const value = 'b';\n"
3107 "main() {\n" 3020 "main() {\n"
3108 " return 'value=${value}';\n" 3021 " return 'value=${value}';\n"
3109 "}\n"; 3022 "}\n";
3110 3023
3111 lib = TestCase::ReloadTestScript(kReloadScript); 3024 lib = TestCase::ReloadTestScript(kReloadScript);
3112 EXPECT_VALID(lib); 3025 EXPECT_VALID(lib);
3113 EXPECT_STREQ("value=b", SimpleInvokeStr(lib, "main")); 3026 EXPECT_STREQ("value=b", SimpleInvokeStr(lib, "main"));
3114 } 3027 }
3115 3028
3116
3117 TEST_CASE(IsolateReload_ConstFieldUpdate) { 3029 TEST_CASE(IsolateReload_ConstFieldUpdate) {
3118 const char* kScript = 3030 const char* kScript =
3119 "const value = const Duration(seconds: 1);\n" 3031 "const value = const Duration(seconds: 1);\n"
3120 "main() {\n" 3032 "main() {\n"
3121 " return 'value=${value}';\n" 3033 " return 'value=${value}';\n"
3122 "}\n"; 3034 "}\n";
3123 3035
3124 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 3036 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
3125 EXPECT_VALID(lib); 3037 EXPECT_VALID(lib);
3126 EXPECT_STREQ("value=0:00:01.000000", SimpleInvokeStr(lib, "main")); 3038 EXPECT_STREQ("value=0:00:01.000000", SimpleInvokeStr(lib, "main"));
3127 3039
3128 const char* kReloadScript = 3040 const char* kReloadScript =
3129 "const value = const Duration(seconds: 2);\n" 3041 "const value = const Duration(seconds: 2);\n"
3130 "main() {\n" 3042 "main() {\n"
3131 " return 'value=${value}';\n" 3043 " return 'value=${value}';\n"
3132 "}\n"; 3044 "}\n";
3133 3045
3134 lib = TestCase::ReloadTestScript(kReloadScript); 3046 lib = TestCase::ReloadTestScript(kReloadScript);
3135 EXPECT_VALID(lib); 3047 EXPECT_VALID(lib);
3136 EXPECT_STREQ("value=0:00:02.000000", SimpleInvokeStr(lib, "main")); 3048 EXPECT_STREQ("value=0:00:02.000000", SimpleInvokeStr(lib, "main"));
3137 } 3049 }
3138 3050
3139
3140 TEST_CASE(IsolateReload_RunNewFieldInitializers) { 3051 TEST_CASE(IsolateReload_RunNewFieldInitializers) {
3141 const char* kScript = 3052 const char* kScript =
3142 "class Foo {\n" 3053 "class Foo {\n"
3143 " int x = 4;\n" 3054 " int x = 4;\n"
3144 "}\n" 3055 "}\n"
3145 "Foo value;\n" 3056 "Foo value;\n"
3146 "main() {\n" 3057 "main() {\n"
3147 " value = new Foo();\n" 3058 " value = new Foo();\n"
3148 " return value.x;\n" 3059 " return value.x;\n"
3149 "}\n"; 3060 "}\n";
(...skipping 12 matching lines...) Expand all
3162 "main() {\n" 3073 "main() {\n"
3163 " return value.y;\n" 3074 " return value.y;\n"
3164 "}\n"; 3075 "}\n";
3165 3076
3166 lib = TestCase::ReloadTestScript(kReloadScript); 3077 lib = TestCase::ReloadTestScript(kReloadScript);
3167 EXPECT_VALID(lib); 3078 EXPECT_VALID(lib);
3168 // Verify that we ran field initializers on existing instances. 3079 // Verify that we ran field initializers on existing instances.
3169 EXPECT_EQ(7, SimpleInvoke(lib, "main")); 3080 EXPECT_EQ(7, SimpleInvoke(lib, "main"));
3170 } 3081 }
3171 3082
3172
3173 TEST_CASE(IsolateReload_RunNewFieldInitializersReferenceStaticField) { 3083 TEST_CASE(IsolateReload_RunNewFieldInitializersReferenceStaticField) {
3174 const char* kScript = 3084 const char* kScript =
3175 "int myInitialValue = 8 * 7;\n" 3085 "int myInitialValue = 8 * 7;\n"
3176 "class Foo {\n" 3086 "class Foo {\n"
3177 " int x = 4;\n" 3087 " int x = 4;\n"
3178 "}\n" 3088 "}\n"
3179 "Foo value;\n" 3089 "Foo value;\n"
3180 "main() {\n" 3090 "main() {\n"
3181 " value = new Foo();\n" 3091 " value = new Foo();\n"
3182 " return value.x;\n" 3092 " return value.x;\n"
(...skipping 14 matching lines...) Expand all
3197 "main() {\n" 3107 "main() {\n"
3198 " return value.y;\n" 3108 " return value.y;\n"
3199 "}\n"; 3109 "}\n";
3200 3110
3201 lib = TestCase::ReloadTestScript(kReloadScript); 3111 lib = TestCase::ReloadTestScript(kReloadScript);
3202 EXPECT_VALID(lib); 3112 EXPECT_VALID(lib);
3203 // Verify that we ran field initializers on existing instances. 3113 // Verify that we ran field initializers on existing instances.
3204 EXPECT_EQ(56, SimpleInvoke(lib, "main")); 3114 EXPECT_EQ(56, SimpleInvoke(lib, "main"));
3205 } 3115 }
3206 3116
3207
3208 TEST_CASE(IsolateReload_RunNewFieldInitializersMutateStaticField) { 3117 TEST_CASE(IsolateReload_RunNewFieldInitializersMutateStaticField) {
3209 const char* kScript = 3118 const char* kScript =
3210 "int myInitialValue = 8 * 7;\n" 3119 "int myInitialValue = 8 * 7;\n"
3211 "class Foo {\n" 3120 "class Foo {\n"
3212 " int x = 4;\n" 3121 " int x = 4;\n"
3213 "}\n" 3122 "}\n"
3214 "Foo value;\n" 3123 "Foo value;\n"
3215 "Foo value1;\n" 3124 "Foo value1;\n"
3216 "main() {\n" 3125 "main() {\n"
3217 " value = new Foo();\n" 3126 " value = new Foo();\n"
(...skipping 18 matching lines...) Expand all
3236 " return myInitialValue;\n" 3145 " return myInitialValue;\n"
3237 "}\n"; 3146 "}\n";
3238 3147
3239 lib = TestCase::ReloadTestScript(kReloadScript); 3148 lib = TestCase::ReloadTestScript(kReloadScript);
3240 EXPECT_VALID(lib); 3149 EXPECT_VALID(lib);
3241 // Verify that we ran field initializers on existing instances and that 3150 // Verify that we ran field initializers on existing instances and that
3242 // they affected the value of the field myInitialValue. 3151 // they affected the value of the field myInitialValue.
3243 EXPECT_EQ(58, SimpleInvoke(lib, "main")); 3152 EXPECT_EQ(58, SimpleInvoke(lib, "main"));
3244 } 3153 }
3245 3154
3246
3247 // When an initializer expression throws, we leave the field as null. 3155 // When an initializer expression throws, we leave the field as null.
3248 TEST_CASE(IsolateReload_RunNewFieldInitializersThrows) { 3156 TEST_CASE(IsolateReload_RunNewFieldInitializersThrows) {
3249 const char* kScript = 3157 const char* kScript =
3250 "class Foo {\n" 3158 "class Foo {\n"
3251 " int x = 4;\n" 3159 " int x = 4;\n"
3252 "}\n" 3160 "}\n"
3253 "Foo value;\n" 3161 "Foo value;\n"
3254 "main() {\n" 3162 "main() {\n"
3255 " value = new Foo();\n" 3163 " value = new Foo();\n"
3256 " return value.x;\n" 3164 " return value.x;\n"
(...skipping 13 matching lines...) Expand all
3270 "main() {\n" 3178 "main() {\n"
3271 " return '${value.y == null}';" 3179 " return '${value.y == null}';"
3272 "}\n"; 3180 "}\n";
3273 3181
3274 lib = TestCase::ReloadTestScript(kReloadScript); 3182 lib = TestCase::ReloadTestScript(kReloadScript);
3275 EXPECT_VALID(lib); 3183 EXPECT_VALID(lib);
3276 // Verify that we ran field initializers on existing instances. 3184 // Verify that we ran field initializers on existing instances.
3277 EXPECT_STREQ("true", SimpleInvokeStr(lib, "main")); 3185 EXPECT_STREQ("true", SimpleInvokeStr(lib, "main"));
3278 } 3186 }
3279 3187
3280
3281 // When an initializer expression has a syntax error, we detect it at reload 3188 // When an initializer expression has a syntax error, we detect it at reload
3282 // time. 3189 // time.
3283 TEST_CASE(IsolateReload_RunNewFieldInitializersSyntaxError) { 3190 TEST_CASE(IsolateReload_RunNewFieldInitializersSyntaxError) {
3284 const char* kScript = 3191 const char* kScript =
3285 "class Foo {\n" 3192 "class Foo {\n"
3286 " int x = 4;\n" 3193 " int x = 4;\n"
3287 "}\n" 3194 "}\n"
3288 "Foo value;\n" 3195 "Foo value;\n"
3289 "main() {\n" 3196 "main() {\n"
3290 " value = new Foo();\n" 3197 " value = new Foo();\n"
(...skipping 14 matching lines...) Expand all
3305 "main() {\n" 3212 "main() {\n"
3306 " return '${value.y == null}';" 3213 " return '${value.y == null}';"
3307 "}\n"; 3214 "}\n";
3308 3215
3309 // The reload fails because the initializing expression is parsed at 3216 // The reload fails because the initializing expression is parsed at
3310 // class finalization time. 3217 // class finalization time.
3311 lib = TestCase::ReloadTestScript(kReloadScript); 3218 lib = TestCase::ReloadTestScript(kReloadScript);
3312 EXPECT_ERROR(lib, "......"); 3219 EXPECT_ERROR(lib, "......");
3313 } 3220 }
3314 3221
3315
3316 // When an initializer expression has a syntax error, we detect it at reload 3222 // When an initializer expression has a syntax error, we detect it at reload
3317 // time. 3223 // time.
3318 TEST_CASE(IsolateReload_RunNewFieldInitializersSyntaxError2) { 3224 TEST_CASE(IsolateReload_RunNewFieldInitializersSyntaxError2) {
3319 const char* kScript = 3225 const char* kScript =
3320 "class Foo {\n" 3226 "class Foo {\n"
3321 " Foo() { /* default constructor */ }\n" 3227 " Foo() { /* default constructor */ }\n"
3322 " int x = 4;\n" 3228 " int x = 4;\n"
3323 "}\n" 3229 "}\n"
3324 "Foo value;\n" 3230 "Foo value;\n"
3325 "main() {\n" 3231 "main() {\n"
(...skipping 16 matching lines...) Expand all
3342 "main() {\n" 3248 "main() {\n"
3343 " return '${value.y == null}';" 3249 " return '${value.y == null}';"
3344 "}\n"; 3250 "}\n";
3345 3251
3346 // The reload fails because the initializing expression is parsed at 3252 // The reload fails because the initializing expression is parsed at
3347 // class finalization time. 3253 // class finalization time.
3348 lib = TestCase::ReloadTestScript(kReloadScript); 3254 lib = TestCase::ReloadTestScript(kReloadScript);
3349 EXPECT_ERROR(lib, "......"); 3255 EXPECT_ERROR(lib, "......");
3350 } 3256 }
3351 3257
3352
3353 // When an initializer expression has a syntax error, we detect it at reload 3258 // When an initializer expression has a syntax error, we detect it at reload
3354 // time. 3259 // time.
3355 TEST_CASE(IsolateReload_RunNewFieldInitializersSyntaxError3) { 3260 TEST_CASE(IsolateReload_RunNewFieldInitializersSyntaxError3) {
3356 const char* kScript = 3261 const char* kScript =
3357 "class Foo {\n" 3262 "class Foo {\n"
3358 " Foo() { /* default constructor */ }\n" 3263 " Foo() { /* default constructor */ }\n"
3359 " int x = 4;\n" 3264 " int x = 4;\n"
3360 "}\n" 3265 "}\n"
3361 "Foo value;\n" 3266 "Foo value;\n"
3362 "main() {\n" 3267 "main() {\n"
(...skipping 16 matching lines...) Expand all
3379 "main() {\n" 3284 "main() {\n"
3380 " return '${value.y == null}';" 3285 " return '${value.y == null}';"
3381 "}\n"; 3286 "}\n";
3382 3287
3383 // The reload fails because the initializing expression is parsed at 3288 // The reload fails because the initializing expression is parsed at
3384 // class finalization time. 3289 // class finalization time.
3385 lib = TestCase::ReloadTestScript(kReloadScript); 3290 lib = TestCase::ReloadTestScript(kReloadScript);
3386 EXPECT_ERROR(lib, "......"); 3291 EXPECT_ERROR(lib, "......");
3387 } 3292 }
3388 3293
3389
3390 TEST_CASE(IsolateReload_RunNewFieldInitialiazersSuperClass) { 3294 TEST_CASE(IsolateReload_RunNewFieldInitialiazersSuperClass) {
3391 const char* kScript = 3295 const char* kScript =
3392 "class Super {\n" 3296 "class Super {\n"
3393 " static var foo = 'right';\n" 3297 " static var foo = 'right';\n"
3394 "}\n" 3298 "}\n"
3395 "class Foo extends Super {\n" 3299 "class Foo extends Super {\n"
3396 " static var foo = 'wrong';\n" 3300 " static var foo = 'wrong';\n"
3397 "}\n" 3301 "}\n"
3398 "Foo value;\n" 3302 "Foo value;\n"
3399 "main() {\n" 3303 "main() {\n"
(...skipping 20 matching lines...) Expand all
3420 " return value.newField;\n" 3324 " return value.newField;\n"
3421 "}\n"; 3325 "}\n";
3422 3326
3423 lib = TestCase::ReloadTestScript(kReloadScript); 3327 lib = TestCase::ReloadTestScript(kReloadScript);
3424 EXPECT_VALID(lib); 3328 EXPECT_VALID(lib);
3425 // Verify that we ran field initializers on existing instances in the 3329 // Verify that we ran field initializers on existing instances in the
3426 // correct scope. 3330 // correct scope.
3427 EXPECT_STREQ("right", SimpleInvokeStr(lib, "main")); 3331 EXPECT_STREQ("right", SimpleInvokeStr(lib, "main"));
3428 } 3332 }
3429 3333
3430
3431 TEST_CASE(IsolateReload_TypedefToNotTypedef) { 3334 TEST_CASE(IsolateReload_TypedefToNotTypedef) {
3432 const char* kScript = 3335 const char* kScript =
3433 "typedef bool Predicate(dynamic x);\n" 3336 "typedef bool Predicate(dynamic x);\n"
3434 "main() {\n" 3337 "main() {\n"
3435 " return (42 is Predicate).toString();\n" 3338 " return (42 is Predicate).toString();\n"
3436 "}\n"; 3339 "}\n";
3437 3340
3438 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 3341 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
3439 EXPECT_VALID(lib); 3342 EXPECT_VALID(lib);
3440 EXPECT_STREQ("false", SimpleInvokeStr(lib, "main")); 3343 EXPECT_STREQ("false", SimpleInvokeStr(lib, "main"));
3441 3344
3442 const char* kReloadScript = 3345 const char* kReloadScript =
3443 "class Predicate {\n" 3346 "class Predicate {\n"
3444 " bool call(dynamic x) { return false; }\n" 3347 " bool call(dynamic x) { return false; }\n"
3445 "}\n" 3348 "}\n"
3446 "main() {\n" 3349 "main() {\n"
3447 " return (42 is Predicate).toString();\n" 3350 " return (42 is Predicate).toString();\n"
3448 "}\n"; 3351 "}\n";
3449 3352
3450 Dart_Handle result = TestCase::ReloadTestScript(kReloadScript); 3353 Dart_Handle result = TestCase::ReloadTestScript(kReloadScript);
3451 EXPECT_ERROR(result, 3354 EXPECT_ERROR(result,
3452 "Typedef class cannot be redefined to be a non-typedef class"); 3355 "Typedef class cannot be redefined to be a non-typedef class");
3453 } 3356 }
3454 3357
3455
3456 TEST_CASE(IsolateReload_NotTypedefToTypedef) { 3358 TEST_CASE(IsolateReload_NotTypedefToTypedef) {
3457 const char* kScript = 3359 const char* kScript =
3458 "class Predicate {\n" 3360 "class Predicate {\n"
3459 " bool call(dynamic x) { return false; }\n" 3361 " bool call(dynamic x) { return false; }\n"
3460 "}\n" 3362 "}\n"
3461 "main() {\n" 3363 "main() {\n"
3462 " return (42 is Predicate).toString();\n" 3364 " return (42 is Predicate).toString();\n"
3463 "}\n"; 3365 "}\n";
3464 3366
3465 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 3367 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
3466 EXPECT_VALID(lib); 3368 EXPECT_VALID(lib);
3467 EXPECT_STREQ("false", SimpleInvokeStr(lib, "main")); 3369 EXPECT_STREQ("false", SimpleInvokeStr(lib, "main"));
3468 3370
3469 const char* kReloadScript = 3371 const char* kReloadScript =
3470 "typedef bool Predicate(dynamic x);\n" 3372 "typedef bool Predicate(dynamic x);\n"
3471 "main() {\n" 3373 "main() {\n"
3472 " return (42 is Predicate).toString();\n" 3374 " return (42 is Predicate).toString();\n"
3473 "}\n"; 3375 "}\n";
3474 3376
3475 Dart_Handle result = TestCase::ReloadTestScript(kReloadScript); 3377 Dart_Handle result = TestCase::ReloadTestScript(kReloadScript);
3476 EXPECT_ERROR(result, "Class cannot be redefined to be a typedef class"); 3378 EXPECT_ERROR(result, "Class cannot be redefined to be a typedef class");
3477 } 3379 }
3478 3380
3479
3480 TEST_CASE(IsolateReload_TypedefAddParameter) { 3381 TEST_CASE(IsolateReload_TypedefAddParameter) {
3481 const char* kScript = 3382 const char* kScript =
3482 "typedef bool Predicate(dynamic x);\n" 3383 "typedef bool Predicate(dynamic x);\n"
3483 "main() {\n" 3384 "main() {\n"
3484 " bool foo(x) => true;\n" 3385 " bool foo(x) => true;\n"
3485 " return (foo is Predicate).toString();\n" 3386 " return (foo is Predicate).toString();\n"
3486 "}\n"; 3387 "}\n";
3487 3388
3488 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL); 3389 Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
3489 EXPECT_VALID(lib); 3390 EXPECT_VALID(lib);
3490 EXPECT_STREQ("true", SimpleInvokeStr(lib, "main")); 3391 EXPECT_STREQ("true", SimpleInvokeStr(lib, "main"));
3491 3392
3492 const char* kReloadScript = 3393 const char* kReloadScript =
3493 "typedef bool Predicate(dynamic x, dynamic y);\n" 3394 "typedef bool Predicate(dynamic x, dynamic y);\n"
3494 "main() {\n" 3395 "main() {\n"
3495 " bool foo(x) => true;\n" 3396 " bool foo(x) => true;\n"
3496 " return (foo is Predicate).toString();\n" 3397 " return (foo is Predicate).toString();\n"
3497 "}\n"; 3398 "}\n";
3498 3399
3499 Dart_Handle result = TestCase::ReloadTestScript(kReloadScript); 3400 Dart_Handle result = TestCase::ReloadTestScript(kReloadScript);
3500 EXPECT_VALID(result); 3401 EXPECT_VALID(result);
3501 EXPECT_STREQ("false", SimpleInvokeStr(lib, "main")); 3402 EXPECT_STREQ("false", SimpleInvokeStr(lib, "main"));
3502 } 3403 }
3503 3404
3504 #endif // !PRODUCT 3405 #endif // !PRODUCT
3505 3406
3506 } // namespace dart 3407 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate_reload.cc ('k') | runtime/vm/isolate_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698