OLD | NEW |
| (Empty) |
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | |
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.md file. | |
4 | |
5 library fletchc.test.tests_with_expectations; | |
6 | |
7 /// List of tests on this form: | |
8 /// | |
9 /// ``` | |
10 /// TEST_NAME | |
11 /// ==> a_test_file.dart <== | |
12 /// ... source code for a_test_file.dart ... | |
13 /// ==> another_test_file.dart.patch <== | |
14 /// ... source code for another_test_file.dart ... | |
15 /// ``` | |
16 /// | |
17 /// Filenames ending with ".patch" are special and are expanded into multiple | |
18 /// versions of a file. The parts of the file that vary between versions are | |
19 /// surrounded by `<<<<` and `>>>>` and the alternatives are separated by | |
20 /// `====`. For example: | |
21 /// | |
22 /// ``` | |
23 /// ==> file.txt.patch <== | |
24 /// first | |
25 /// <<<< "ex1" | |
26 /// v1 | |
27 /// ==== "ex2" | |
28 /// v2 | |
29 /// ==== "ex2" | |
30 /// v3 | |
31 /// >>>> | |
32 /// last | |
33 /// ``` | |
34 /// | |
35 /// Will produce three versions of a file named `file.txt.patch`: | |
36 /// | |
37 /// Version 1: | |
38 /// ``` | |
39 /// first | |
40 /// v1 | |
41 /// last | |
42 /// ``` | |
43 /// With expectation `ex1` | |
44 /// | |
45 /// Version 2: | |
46 /// ``` | |
47 /// first | |
48 /// v2 | |
49 /// last | |
50 /// ``` | |
51 /// | |
52 /// With expectation `ex2` | |
53 /// | |
54 /// Version 3: | |
55 /// ``` | |
56 /// first | |
57 /// v3 | |
58 /// last | |
59 /// ``` | |
60 /// | |
61 /// With expectation `ex3` | |
62 /// | |
63 /// | |
64 /// It is possible to have several independent changes in the same patch. One | |
65 /// should only specify the expectations once. For example: | |
66 /// | |
67 /// ==> main.dart.patch <== | |
68 /// class Foo { | |
69 /// <<<< "a" | |
70 /// ==== "b" | |
71 /// var bar; | |
72 /// >>>> | |
73 /// } | |
74 /// main() { | |
75 /// var foo = new Foo(); | |
76 /// <<<< | |
77 /// print("a"); | |
78 /// ==== | |
79 /// print("b"); | |
80 /// >>>> | |
81 /// } | |
82 /// | |
83 /// Expectations | |
84 /// ------------ | |
85 /// | |
86 /// An expectation is a JSON string. It is decoded and the resulting object, | |
87 /// `o`, is converted to a [ProgramExpectation] in the following way: | |
88 /// | |
89 /// * If `o` is a [String]: `new ProgramExpectation([o])`, otherwise | |
90 /// | |
91 /// * if `o` is a [List]: `new ProgramExpectation(o)`, otherwise | |
92 /// | |
93 /// * a new [ProgramExpectation] instance is instantiated with its fields | |
94 /// initialized to the corresponding properties of the JSON object. See | |
95 /// [ProgramExpectation.fromJson]. | |
96 const List<String> tests = const <String>[ | |
97 r''' | |
98 hello_world | |
99 ==> main.dart.patch <== | |
100 // Basic hello-world test | |
101 main() { print( | |
102 <<<< "Hello, World!" | |
103 'Hello, World!' | |
104 ==== "Hello, Brave New World!" | |
105 'Hello, Brave New World!' | |
106 >>>> | |
107 ); } | |
108 | |
109 ''', | |
110 | |
111 r''' | |
112 preserving_identity_hashcode | |
113 ==> main.dart.patch <== | |
114 class Foo { | |
115 <<<< "Generated firstHashCode" | |
116 ==== "firstHashCode == secondHashCode: true" | |
117 var bar; | |
118 >>>> | |
119 } | |
120 Foo foo; | |
121 int firstHashCode; | |
122 main() { | |
123 <<<< | |
124 foo = new Foo(); | |
125 firstHashCode = foo.hashCode; | |
126 print("Generated firstHashCode"); | |
127 ==== | |
128 int secondHashCode = foo.hashCode; | |
129 print("firstHashCode == secondHashCode: ${firstHashCode == secondHashCode}"); | |
130 >>>> | |
131 } | |
132 ''', | |
133 | |
134 // Test that we can do a program rewrite (which implies a big GC) while there | |
135 // are multiple processes alive that depend on the program. | |
136 r''' | |
137 program_gc_with_processes | |
138 ==> main.dart.patch <== | |
139 import 'dart:fletch'; | |
140 | |
141 class Comms { | |
142 <<<< "Setup" | |
143 ==== "Hello world" | |
144 int late_arrival; | |
145 >>>> | |
146 var paused; | |
147 var pausedPort; | |
148 var resumePort; | |
149 Process process; | |
150 } | |
151 | |
152 Comms comms; | |
153 | |
154 void SubProcess(Port pausedPort) { | |
155 // This function, used by the spawned processes, does not exist after the | |
156 // rewrite, but it will be on the stack, so it is kept alive across the GC. | |
157 var c = new Channel(); | |
158 pausedPort.send(new Port(c)); | |
159 c.receive(); | |
160 print("Hello world"); | |
161 } | |
162 | |
163 main() { | |
164 <<<< | |
165 // The setup takes place before the rewrite. | |
166 comms = new Comms(); | |
167 | |
168 comms.paused = new Channel(); | |
169 var pausedPort = comms.pausedPort = new Port(comms.paused); | |
170 | |
171 comms.process = Process.spawnDetached(() => SubProcess(pausedPort)); | |
172 | |
173 print("Setup"); | |
174 ==== | |
175 // After the rewrite we get the port from the sub-process and send the | |
176 // data it needs to resume running. | |
177 comms.resumePort = comms.paused.receive(); | |
178 | |
179 var monitor = new Channel(); | |
180 | |
181 comms.process.monitor(new Port(monitor)); | |
182 | |
183 comms.resumePort.send(null); | |
184 >>>> | |
185 } | |
186 ''', | |
187 | |
188 r''' | |
189 instance_field_end | |
190 ==> main.dart.patch <== | |
191 // Test that we can manipulate a field from an instance | |
192 // of a class from the end of the field list | |
193 class A { | |
194 var x; | |
195 <<<< "instance is null" | |
196 var y; | |
197 ==== "x = 0" | |
198 ==== "x = 0" | |
199 var y; | |
200 >>>> | |
201 } | |
202 | |
203 var instance; | |
204 | |
205 main() { | |
206 if (instance == null) { | |
207 print('instance is null'); | |
208 instance = new A(); | |
209 instance.x = 0; | |
210 } else { | |
211 print('x = ${instance.x}'); | |
212 } | |
213 } | |
214 ''', | |
215 | |
216 r''' | |
217 instance_field_middle | |
218 ==> main.dart.patch <== | |
219 // Test that we can manipulate a field from an instance | |
220 // of a class from the middle of the field list | |
221 class A { | |
222 var x; | |
223 <<<< "instance is null" | |
224 var y; | |
225 ==== "x = 0" | |
226 ==== ["x = 3","y = null","z = 2"] | |
227 var y; | |
228 >>>> | |
229 var z; | |
230 } | |
231 | |
232 var instance; | |
233 | |
234 main() { | |
235 if (instance == null) { | |
236 print('instance is null'); | |
237 instance = new A(); | |
238 instance.x = 0; | |
239 instance.y = 1; | |
240 instance.z = 2; | |
241 } else { | |
242 print('x = ${instance.x}'); | |
243 if (instance.x == 3) { | |
244 print('y = ${instance.y}'); | |
245 print('z = ${instance.z}'); | |
246 } | |
247 instance.x = 3; | |
248 } | |
249 } | |
250 ''', | |
251 | |
252 r''' | |
253 subclass_schema_1 | |
254 ==> main.dart.patch <== | |
255 // Test that schema changes affect subclasses correctly | |
256 class A { | |
257 var x; | |
258 <<<< "instance is null" | |
259 var y; | |
260 ==== "x = 0" | |
261 ==== ["x = 3","y = null","z = 2"] | |
262 var y; | |
263 >>>> | |
264 } | |
265 | |
266 class B extends A { | |
267 var z; | |
268 } | |
269 | |
270 var instance; | |
271 | |
272 main() { | |
273 if (instance == null) { | |
274 print('instance is null'); | |
275 instance = new B(); | |
276 instance.x = 0; | |
277 instance.y = 1; | |
278 instance.z = 2; | |
279 } else { | |
280 print('x = ${instance.x}'); | |
281 if (instance.x == 3) { | |
282 print('y = ${instance.y}'); | |
283 print('z = ${instance.z}'); | |
284 } | |
285 instance.x = 3; | |
286 } | |
287 } | |
288 ''', | |
289 | |
290 r''' | |
291 subclass_schema_2 | |
292 ==> main.dart.patch <== | |
293 // Test that schema changes affect subclasses of subclasses correctly | |
294 class A { | |
295 var x; | |
296 <<<< "instance is null" | |
297 var y; | |
298 ==== "x = 0" | |
299 ==== ["x = 3","y = null","z = 2"] | |
300 var y; | |
301 >>>> | |
302 } | |
303 | |
304 class B extends A { | |
305 } | |
306 | |
307 class C extends B { | |
308 var z; | |
309 } | |
310 | |
311 var instance; | |
312 | |
313 main() { | |
314 if (instance == null) { | |
315 print('instance is null'); | |
316 instance = new C(); | |
317 instance.x = 0; | |
318 instance.y = 1; | |
319 instance.z = 2; | |
320 } else { | |
321 print('x = ${instance.x}'); | |
322 if (instance.x == 3) { | |
323 print('y = ${instance.y}'); | |
324 print('z = ${instance.z}'); | |
325 } | |
326 instance.x = 3; | |
327 } | |
328 } | |
329 ''', | |
330 | |
331 r''' | |
332 super_schema | |
333 ==> main.dart.patch <== | |
334 // Test that schema changes work in the presence of fields in the superclass | |
335 class A { | |
336 var x; | |
337 } | |
338 | |
339 class B extends A { | |
340 <<<< "instance is null" | |
341 var y; | |
342 ==== "x = 0" | |
343 ==== ["x = 3","y = null","z = 2"] | |
344 var y; | |
345 >>>> | |
346 var z; | |
347 } | |
348 | |
349 var instance; | |
350 | |
351 main() { | |
352 if (instance == null) { | |
353 print('instance is null'); | |
354 instance = new B(); | |
355 instance.x = 0; | |
356 instance.y = 1; | |
357 instance.z = 2; | |
358 } else { | |
359 print('x = ${instance.x}'); | |
360 if (instance.x == 3) { | |
361 print('y = ${instance.y}'); | |
362 print('z = ${instance.z}'); | |
363 } | |
364 instance.x = 3; | |
365 } | |
366 } | |
367 ''', | |
368 | |
369 r''' | |
370 add_instance_field | |
371 ==> main.dart.patch <== | |
372 // Test adding a field to a class works | |
373 | |
374 class A { | |
375 <<<< ["instance is null","setter threw","getter threw"] | |
376 ==== "v2" | |
377 var x; | |
378 >>>> | |
379 } | |
380 | |
381 var instance; | |
382 | |
383 main() { | |
384 if (instance == null) { | |
385 print('instance is null'); | |
386 instance = new A(); | |
387 } | |
388 try { | |
389 instance.x = 'v2'; | |
390 } catch(e) { | |
391 print('setter threw'); | |
392 } | |
393 try { | |
394 print(instance.x); | |
395 } catch (e) { | |
396 print('getter threw'); | |
397 } | |
398 } | |
399 ''', | |
400 | |
401 r''' | |
402 remove_instance_field | |
403 ==> main.dart.patch <== | |
404 // Test removing a field from a class works | |
405 | |
406 class A { | |
407 <<<< ["instance is null","v1"] | |
408 var x; | |
409 ==== ["setter threw","getter threw"] | |
410 >>>> | |
411 } | |
412 | |
413 var instance; | |
414 | |
415 main() { | |
416 if (instance == null) { | |
417 print('instance is null'); | |
418 instance = new A(); | |
419 } | |
420 try { | |
421 instance.x = 'v1'; | |
422 } catch(e) { | |
423 print('setter threw'); | |
424 } | |
425 try { | |
426 print(instance.x); | |
427 } catch (e) { | |
428 print('getter threw'); | |
429 } | |
430 } | |
431 ''', | |
432 | |
433 r''' | |
434 two_updates | |
435 ==> main.dart.patch <== | |
436 // Test that the test framework handles more than one update | |
437 main() { print( | |
438 <<<< "Hello darkness, my old friend" | |
439 'Hello darkness, my old friend' | |
440 ==== "I've come to talk with you again" | |
441 'I\'ve come to talk with you again' | |
442 ==== "Because a vision softly creeping" | |
443 'Because a vision softly creeping' | |
444 >>>> | |
445 ); } | |
446 | |
447 ''', | |
448 | |
449 r''' | |
450 main_args | |
451 ==> main.dart.patch <== | |
452 // Test that that isolate support works | |
453 main(arguments) { print( | |
454 <<<< "Hello, Isolated World!" | |
455 'Hello, Isolated World!' | |
456 ==== "[]" | |
457 arguments | |
458 >>>> | |
459 ); } | |
460 | |
461 ''', | |
462 | |
463 r''' | |
464 stored_closure | |
465 ==> main.dart.patch <== | |
466 // Test that a stored closure changes behavior when updated | |
467 | |
468 var closure; | |
469 | |
470 foo(a, [b = 'b']) { | |
471 <<<< ["[closure] is null.","a b","a c"] | |
472 print('$a $b'); | |
473 ==== ["b a","c a"] | |
474 print('$b $a'); | |
475 >>>> | |
476 } | |
477 | |
478 main() { | |
479 if (closure == null) { | |
480 print('[closure] is null.'); | |
481 closure = foo; | |
482 } | |
483 closure('a'); | |
484 closure('a', 'c'); | |
485 } | |
486 | |
487 | |
488 ''', | |
489 | |
490 r''' | |
491 modify_static_method | |
492 ==> main.dart.patch <== | |
493 // Test modifying a static method works | |
494 | |
495 class C { | |
496 static m() { | |
497 <<<< "v1" | |
498 print('v1'); | |
499 ==== ["v2"] | |
500 print('v2'); | |
501 >>>> | |
502 } | |
503 } | |
504 main() { | |
505 C.m(); | |
506 } | |
507 | |
508 | |
509 ''', | |
510 | |
511 r''' | |
512 modify_instance_method | |
513 ==> main.dart.patch <== | |
514 // Test modifying an instance method works | |
515 | |
516 class C { | |
517 m() { | |
518 <<<< ["instance is null","v1"] | |
519 print('v1'); | |
520 ==== ["v2"] | |
521 print('v2'); | |
522 >>>> | |
523 } | |
524 } | |
525 var instance; | |
526 main() { | |
527 if (instance == null) { | |
528 print('instance is null'); | |
529 instance = new C(); | |
530 } | |
531 instance.m(); | |
532 } | |
533 | |
534 | |
535 ''', | |
536 | |
537 r''' | |
538 stored_instance_tearoff | |
539 ==> main.dart.patch <== | |
540 // Test that a stored instance tearoff changes behavior when updated | |
541 | |
542 class C { | |
543 m() { | |
544 <<<< ["closure is null","v1"] | |
545 print('v1'); | |
546 ==== "v2" | |
547 print('v2'); | |
548 >>>> | |
549 } | |
550 } | |
551 var closure; | |
552 main() { | |
553 if (closure == null) { | |
554 print('closure is null'); | |
555 closure = new C().m; | |
556 } | |
557 closure(); | |
558 } | |
559 | |
560 | |
561 ''', | |
562 | |
563 r''' | |
564 remove_instance_method | |
565 ==> main.dart.patch <== | |
566 // Test that deleting an instance method works | |
567 | |
568 class C { | |
569 <<<< ["instance is null","v1"] | |
570 m() { | |
571 print('v1'); | |
572 } | |
573 ==== {"messages":["threw"]} | |
574 >>>> | |
575 } | |
576 var instance; | |
577 main() { | |
578 if (instance == null) { | |
579 print('instance is null'); | |
580 instance = new C(); | |
581 } | |
582 try { | |
583 instance.m(); | |
584 } catch (e) { | |
585 print('threw'); | |
586 } | |
587 } | |
588 | |
589 | |
590 ''', | |
591 | |
592 r''' | |
593 remove_instance_method_super_access | |
594 ==> main.dart.patch <== | |
595 // Test that deleting an instance method works, even when accessed through | |
596 // super | |
597 | |
598 class A { | |
599 m() { | |
600 print('v2'); | |
601 } | |
602 } | |
603 class B extends A { | |
604 <<<< ["instance is null","v1"] | |
605 m() { | |
606 print('v1'); | |
607 } | |
608 ==== "v2" | |
609 >>>> | |
610 } | |
611 class C extends B { | |
612 m() { | |
613 super.m(); | |
614 } | |
615 } | |
616 var instance; | |
617 main() { | |
618 if (instance == null) { | |
619 print('instance is null'); | |
620 instance = new C(); | |
621 } | |
622 instance.m(); | |
623 } | |
624 | |
625 | |
626 ''', | |
627 | |
628 r''' | |
629 remove_top_level_method | |
630 ==> main.dart.patch <== | |
631 // Test that deleting a top-level method works | |
632 | |
633 <<<< ["instance is null","v1"] | |
634 toplevel() { | |
635 print('v1'); | |
636 } | |
637 ==== {"messages":["threw"]} | |
638 >>>> | |
639 class C { | |
640 m() { | |
641 try { | |
642 toplevel(); | |
643 } catch (e) { | |
644 print('threw'); | |
645 } | |
646 } | |
647 } | |
648 var instance; | |
649 main() { | |
650 if (instance == null) { | |
651 print('instance is null'); | |
652 instance = new C(); | |
653 } | |
654 instance.m(); | |
655 } | |
656 | |
657 | |
658 ''', | |
659 | |
660 r''' | |
661 remove_static_method | |
662 ==> main.dart.patch <== | |
663 // Test that deleting a static method works | |
664 | |
665 class B { | |
666 <<<< ["instance is null","v1"] | |
667 static staticMethod() { | |
668 print('v1'); | |
669 } | |
670 ==== "threw" | |
671 >>>> | |
672 } | |
673 class C { | |
674 m() { | |
675 try { | |
676 B.staticMethod(); | |
677 } catch (e) { | |
678 print('threw'); | |
679 } | |
680 try { | |
681 // Ensure that noSuchMethod support is compiled. This test is not about | |
682 // adding new classes. | |
683 B.missingMethod(); | |
684 print('bad'); | |
685 } catch (e) { | |
686 } | |
687 } | |
688 } | |
689 var instance; | |
690 main() { | |
691 new B(); // TODO(ahe): Work around dart2js assertion in World.subclassesOf | |
692 if (instance == null) { | |
693 print('instance is null'); | |
694 instance = new C(); | |
695 } | |
696 instance.m(); | |
697 } | |
698 | |
699 | |
700 ''', | |
701 | |
702 r''' | |
703 newly_instantiated_class | |
704 ==> main.dart.patch <== | |
705 // Test that a newly instantiated class is handled | |
706 | |
707 class A { | |
708 m() { | |
709 print('Called A.m'); | |
710 } | |
711 } | |
712 | |
713 class B { | |
714 m() { | |
715 print('Called B.m'); | |
716 } | |
717 } | |
718 | |
719 var instance; | |
720 main() { | |
721 if (instance == null) { | |
722 print('instance is null'); | |
723 instance = new A(); | |
724 <<<< ["instance is null","Called A.m"] | |
725 ==== ["Called B.m"] | |
726 } else { | |
727 instance = new B(); | |
728 >>>> | |
729 } | |
730 instance.m(); | |
731 } | |
732 | |
733 | |
734 ''', | |
735 | |
736 r''' | |
737 source_maps_no_throw | |
738 ==> main.dart.patch <== | |
739 // Test that source maps don't throw exceptions | |
740 | |
741 main() { | |
742 print('a'); | |
743 <<<< "a" | |
744 ==== ["a","b","c"] | |
745 print('b'); | |
746 print('c'); | |
747 >>>> | |
748 } | |
749 | |
750 | |
751 ''', | |
752 | |
753 r''' | |
754 newly_instantiated_class_X | |
755 ==> main.dart.patch <== | |
756 // Test that a newly instantiated class is handled | |
757 | |
758 // TODO(ahe): How is this different from the other test with same comment? | |
759 | |
760 class A { | |
761 get name => 'A.m'; | |
762 | |
763 m() { | |
764 print('Called $name'); | |
765 } | |
766 } | |
767 | |
768 class B extends A { | |
769 get name => 'B.m'; | |
770 } | |
771 | |
772 var instance; | |
773 main() { | |
774 if (instance == null) { | |
775 print('instance is null'); | |
776 instance = new A(); | |
777 <<<< ["instance is null","Called A.m"] | |
778 ==== ["Called B.m"] | |
779 } else { | |
780 instance = new B(); | |
781 >>>> | |
782 } | |
783 instance.m(); | |
784 } | |
785 | |
786 | |
787 ''', | |
788 | |
789 r''' | |
790 newly_instantiated_class_with_fields | |
791 ==> main.dart.patch <== | |
792 // Test that fields of a newly instantiated class are handled | |
793 | |
794 class A { | |
795 var x; | |
796 A(this.x); | |
797 } | |
798 var instance; | |
799 foo() { | |
800 if (instance != null) { | |
801 print(instance.x); | |
802 } else { | |
803 print('v1'); | |
804 } | |
805 } | |
806 main() { | |
807 <<<< "v1" | |
808 ==== "v2" | |
809 instance = new A('v2'); | |
810 >>>> | |
811 foo(); | |
812 } | |
813 | |
814 | |
815 ''', | |
816 | |
817 r''' | |
818 add_top_level_method | |
819 ==> main.dart.patch <== | |
820 // Test that top-level functions can be added | |
821 | |
822 <<<< "threw" | |
823 ==== "v2" | |
824 foo() { | |
825 print('v2'); | |
826 } | |
827 >>>> | |
828 main() { | |
829 try { | |
830 foo(); | |
831 } catch(e) { | |
832 print('threw'); | |
833 } | |
834 } | |
835 | |
836 | |
837 ''', | |
838 | |
839 r''' | |
840 add_static_method | |
841 ==> main.dart.patch <== | |
842 // Test that static methods can be added | |
843 | |
844 class C { | |
845 <<<< "threw" | |
846 ==== "v2" | |
847 static foo() { | |
848 print('v2'); | |
849 } | |
850 >>>> | |
851 } | |
852 | |
853 main() { | |
854 new C(); // TODO(ahe): Work around dart2js assertion in World.subclassesOf | |
855 try { | |
856 C.foo(); | |
857 } catch(e) { | |
858 print('threw'); | |
859 } | |
860 } | |
861 | |
862 | |
863 ''', | |
864 | |
865 r''' | |
866 add_instance_method | |
867 ==> main.dart.patch <== | |
868 // Test that instance methods can be added | |
869 | |
870 class C { | |
871 <<<< ["instance is null","threw"] | |
872 ==== ["v2"] | |
873 foo() { | |
874 print('v2'); | |
875 } | |
876 >>>> | |
877 } | |
878 | |
879 var instance; | |
880 | |
881 main() { | |
882 if (instance == null) { | |
883 print('instance is null'); | |
884 instance = new C(); | |
885 } | |
886 | |
887 try { | |
888 instance.foo(); | |
889 } catch(e) { | |
890 print('threw'); | |
891 } | |
892 } | |
893 | |
894 | |
895 ''', | |
896 | |
897 r''' | |
898 signature_change_top_level_method | |
899 ==> main.dart.patch <== | |
900 // Test that top-level functions can have signature changed | |
901 | |
902 <<<< "v1" | |
903 foo() { | |
904 print('v1'); | |
905 ==== {"messages":["v2"]} | |
906 void foo() { | |
907 print('v2'); | |
908 >>>> | |
909 } | |
910 | |
911 main() { | |
912 foo(); | |
913 } | |
914 | |
915 | |
916 ''', | |
917 | |
918 r''' | |
919 signature_change_static_method | |
920 ==> main.dart.patch <== | |
921 // Test that static methods can have signature changed | |
922 | |
923 class C { | |
924 <<<< "v1" | |
925 static foo() { | |
926 print('v1'); | |
927 ==== "v2" | |
928 static void foo() { | |
929 print('v2'); | |
930 >>>> | |
931 } | |
932 } | |
933 | |
934 main() { | |
935 new C(); // TODO(ahe): Work around dart2js assertion in World.subclassesOf | |
936 C.foo(); | |
937 } | |
938 | |
939 | |
940 ''', | |
941 | |
942 r''' | |
943 signature_change_instance_method | |
944 ==> main.dart.patch <== | |
945 // Test that instance methods can have signature changed | |
946 | |
947 class C { | |
948 <<<< ["instance is null","v1"] | |
949 foo() { | |
950 print('v1'); | |
951 ==== {"messages":["v2"]} | |
952 void foo() { | |
953 print('v2'); | |
954 >>>> | |
955 } | |
956 } | |
957 | |
958 var instance; | |
959 | |
960 main() { | |
961 if (instance == null) { | |
962 print('instance is null'); | |
963 instance = new C(); | |
964 } | |
965 | |
966 instance.foo(); | |
967 } | |
968 | |
969 | |
970 ''', | |
971 | |
972 r''' | |
973 signature_change_parameter_instance_method | |
974 ==> main.dart.patch <== | |
975 // Test that instance methods can have signature changed | |
976 | |
977 class C { | |
978 <<<< ["instance is null","v1"] | |
979 foo() { | |
980 print('v1'); | |
981 } | |
982 ==== "v2" | |
983 foo(int i) { | |
984 print('v2'); | |
985 } | |
986 >>>>> | |
987 } | |
988 var instance; | |
989 | |
990 main() { | |
991 if (instance == null) { | |
992 print('instance is null'); | |
993 instance = new C(); | |
994 instance.foo(); | |
995 } else { | |
996 instance.foo(1); | |
997 } | |
998 } | |
999 | |
1000 | |
1001 ''', | |
1002 | |
1003 r''' | |
1004 super_call_simple_change | |
1005 ==> main.dart.patch <== | |
1006 // Test that super calls are dispatched correctly | |
1007 class C { | |
1008 | |
1009 foo() { | |
1010 <<<< ["instance is null","v1"] | |
1011 print('v1'); | |
1012 ==== "v2" | |
1013 print('v2'); | |
1014 >>>>> | |
1015 } | |
1016 } | |
1017 | |
1018 class B extends C { | |
1019 bar() { | |
1020 super.foo(); | |
1021 } | |
1022 } | |
1023 | |
1024 var instance; | |
1025 | |
1026 main() { | |
1027 if (instance == null) { | |
1028 print('instance is null'); | |
1029 instance = new B(); | |
1030 } | |
1031 | |
1032 instance.bar(); | |
1033 } | |
1034 | |
1035 | |
1036 ''', | |
1037 | |
1038 r''' | |
1039 super_call_signature_change | |
1040 ==> main.dart.patch <== | |
1041 // Test that super calls are dispatched correctly | |
1042 class C { | |
1043 <<<< ["instance is null", "v1", "super.foo()", "super.foo(42) threw"] | |
1044 foo() { | |
1045 print('v1'); | |
1046 } | |
1047 ==== ["super.foo() threw", "v2", "super.foo(42)"] | |
1048 foo(int i) { | |
1049 print('v2'); | |
1050 } | |
1051 >>>>> | |
1052 } | |
1053 | |
1054 class B extends C { | |
1055 superFooNoArgs() => super.foo(); | |
1056 superFooOneArg(x) => super.foo(x); | |
1057 } | |
1058 | |
1059 var instance; | |
1060 | |
1061 main() { | |
1062 if (instance == null) { | |
1063 print('instance is null'); | |
1064 instance = new B(); | |
1065 } | |
1066 try { | |
1067 instance.superFooNoArgs(); | |
1068 print("super.foo()"); | |
1069 } catch (e) { | |
1070 print("super.foo() threw"); | |
1071 } | |
1072 try { | |
1073 instance.superFooOneArg(42); | |
1074 print("super.foo(42)"); | |
1075 } catch (e) { | |
1076 print("super.foo(42) threw"); | |
1077 } | |
1078 } | |
1079 | |
1080 | |
1081 ''', | |
1082 | |
1083 r''' | |
1084 add_class | |
1085 ==> main.dart.patch <== | |
1086 // Test that adding a class is supported | |
1087 | |
1088 <<<< "v1" | |
1089 ==== "v2" | |
1090 class C { | |
1091 void foo() { | |
1092 print('v2'); | |
1093 } | |
1094 } | |
1095 >>>> | |
1096 main() { | |
1097 <<<< | |
1098 print('v1'); | |
1099 | |
1100 ==== | |
1101 new C().foo(); | |
1102 >>>> | |
1103 } | |
1104 | |
1105 | |
1106 ''', | |
1107 | |
1108 r''' | |
1109 remove_class | |
1110 ==> main.dart.patch <== | |
1111 // Test that removing a class is supported, using constructor | |
1112 | |
1113 <<<< "v1" | |
1114 class C { | |
1115 } | |
1116 ==== {"messages":["v2"]} | |
1117 >>>> | |
1118 main() { | |
1119 try { | |
1120 new C(); | |
1121 print('v1'); | |
1122 } catch (e) { | |
1123 print('v2'); | |
1124 } | |
1125 } | |
1126 | |
1127 | |
1128 ''', | |
1129 | |
1130 r''' | |
1131 remove_class_with_static_method | |
1132 ==> main.dart.patch <== | |
1133 // Test that removing a class is supported, using a static method | |
1134 | |
1135 <<<< "v1" | |
1136 class C { | |
1137 static m() { | |
1138 print('v1'); | |
1139 } | |
1140 } | |
1141 ==== "v2" | |
1142 >>>> | |
1143 main() { | |
1144 try { | |
1145 C.m(); | |
1146 } catch (e) { | |
1147 print('v2'); | |
1148 } | |
1149 } | |
1150 | |
1151 | |
1152 ''', | |
1153 | |
1154 r''' | |
1155 change_supertype | |
1156 ==> main.dart.patch <== | |
1157 // Test that changing the supertype of a class works | |
1158 | |
1159 class A { | |
1160 m() { | |
1161 print('v2'); | |
1162 } | |
1163 } | |
1164 class B extends A { | |
1165 m() { | |
1166 print('v1'); | |
1167 } | |
1168 } | |
1169 <<<< ["instance is null","v1"] | |
1170 class C extends B { | |
1171 ==== ["v2"] | |
1172 class C extends A { | |
1173 >>>> | |
1174 m() { | |
1175 super.m(); | |
1176 } | |
1177 } | |
1178 | |
1179 var instance; | |
1180 | |
1181 main() { | |
1182 if (instance == null) { | |
1183 print('instance is null'); | |
1184 instance = new C(); | |
1185 } | |
1186 instance.m(); | |
1187 } | |
1188 | |
1189 | |
1190 ''', | |
1191 | |
1192 r''' | |
1193 call_named_arguments_1 | |
1194 ==> main.dart.patch <== | |
1195 // Test that named arguments can be called | |
1196 | |
1197 class C { | |
1198 foo({a, named: 'v1', x}) { | |
1199 print(named); | |
1200 } | |
1201 } | |
1202 | |
1203 var instance; | |
1204 | |
1205 main() { | |
1206 if (instance == null) { | |
1207 print('instance is null'); | |
1208 instance = new C(); | |
1209 } | |
1210 <<<< ["instance is null","v1"] | |
1211 instance.foo(); | |
1212 ==== ["v2"] | |
1213 instance.foo(named: 'v2'); | |
1214 >>>> | |
1215 } | |
1216 | |
1217 | |
1218 ''', | |
1219 | |
1220 r''' | |
1221 call_named_arguments_2 | |
1222 ==> main.dart.patch <== | |
1223 // Test that named arguments can be called | |
1224 | |
1225 class C { | |
1226 foo({a, named: 'v2', x}) { | |
1227 print(named); | |
1228 } | |
1229 } | |
1230 | |
1231 var instance; | |
1232 | |
1233 main() { | |
1234 if (instance == null) { | |
1235 print('instance is null'); | |
1236 instance = new C(); | |
1237 } | |
1238 <<<< ["instance is null","v1"] | |
1239 instance.foo(named: 'v1'); | |
1240 ==== ["v2"] | |
1241 instance.foo(); | |
1242 >>>> | |
1243 } | |
1244 | |
1245 | |
1246 ''', | |
1247 | |
1248 r''' | |
1249 call_named_arguments_from_instance_method | |
1250 ==> main.dart.patch <== | |
1251 // Similiar to call_named_arguments_2 but where the change in the way the method | |
1252 // with named parameters is called happens in an instance method belonging to | |
1253 // the same class. | |
1254 | |
1255 class C { | |
1256 foo({a: 'v2'}) { | |
1257 print(a); | |
1258 } | |
1259 | |
1260 bar() { | |
1261 <<<< ["instance is null", "v1"] | |
1262 foo(a: 'v1'); | |
1263 ==== "v2" | |
1264 foo(); | |
1265 >>>> | |
1266 } | |
1267 } | |
1268 | |
1269 var instance; | |
1270 | |
1271 main() { | |
1272 if (instance == null) { | |
1273 print('instance is null'); | |
1274 instance = new C(); | |
1275 } | |
1276 instance.bar(); | |
1277 } | |
1278 | |
1279 | |
1280 ''', | |
1281 | |
1282 r''' | |
1283 call_instance_tear_off_named | |
1284 ==> main.dart.patch <== | |
1285 // Test that an instance tear-off with named parameters can be called | |
1286 | |
1287 class C { | |
1288 foo({a, named: 'v1', x}) { | |
1289 print(named); | |
1290 } | |
1291 } | |
1292 | |
1293 var closure; | |
1294 | |
1295 main() { | |
1296 if (closure == null) { | |
1297 print('closure is null'); | |
1298 closure = new C().foo; | |
1299 } | |
1300 <<<< ["closure is null","v1"] | |
1301 closure(); | |
1302 ==== "v2" | |
1303 closure(named: 'v2'); | |
1304 >>>> | |
1305 } | |
1306 | |
1307 | |
1308 ''', | |
1309 | |
1310 r''' | |
1311 lazy_static | |
1312 ==> main.dart.patch <== | |
1313 // Test that a lazy static is supported | |
1314 | |
1315 var normal; | |
1316 | |
1317 <<<< "v1" | |
1318 foo() { | |
1319 print(normal); | |
1320 } | |
1321 ==== {"messages":["v2","lazy"],"compileUpdatesShouldThrow":1} | |
1322 // TODO(ahe): Should not throw. | |
1323 var lazy = bar(); | |
1324 | |
1325 foo() { | |
1326 print(lazy); | |
1327 } | |
1328 | |
1329 bar() { | |
1330 print('v2'); | |
1331 return 'lazy'; | |
1332 } | |
1333 | |
1334 >>>> | |
1335 main() { | |
1336 if (normal == null) { | |
1337 normal = 'v1'; | |
1338 } else { | |
1339 normal = ''; | |
1340 } | |
1341 foo(); | |
1342 } | |
1343 | |
1344 | |
1345 ''', | |
1346 | |
1347 r''' | |
1348 super_classes_of_directly_instantiated | |
1349 ==> main.dart.patch <== | |
1350 // Test that superclasses of directly instantiated classes are also emitted | |
1351 class A { | |
1352 } | |
1353 | |
1354 class B extends A { | |
1355 } | |
1356 | |
1357 main() { | |
1358 <<<< "v1" | |
1359 print('v1'); | |
1360 ==== "v2" | |
1361 new B(); | |
1362 print('v2'); | |
1363 >>>> | |
1364 } | |
1365 | |
1366 | |
1367 ''', | |
1368 | |
1369 r''' | |
1370 interceptor_classes | |
1371 ==> main.dart.patch <== | |
1372 // Test that interceptor classes are handled correctly | |
1373 | |
1374 main() { | |
1375 <<<< "v1" | |
1376 print('v1'); | |
1377 ==== "v2" | |
1378 ['v2'].forEach(print); | |
1379 >>>> | |
1380 } | |
1381 | |
1382 | |
1383 ''', | |
1384 | |
1385 r''' | |
1386 newly_instantiated_superclasses_two_updates | |
1387 ==> main.dart.patch <== | |
1388 // Test that newly instantiated superclasses are handled correctly when there | |
1389 // is more than one change | |
1390 | |
1391 class A { | |
1392 foo() { | |
1393 print('Called foo'); | |
1394 } | |
1395 | |
1396 bar() { | |
1397 print('Called bar'); | |
1398 } | |
1399 } | |
1400 | |
1401 class B extends A { | |
1402 } | |
1403 | |
1404 main() { | |
1405 <<<< "Called foo" | |
1406 new B().foo(); | |
1407 ==== "Called foo" | |
1408 new B().foo(); | |
1409 ==== "Called bar" | |
1410 new A().bar(); | |
1411 >>>> | |
1412 } | |
1413 | |
1414 | |
1415 ''', | |
1416 | |
1417 r''' | |
1418 newly_instantiated_subclases_two_updates | |
1419 ==> main.dart.patch <== | |
1420 // Test that newly instantiated subclasses are handled correctly when there is | |
1421 // more than one change | |
1422 | |
1423 class A { | |
1424 foo() { | |
1425 print('Called foo'); | |
1426 } | |
1427 | |
1428 bar() { | |
1429 print('Called bar'); | |
1430 } | |
1431 } | |
1432 | |
1433 class B extends A { | |
1434 } | |
1435 | |
1436 main() { | |
1437 <<<< "Called foo" | |
1438 new A().foo(); | |
1439 ==== "Called foo" | |
1440 new A().foo(); | |
1441 ==== "Called bar" | |
1442 new B().bar(); | |
1443 >>>> | |
1444 } | |
1445 | |
1446 | |
1447 ''', | |
1448 | |
1449 r''' | |
1450 constants | |
1451 ==> main.dart.patch <== | |
1452 // Test that constants are handled correctly | |
1453 | |
1454 class C { | |
1455 final String value; | |
1456 const C(this.value); | |
1457 } | |
1458 | |
1459 main() { | |
1460 <<<< "v1" | |
1461 print(const C('v1').value); | |
1462 ==== "v2" | |
1463 print(const C('v2').value); | |
1464 >>>> | |
1465 } | |
1466 | |
1467 | |
1468 ''', | |
1469 | |
1470 r''' | |
1471 constant_retaining | |
1472 ==> main.dart.patch <== | |
1473 // Test that constants are retained | |
1474 class Foo { | |
1475 const Foo(); | |
1476 } | |
1477 | |
1478 class Bar { | |
1479 final f = const Foo(); | |
1480 const Bar(); | |
1481 } | |
1482 | |
1483 class Baz { | |
1484 final f = const Foo(); | |
1485 const Baz(); | |
1486 } | |
1487 | |
1488 class C { | |
1489 foo() { | |
1490 <<<< ["true"] | |
1491 return const Foo(); | |
1492 ==== ["true"] | |
1493 return const Bar().f; | |
1494 ==== ["true"] | |
1495 return const Baz().f; | |
1496 >>>> | |
1497 } | |
1498 } | |
1499 | |
1500 void main() { | |
1501 var c = new C(); | |
1502 print(identical(c.foo(), const Foo())); | |
1503 } | |
1504 | |
1505 | |
1506 ''', | |
1507 | |
1508 r''' | |
1509 constant_retaining_2 | |
1510 ==> main.dart.patch <== | |
1511 // Test that constants are handled correctly when stored in a top-level | |
1512 // variable. | |
1513 var constant; | |
1514 | |
1515 class Foo { | |
1516 const Foo(); | |
1517 } | |
1518 | |
1519 class C { | |
1520 foo() { | |
1521 <<<< ["v1", "true"] | |
1522 print("v1"); | |
1523 constant = const Foo(); | |
1524 ==== ["v2", "true"] | |
1525 print("v2"); | |
1526 ==== ["v3", "true"] | |
1527 print("v3"); | |
1528 >>>> | |
1529 print(constant == const Foo()); | |
1530 } | |
1531 } | |
1532 | |
1533 main() { | |
1534 new C().foo(); | |
1535 } | |
1536 | |
1537 | |
1538 ''', | |
1539 | |
1540 r''' | |
1541 constant_retaining_3 | |
1542 ==> main.dart.patch <== | |
1543 // Similiar to constant_retaining_2, but tests that constant handling is still | |
1544 // correct even if an unrelated constant is introduced and removed again. | |
1545 var constant; | |
1546 | |
1547 class Foo { | |
1548 const Foo(); | |
1549 } | |
1550 | |
1551 class Bar { | |
1552 const Bar(); | |
1553 } | |
1554 | |
1555 class C { | |
1556 foo() { | |
1557 <<<< ["v1", "true"] | |
1558 print("v1"); | |
1559 constant = const Foo(); | |
1560 ==== ["v2", "false", "true"] | |
1561 print("v2"); | |
1562 print(constant == const Bar()); | |
1563 ==== ["v3", "true"] | |
1564 print("v3"); | |
1565 >>>> | |
1566 print(constant == const Foo()); | |
1567 } | |
1568 } | |
1569 | |
1570 main() { | |
1571 new C().foo(); | |
1572 } | |
1573 | |
1574 | |
1575 ''', | |
1576 | |
1577 r''' | |
1578 add_compound_instance_field | |
1579 ==> main.dart.patch <== | |
1580 // Test that an instance field can be added to a compound declaration | |
1581 | |
1582 class C { | |
1583 <<<< ["[instance] is null","v1","[instance.y] threw"] | |
1584 int x; | |
1585 ==== {"messages":["v1","v2"],"compileUpdatesShouldThrow":1} | |
1586 // TODO(ahe): Should not throw | |
1587 int x, y; | |
1588 >>>> | |
1589 } | |
1590 | |
1591 var instance; | |
1592 | |
1593 main() { | |
1594 if (instance == null) { | |
1595 print('[instance] is null'); | |
1596 instance = new C(); | |
1597 instance.x = 'v1'; | |
1598 } else { | |
1599 instance.y = 'v2'; | |
1600 } | |
1601 try { | |
1602 print(instance.x); | |
1603 } catch (e) { | |
1604 print('[instance.x] threw'); | |
1605 } | |
1606 try { | |
1607 print(instance.y); | |
1608 } catch (e) { | |
1609 print('[instance.y] threw'); | |
1610 } | |
1611 } | |
1612 | |
1613 | |
1614 ''', | |
1615 | |
1616 r''' | |
1617 remove_compound_instance_field | |
1618 ==> main.dart.patch <== | |
1619 // Test that an instance field can be removed from a compound declaration | |
1620 | |
1621 class C { | |
1622 <<<< ["[instance] is null","v1","v2"] | |
1623 int x, y; | |
1624 ==== {"messages":["v1","[instance.y] threw"],"compileUpdatesShouldThrow":1} | |
1625 // TODO(ahe): Should not throw | |
1626 int x; | |
1627 >>>> | |
1628 } | |
1629 | |
1630 var instance; | |
1631 | |
1632 main() { | |
1633 if (instance == null) { | |
1634 print('[instance] is null'); | |
1635 instance = new C(); | |
1636 instance.x = 'v1'; | |
1637 instance.y = 'v2'; | |
1638 } | |
1639 try { | |
1640 print(instance.x); | |
1641 } catch (e) { | |
1642 print('[instance.x] threw'); | |
1643 } | |
1644 try { | |
1645 print(instance.y); | |
1646 } catch (e) { | |
1647 print('[instance.y] threw'); | |
1648 } | |
1649 } | |
1650 | |
1651 | |
1652 ''', | |
1653 | |
1654 r''' | |
1655 static_field_to_instance_field | |
1656 ==> main.dart.patch <== | |
1657 // Test that a static field can be made an instance field | |
1658 | |
1659 class C { | |
1660 <<<< ["[instance] is null","v1","[instance.x] threw"] | |
1661 static int x; | |
1662 ==== {"messages":["[C.x] threw","v2"],"compileUpdatesShouldThrow":1} | |
1663 // TODO(ahe): Should not throw | |
1664 int x; | |
1665 >>>> | |
1666 } | |
1667 | |
1668 var instance; | |
1669 | |
1670 main() { | |
1671 if (instance == null) { | |
1672 print('[instance] is null'); | |
1673 instance = new C(); | |
1674 C.x = 'v1'; | |
1675 } else { | |
1676 instance.x = 'v2'; | |
1677 } | |
1678 try { | |
1679 print(C.x); | |
1680 } catch (e) { | |
1681 print('[C.x] threw'); | |
1682 } | |
1683 try { | |
1684 print(instance.x); | |
1685 } catch (e) { | |
1686 print('[instance.x] threw'); | |
1687 } | |
1688 } | |
1689 | |
1690 | |
1691 ''', | |
1692 | |
1693 r''' | |
1694 instance_field_to_static_field | |
1695 ==> main.dart.patch <== | |
1696 // Test that instance field can be made static | |
1697 | |
1698 class C { | |
1699 <<<< ["[instance] is null","[C.x] threw","v1"] | |
1700 int x; | |
1701 ==== {"messages":["v2","[instance.x] threw"],"compileUpdatesShouldThrow":1} | |
1702 // TODO(ahe): Should not throw | |
1703 static int x; | |
1704 >>>> | |
1705 } | |
1706 | |
1707 var instance; | |
1708 | |
1709 main() { | |
1710 if (instance == null) { | |
1711 print('[instance] is null'); | |
1712 instance = new C(); | |
1713 instance.x = 'v1'; | |
1714 } else { | |
1715 C.x = 'v2'; | |
1716 } | |
1717 try { | |
1718 print(C.x); | |
1719 } catch (e) { | |
1720 print('[C.x] threw'); | |
1721 } | |
1722 try { | |
1723 print(instance.x); | |
1724 } catch (e) { | |
1725 print('[instance.x] threw'); | |
1726 } | |
1727 } | |
1728 | |
1729 | |
1730 ''', | |
1731 | |
1732 r''' | |
1733 compound_constants | |
1734 ==> main.dart.patch <== | |
1735 // Test compound constants | |
1736 | |
1737 class A { | |
1738 final value; | |
1739 const A(this.value); | |
1740 | |
1741 toString() => 'A($value)'; | |
1742 } | |
1743 | |
1744 class B { | |
1745 final value; | |
1746 const B(this.value); | |
1747 | |
1748 toString() => 'B($value)'; | |
1749 } | |
1750 | |
1751 main() { | |
1752 <<<< ["A(v1)","B(v1)"] | |
1753 print(const A('v1')); | |
1754 print(const B('v1')); | |
1755 ==== ["B(A(v2))","A(B(v2))"] | |
1756 print(const B(const A('v2'))); | |
1757 print(const A(const B('v2'))); | |
1758 >>>> | |
1759 } | |
1760 | |
1761 | |
1762 ''', | |
1763 | |
1764 r''' | |
1765 constants_of_new_classes | |
1766 ==> main.dart.patch <== | |
1767 // Test constants of new classes | |
1768 | |
1769 class A { | |
1770 final value; | |
1771 const A(this.value); | |
1772 | |
1773 toString() => 'A($value)'; | |
1774 } | |
1775 <<<< "A(v1)" | |
1776 ==== ["A(v2)","B(v2)","B(A(v2))","A(B(v2))"] | |
1777 class B { | |
1778 final value; | |
1779 const B(this.value); | |
1780 | |
1781 toString() => 'B($value)'; | |
1782 } | |
1783 | |
1784 >>>> | |
1785 main() { | |
1786 <<<< | |
1787 print(const A('v1')); | |
1788 | |
1789 ==== | |
1790 print(const A('v2')); | |
1791 print(const B('v2')); | |
1792 print(const B(const A('v2'))); | |
1793 print(const A(const B('v2'))); | |
1794 >>>> | |
1795 } | |
1796 | |
1797 | |
1798 ''', | |
1799 | |
1800 r''' | |
1801 change_in_part | |
1802 ==> main.dart <== | |
1803 // Test that a change in a part is handled | |
1804 library test.main; | |
1805 | |
1806 part 'part.dart'; | |
1807 | |
1808 | |
1809 ==> part.dart.patch <== | |
1810 part of test.main; | |
1811 | |
1812 main() { | |
1813 <<<< "Hello, World!" | |
1814 print('Hello, World!'); | |
1815 ==== "Hello, Brave New World!" | |
1816 print('Hello, Brave New World!'); | |
1817 >>>> | |
1818 } | |
1819 ''', | |
1820 | |
1821 r''' | |
1822 change_library_name | |
1823 ==> main.dart.patch <== | |
1824 // Test that a change in library name is handled | |
1825 <<<< "Hello, World!" | |
1826 library test.main1; | |
1827 ==== {"messages":["Hello, World!"],"compileUpdatesShouldThrow":1} | |
1828 // TODO(ahe): Should not throw | |
1829 library test.main2; | |
1830 >>>> | |
1831 | |
1832 main() { | |
1833 print('Hello, World!'); | |
1834 } | |
1835 ''', | |
1836 | |
1837 r''' | |
1838 add_import | |
1839 ==> main.dart.patch <== | |
1840 // Test that adding an import is handled | |
1841 <<<< "Hello, World!" | |
1842 ==== {"messages":["Hello, World!"],"compileUpdatesShouldThrow":1} | |
1843 // TODO(ahe): Should not throw | |
1844 import 'dart:core'; | |
1845 >>>> | |
1846 | |
1847 main() { | |
1848 print('Hello, World!'); | |
1849 } | |
1850 ''', | |
1851 | |
1852 r''' | |
1853 add_export | |
1854 ==> main.dart.patch <== | |
1855 // Test that adding an export is handled | |
1856 <<<< "Hello, World!" | |
1857 ==== {"messages":["Hello, World!"],"compileUpdatesShouldThrow":1} | |
1858 // TODO(ahe): Should not throw | |
1859 export 'dart:core'; | |
1860 >>>> | |
1861 | |
1862 main() { | |
1863 print('Hello, World!'); | |
1864 } | |
1865 ''', | |
1866 | |
1867 r''' | |
1868 add_part | |
1869 ==> main.dart.patch <== | |
1870 // Test that adding a part is handled | |
1871 library test.main; | |
1872 | |
1873 <<<< "Hello, World!" | |
1874 ==== {"messages":["Hello, World!"],"compileUpdatesShouldThrow":1} | |
1875 // TODO(ahe): Should not throw | |
1876 part 'part.dart'; | |
1877 >>>> | |
1878 | |
1879 main() { | |
1880 print('Hello, World!'); | |
1881 } | |
1882 | |
1883 | |
1884 ==> part.dart <== | |
1885 part of test.main | |
1886 ''', | |
1887 | |
1888 r''' | |
1889 multiple_libraries | |
1890 ==> main.dart <== | |
1891 // Test that changes in multiple libraries is handled | |
1892 import 'library1.dart' as lib1; | |
1893 import 'library2.dart' as lib2; | |
1894 | |
1895 main() { | |
1896 lib1.method(); | |
1897 lib2.method(); | |
1898 } | |
1899 | |
1900 | |
1901 ==> library1.dart.patch <== | |
1902 library test.library1; | |
1903 | |
1904 method() { | |
1905 <<<< ["lib1.v1","lib2.v1"] | |
1906 print('lib1.v1'); | |
1907 ==== ["lib1.v2","lib2.v2"] | |
1908 print('lib1.v2'); | |
1909 ==== ["lib1.v3","lib2.v3"] | |
1910 print('lib1.v3'); | |
1911 >>>> | |
1912 } | |
1913 | |
1914 | |
1915 ==> library2.dart.patch <== | |
1916 library test.library2; | |
1917 | |
1918 method() { | |
1919 <<<< | |
1920 print('lib2.v1'); | |
1921 ==== | |
1922 print('lib2.v2'); | |
1923 ==== | |
1924 print('lib2.v3'); | |
1925 >>>> | |
1926 } | |
1927 ''', | |
1928 | |
1929 r''' | |
1930 bad_stack_trace_repro | |
1931 ==> main.dart.patch <== | |
1932 // Reproduces a problem where the stack trace includes an old method that | |
1933 // should have been removed by the incremental compiler | |
1934 main() { | |
1935 bar(); | |
1936 } | |
1937 | |
1938 bar() { | |
1939 <<<< [] | |
1940 foo(true); | |
1941 ==== [] | |
1942 foo(false); | |
1943 >>>> | |
1944 } | |
1945 | |
1946 foo(a) { | |
1947 if (a) throw "throw"; | |
1948 } | |
1949 ''', | |
1950 | |
1951 r''' | |
1952 compile_time_error_001 | |
1953 ==> main.dart.patch <== | |
1954 // Reproduce a crash when a compile-time error is added | |
1955 main() { | |
1956 <<<< [] | |
1957 ==== {"messages":[],"compileUpdatesShouldThrow":1} | |
1958 // TODO(ahe): compileUpdates shouldn't throw, a compile-time error should be | |
1959 // reported instead | |
1960 do for while if; | |
1961 >>>> | |
1962 } | |
1963 ''', | |
1964 | |
1965 r''' | |
1966 compile_time_error_002 | |
1967 ==> main.dart.patch <== | |
1968 // Reproduce a crash when a *recoverable* compile-time error is added | |
1969 main() { | |
1970 <<<< "fisk" | |
1971 print("fisk"); | |
1972 ==== {"messages":[],"hasCompileTimeError":1} | |
1973 new new(); | |
1974 >>>> | |
1975 } | |
1976 ''', | |
1977 | |
1978 r''' | |
1979 compile_time_error_003 | |
1980 ==> main.dart.patch <== | |
1981 // Reproduce a crash when a compile-time error is reported on a new class | |
1982 <<<< [] | |
1983 ==== {"messages":[],"compileUpdatesShouldThrow":1} | |
1984 // TODO(ahe): compileUpdates shouldn't throw, a compile-time error should be | |
1985 // reported instead | |
1986 abstract class A implements bool default F { | |
1987 A(); | |
1988 } | |
1989 >>>> | |
1990 | |
1991 class F { | |
1992 <<<< | |
1993 ==== | |
1994 factory A() { return null; } | |
1995 >>>> | |
1996 } | |
1997 | |
1998 main() { | |
1999 <<<< | |
2000 ==== | |
2001 new A(); | |
2002 >>>> | |
2003 } | |
2004 ''', | |
2005 | |
2006 r''' | |
2007 compile_time_error_004 | |
2008 ==> main.dart.patch <== | |
2009 // Reproduce a crash when a class has a bad hierarchy | |
2010 <<<< [] | |
2011 typedef A(C c); | |
2012 ==== {"messages":[],"compileUpdatesShouldThrow":1} | |
2013 // TODO(ahe): compileUpdates shouldn't throw, a compile-time error should be | |
2014 // reported instead | |
2015 typedef A(Class c); | |
2016 >>>> | |
2017 | |
2018 typedef B(A a); | |
2019 | |
2020 typedef C(B b); | |
2021 | |
2022 class Class { | |
2023 <<<< | |
2024 ==== | |
2025 A a; | |
2026 >>>> | |
2027 } | |
2028 | |
2029 void testA(A a) {} | |
2030 | |
2031 void main() { | |
2032 testA(null); | |
2033 } | |
2034 ''', | |
2035 | |
2036 r''' | |
2037 compile_time_error_005 | |
2038 ==> main.dart.patch <== | |
2039 // Regression for crash when attempting to reuse method with compile-time | |
2040 // error. | |
2041 main() { | |
2042 <<<< {"messages":[],"hasCompileTimeError":1} | |
2043 var funcnuf = (x) => ((x))=((x)) <= (x); | |
2044 ==== {"messages":["Hello"],"compileUpdatesShouldThrow":1} | |
2045 // TODO(ahe): Should not throw | |
2046 print("Hello"); | |
2047 >>>> | |
2048 } | |
2049 ''', | |
2050 | |
2051 r''' | |
2052 compile_time_error_006 | |
2053 ==> main.dart.patch <== | |
2054 <<<< "error" | |
2055 ==== {"messages":[],"compileUpdatesShouldThrow":1} | |
2056 // TODO(ahe): compileUpdates shouldn't throw, a compile-time error should be | |
2057 // reported instead | |
2058 test({b}) { | |
2059 if (?b) return b; | |
2060 } | |
2061 >>>> | |
2062 main() { | |
2063 try { | |
2064 test(b: 2); | |
2065 } catch (e) { | |
2066 print("error"); | |
2067 } | |
2068 } | |
2069 | |
2070 ''', | |
2071 | |
2072 r''' | |
2073 generic_types_001 | |
2074 ==> main.dart.patch <== | |
2075 // Test removing a generic class. | |
2076 <<<< [] | |
2077 class A<T> { | |
2078 } | |
2079 ==== {"messages":[],"compileUpdatesShouldThrow":1} | |
2080 // TODO(ahe): compileUpdates shouldn't throw, we should handle generic types | |
2081 // instead | |
2082 >>>> | |
2083 | |
2084 main() { | |
2085 <<<< | |
2086 new A(); | |
2087 ==== | |
2088 >>>> | |
2089 } | |
2090 ''', | |
2091 | |
2092 r''' | |
2093 generic_types_002 | |
2094 ==> main.dart.patch <== | |
2095 // Test adding a generic class. | |
2096 <<<< [] | |
2097 ==== {"messages":[],"compileUpdatesShouldThrow":1} | |
2098 // TODO(ahe): compileUpdates shouldn't throw, we should handle generic types | |
2099 // instead | |
2100 class A<T> { | |
2101 } | |
2102 >>>> | |
2103 | |
2104 main() { | |
2105 <<<< | |
2106 ==== | |
2107 new A(); | |
2108 >>>> | |
2109 } | |
2110 ''', | |
2111 | |
2112 r''' | |
2113 generic_types_003 | |
2114 ==> main.dart.patch <== | |
2115 // Test adding type variables to a class. | |
2116 <<<< [] | |
2117 class A { | |
2118 } | |
2119 ==== {"messages":[],"compileUpdatesShouldThrow":1} | |
2120 // TODO(ahe): compileUpdates shouldn't throw, we should handle generic types | |
2121 // instead | |
2122 class A<T> { | |
2123 } | |
2124 >>>> | |
2125 | |
2126 main() { | |
2127 new A(); | |
2128 } | |
2129 ''', | |
2130 | |
2131 r''' | |
2132 generic_types_004 | |
2133 ==> main.dart.patch <== | |
2134 // Test removing type variables from a class. | |
2135 <<<< [] | |
2136 class A<T> { | |
2137 } | |
2138 ==== {"messages":[],"compileUpdatesShouldThrow":1} | |
2139 // TODO(ahe): compileUpdates shouldn't throw, we should handle generic types | |
2140 // instead | |
2141 class A { | |
2142 } | |
2143 >>>> | |
2144 | |
2145 main() { | |
2146 new A(); | |
2147 } | |
2148 ''', | |
2149 | |
2150 r''' | |
2151 add_named_mixin_application | |
2152 ==> main.dart.patch <== | |
2153 // Test that we can add a mixin application. | |
2154 class A {} | |
2155 <<<< [] | |
2156 ==== {"messages":[],"compileUpdatesShouldThrow":1} | |
2157 // TODO(ahe): compileUpdates shouldn't throw, we should be able to handle named | |
2158 // mixin applications. | |
2159 class C = Object with A; | |
2160 >>>> | |
2161 main() { | |
2162 new A(); | |
2163 <<<< | |
2164 ==== | |
2165 new C(); | |
2166 >>>> | |
2167 } | |
2168 ''', | |
2169 | |
2170 r''' | |
2171 remove_named_mixin_application | |
2172 ==> main.dart.patch <== | |
2173 // Test that we can remove a mixin application. | |
2174 class A {} | |
2175 <<<< [] | |
2176 class C = Object with A; | |
2177 ==== {"messages":[],"compileUpdatesShouldThrow":1} | |
2178 // TODO(ahe): compileUpdates shouldn't throw, we should be able to handle named | |
2179 // mixin applications. | |
2180 >>>> | |
2181 main() { | |
2182 new A(); | |
2183 <<<< | |
2184 new C(); | |
2185 ==== | |
2186 >>>> | |
2187 } | |
2188 ''', | |
2189 | |
2190 r''' | |
2191 unchanged_named_mixin_application | |
2192 ==> main.dart.patch <== | |
2193 // Test that we can handle a mixin application that doesn't change. | |
2194 class A {} | |
2195 class C = Object with A; | |
2196 | |
2197 main() { | |
2198 new C(); | |
2199 <<<< [] | |
2200 ==== {"messages":[],"compileUpdatesShouldThrow":1} | |
2201 // TODO(ahe): compileUpdates shouldn't throw, we should be able to handle | |
2202 // named mixin applications. | |
2203 new C(); | |
2204 >>>> | |
2205 } | |
2206 ''', | |
2207 | |
2208 r''' | |
2209 bad_diagnostics | |
2210 ==> main.dart.patch <== | |
2211 // Test that our diagnostics handler doesn't crash | |
2212 main() { | |
2213 <<<< [] | |
2214 ==== [] | |
2215 // This is a long comment to guarantee that we have a position beyond the end | |
2216 // of the first version of this file. | |
2217 NoSuchClass c = null; // Provoke a warning to exercise the diagnostic handler. | |
2218 >>>> | |
2219 } | |
2220 ''', | |
2221 | |
2222 r''' | |
2223 super_is_parameter | |
2224 ==> main.dart.patch <== | |
2225 <<<< [] | |
2226 class A<S> { | |
2227 ==== {"messages":[],"compileUpdatesShouldThrow":1} | |
2228 // TODO(ahe): compileUpdates shouldn't throw. | |
2229 class A<S extends S> { | |
2230 >>>> | |
2231 S field; | |
2232 } | |
2233 | |
2234 class B<T> implements A<T> { | |
2235 T field; | |
2236 } | |
2237 | |
2238 main() { | |
2239 new B<int>(); | |
2240 } | |
2241 ''', | |
2242 | |
2243 r''' | |
2244 closure_capture | |
2245 ==> main.dart.patch <== | |
2246 main() { | |
2247 var a = "hello"; | |
2248 <<<< "hello" | |
2249 print(a); | |
2250 ==== {"messages":["hello from closure"],"compileUpdatesShouldThrow":1} | |
2251 // TODO(ahe): compileUpdates shouldn't throw, we should be able to handle | |
2252 // capture variables in closures. | |
2253 (() => print('$a from closure'))(); | |
2254 >>>> | |
2255 } | |
2256 ''', | |
2257 | |
2258 r''' | |
2259 add_top_level_const_field | |
2260 ==> main.dart.patch <== | |
2261 // Test that we can add a top-level field. | |
2262 <<<< "0" | |
2263 ==== "1" | |
2264 const c = 1; | |
2265 >>>> | |
2266 | |
2267 main() { | |
2268 <<<< | |
2269 print(0); | |
2270 ==== | |
2271 print(c); | |
2272 >>>> | |
2273 } | |
2274 ''', | |
2275 | |
2276 r''' | |
2277 remove_class_with_field_and_subclass | |
2278 ==> main.dart.patch <== | |
2279 <<<< [] | |
2280 class A { | |
2281 var x; | |
2282 } | |
2283 | |
2284 class B extends A { | |
2285 } | |
2286 ==== [] | |
2287 >>>> | |
2288 | |
2289 main() { | |
2290 <<<< | |
2291 new B(); | |
2292 ==== | |
2293 >>>> | |
2294 } | |
2295 ''', | |
2296 | |
2297 r''' | |
2298 fix_compile_time_error_in_field | |
2299 ==> main.dart.patch <== | |
2300 // Regression test for a bad assertion in dart2js (can't compute subclasses of | |
2301 // C because C isn't recorded as instantiated, which it really is, it's just | |
2302 // that a compile-time error was encountered when attempting to resolve C). | |
2303 class C { | |
2304 <<<< {"messages":[],"hasCompileTimeError":1} | |
2305 int sync*; | |
2306 ==== {"messages":[],"hasCompileTimeError":1} | |
2307 // TODO(ahe): There's no compile-time error here | |
2308 int sync; | |
2309 >>>> | |
2310 } | |
2311 main() { | |
2312 new C(); | |
2313 } | |
2314 ''', | |
2315 | |
2316 r''' | |
2317 compile_time_error_partial_file | |
2318 ==> main.dart.patch <== | |
2319 // Regression test for problem noticed when a mistake was made in | |
2320 // fix_compile_time_error_in_field. | |
2321 class C { | |
2322 <<<< {"messages":[],"hasCompileTimeError":1} | |
2323 int sync*; | |
2324 ==== {"messages":[],"compileUpdatesShouldThrow":1} | |
2325 // TODO(ahe): compileUpdates should not throw. | |
2326 int sync; | |
2327 } | |
2328 main() { | |
2329 new C(); | |
2330 } | |
2331 >>>> | |
2332 ''', | |
2333 | |
2334 r''' | |
2335 compile_time_error_field_becomes_removed_function | |
2336 ==> main.dart.patch <== | |
2337 // Regression test for a syntax error in a field becomes a function that is | |
2338 // subsequently removed. | |
2339 class C { | |
2340 <<<< {"messages":[],"hasCompileTimeError":1} | |
2341 int sync*; | |
2342 ==== {"messages":[],"hasCompileTimeError":1} | |
2343 // TODO(ahe): Should just expect [], no compile-time error | |
2344 sync(); | |
2345 ==== {"messages":[],"hasCompileTimeError":1} | |
2346 // TODO(ahe): Should just expect [], no compile-time error | |
2347 >>>> | |
2348 } | |
2349 main() { | |
2350 new C(); | |
2351 } | |
2352 ''', | |
2353 | |
2354 r''' | |
2355 add_field_and_remove_subclass | |
2356 ==> main.dart.patch <== | |
2357 // Regression test for what happens when a field is added at the same time a | |
2358 // class is removed. | |
2359 class A { | |
2360 <<<< [] | |
2361 ==== [] | |
2362 var field; | |
2363 >>>> | |
2364 } | |
2365 | |
2366 <<<< | |
2367 class B extends A { | |
2368 } | |
2369 ==== | |
2370 >>>> | |
2371 | |
2372 main() { | |
2373 <<<< | |
2374 new B(); | |
2375 ==== | |
2376 new A(); | |
2377 >>>> | |
2378 } | |
2379 ''', | |
2380 | |
2381 r''' | |
2382 compile_time_error_hides_field | |
2383 ==> main.dart.patch <== | |
2384 // Regression test for what happens when the parser doesn't recover. | |
2385 class A { | |
2386 <<<< {"messages":[],"hasCompileTimeError":1} | |
2387 // TODO(ahe): should just expect "null" | |
2388 bool operator ===(A other) { return true; } | |
2389 ==== {"messages":[],"hasCompileTimeError":1} | |
2390 // TODO(ahe): Should expect just: ["getter ok", "null", "setter ok"], not a | |
2391 // compile-time error. | |
2392 >>>> | |
2393 | |
2394 int field; | |
2395 } | |
2396 | |
2397 main() { | |
2398 var a = new A(); | |
2399 var value; | |
2400 try { | |
2401 value = a.field; | |
2402 print("getter ok"); | |
2403 } catch (e) { | |
2404 print("getter threw"); | |
2405 } | |
2406 print(value); | |
2407 try { | |
2408 a.field = "fisk" | |
2409 print("setter ok"); | |
2410 } catch (e) { | |
2411 print("setter threw"); | |
2412 } | |
2413 } | |
2414 ''', | |
2415 | |
2416 r''' | |
2417 update_dependencies | |
2418 ==> main.dart.patch <== | |
2419 foo() { | |
2420 <<<< "v1" | |
2421 print("v1"); | |
2422 ==== "v2" | |
2423 print("v2"); | |
2424 >>>> | |
2425 } | |
2426 | |
2427 bar() => foo(); | |
2428 | |
2429 main() { | |
2430 bar(); | |
2431 } | |
2432 ''', | |
2433 | |
2434 r''' | |
2435 update_dependencies_recoverable_compile_time_error | |
2436 ==> main.dart.patch <== | |
2437 foo() { | |
2438 <<<< {"messages":[],"hasCompileTimeError":1} | |
2439 new new(); | |
2440 ==== "v2" | |
2441 print("v2"); | |
2442 >>>> | |
2443 } | |
2444 | |
2445 bar() => foo(); | |
2446 | |
2447 main() { | |
2448 bar(); | |
2449 } | |
2450 ''', | |
2451 | |
2452 r''' | |
2453 update_dependencies_unrecoverable_compile_time_error | |
2454 ==> main.dart.patch <== | |
2455 foo() { | |
2456 <<<< {"messages":[],"hasCompileTimeError":1} | |
2457 for do while default if else new; | |
2458 ==== "v2" | |
2459 print("v2"); | |
2460 >>>> | |
2461 } | |
2462 | |
2463 bar() => foo(); | |
2464 | |
2465 main() { | |
2466 bar(); | |
2467 } | |
2468 ''', | |
2469 | |
2470 r''' | |
2471 add_top_level_field | |
2472 ==> main.dart.patch <== | |
2473 <<<< "v1" | |
2474 ==== {"messages":["null","value"],"compileUpdatesShouldThrow":1} | |
2475 // TODO(ahe): compileUpdates shouldn't throw. | |
2476 var field; | |
2477 >>>> | |
2478 main() { | |
2479 <<<< | |
2480 print("v1"); | |
2481 ==== | |
2482 print(field); | |
2483 field = "value"; | |
2484 print(field); | |
2485 >>>> | |
2486 } | |
2487 ''', | |
2488 | |
2489 r''' | |
2490 add_static_field | |
2491 ==> main.dart.patch <== | |
2492 class C { | |
2493 <<<< "v1" | |
2494 ==== {"messages":["null","value"],"compileUpdatesShouldThrow":1} | |
2495 // TODO(ahe): compileUpdates shouldn't throw. | |
2496 static var field; | |
2497 >>>> | |
2498 } | |
2499 | |
2500 main() { | |
2501 <<<< | |
2502 print("v1"); | |
2503 ==== | |
2504 print(C.field); | |
2505 field = "value"; | |
2506 print(C.field); | |
2507 >>>> | |
2508 } | |
2509 ''', | |
2510 | |
2511 r''' | |
2512 main_signature_change | |
2513 ==> main.dart.patch <== | |
2514 <<<< "v1" | |
2515 void main() { | |
2516 print("v1"); | |
2517 } | |
2518 ==== {"messages":["v2"],"compileUpdatesShouldThrow":1} | |
2519 // TODO(ahe): Should not throw. | |
2520 main() { | |
2521 print("v2"); | |
2522 } | |
2523 >>>> | |
2524 ''', | |
2525 | |
2526 r''' | |
2527 same_tokens | |
2528 ==> main.dart.patch <== | |
2529 // Test what happens when a ScopeContainerElement is changed back to its | |
2530 // original declaration. | |
2531 class C { | |
2532 static m() { | |
2533 <<<< "v1" | |
2534 print("v1"); | |
2535 ==== "v2" | |
2536 print("v2"); | |
2537 ==== "v1" | |
2538 print("v1"); | |
2539 >>>> | |
2540 } | |
2541 } | |
2542 | |
2543 main() { | |
2544 new C(); | |
2545 C.m(); | |
2546 } | |
2547 ''', | |
2548 | |
2549 r''' | |
2550 same_tokens_variant | |
2551 ==> main.dart.patch <== | |
2552 // Variant of same_tokens which causes bad code generated by incremental | |
2553 // compiler. | |
2554 class C { | |
2555 static m() { | |
2556 <<<< "v1" | |
2557 print("v1"); | |
2558 ==== "v2" | |
2559 print("v2"); | |
2560 ==== "v1" | |
2561 print("v1"); | |
2562 >>>> | |
2563 } | |
2564 } | |
2565 | |
2566 main() { | |
2567 new C(); | |
2568 <<<< | |
2569 var x; | |
2570 ==== | |
2571 var y; | |
2572 ==== | |
2573 var z; | |
2574 >>>> | |
2575 C.m(); | |
2576 } | |
2577 ''', | |
2578 | |
2579 r''' | |
2580 change_optional_arguments | |
2581 ==> main.dart.patch <== | |
2582 // Test that a method with optional arguments can change. | |
2583 <<<< ["1:3","1:2"] | |
2584 foo(x, [y = 3]) { | |
2585 print("$x:$y"); | |
2586 } | |
2587 | |
2588 void main() { | |
2589 foo(1); | |
2590 foo(1, 2); | |
2591 } | |
2592 ==== ["3","2"] | |
2593 foo([x = 3]) { | |
2594 print(x); | |
2595 } | |
2596 | |
2597 void main() { | |
2598 var f = foo; | |
2599 f(); | |
2600 f(2); | |
2601 } | |
2602 >>>> | |
2603 ''', | |
2604 | |
2605 r''' | |
2606 closure | |
2607 ==> main.dart.patch <== | |
2608 // Tests what happens when an added method is closurized. | |
2609 | |
2610 class A { | |
2611 <<<< "v1" | |
2612 foo() { | |
2613 print("v1"); | |
2614 } | |
2615 ==== "v2" | |
2616 a() { | |
2617 print("v2"); | |
2618 } | |
2619 >>>> | |
2620 } | |
2621 | |
2622 void main() { | |
2623 <<<< | |
2624 var a = new A(); | |
2625 a.foo(); | |
2626 ==== | |
2627 var a = new A(); | |
2628 var f = a.a; | |
2629 f(); | |
2630 >>>> | |
2631 } | |
2632 ''', | |
2633 | |
2634 r''' | |
2635 no_closure | |
2636 ==> main.dart.patch <== | |
2637 // Similar to closure, but doesn't use closures. | |
2638 class A { | |
2639 <<<< "v1" | |
2640 foo() { | |
2641 print("v1"); | |
2642 } | |
2643 ==== "v2" | |
2644 a() { | |
2645 print("v2"); | |
2646 } | |
2647 >>>> | |
2648 } | |
2649 | |
2650 void main() { | |
2651 <<<< | |
2652 var a = new A(); | |
2653 a.foo(); | |
2654 ==== | |
2655 var a = new A(); | |
2656 a.a(); | |
2657 >>>> | |
2658 } | |
2659 ''', | |
2660 | |
2661 r''' | |
2662 add_unused_enum_class | |
2663 ==> main.dart.patch <== | |
2664 <<<< [] | |
2665 ==== {"messages": [], "compileUpdatesShouldThrow":1} | |
2666 // TODO(ahe): Shouldn't throw | |
2667 enum E { e0 } | |
2668 >>>> | |
2669 | |
2670 main() { | |
2671 } | |
2672 ''', | |
2673 | |
2674 r''' | |
2675 remove_unused_enum_class | |
2676 ==> main.dart.patch <== | |
2677 <<<< [] | |
2678 enum E { e0 } | |
2679 ==== {"messages": [], "compileUpdatesShouldThrow":1} | |
2680 // TODO(ahe): Shouldn't throw | |
2681 >>>> | |
2682 | |
2683 main() { | |
2684 } | |
2685 ''', | |
2686 ]; | |
OLD | NEW |