OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library trydart.incremental_compilation_update_test; | 5 library trydart.incremental_compilation_update_test; |
6 | 6 |
7 import 'dart:html' hide | 7 import 'dart:html' hide |
8 Element; | 8 Element; |
9 | 9 |
10 import 'dart:async' show | 10 import 'dart:async' show |
(...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1648 try { | 1648 try { |
1649 print(instance.x); | 1649 print(instance.x); |
1650 } catch (e) { | 1650 } catch (e) { |
1651 print('[instance.x] threw'); | 1651 print('[instance.x] threw'); |
1652 } | 1652 } |
1653 } | 1653 } |
1654 """, | 1654 """, |
1655 const <String>['v2', '[instance.x] threw']), | 1655 const <String>['v2', '[instance.x] threw']), |
1656 */ | 1656 */ |
1657 ], | 1657 ], |
| 1658 |
| 1659 // Test compound constants. |
| 1660 const <ProgramResult>[ |
| 1661 const ProgramResult( |
| 1662 r""" |
| 1663 class A { |
| 1664 final value; |
| 1665 const A(this.value); |
| 1666 |
| 1667 toString() => 'A($value)'; |
| 1668 } |
| 1669 |
| 1670 class B { |
| 1671 final value; |
| 1672 const B(this.value); |
| 1673 |
| 1674 toString() => 'B($value)'; |
| 1675 } |
| 1676 |
| 1677 main() { |
| 1678 print(const A('v1')); |
| 1679 print(const B('v1')); |
| 1680 } |
| 1681 """, |
| 1682 const <String>['A(v1)', 'B(v1)']), |
| 1683 |
| 1684 const ProgramResult( |
| 1685 r""" |
| 1686 class A { |
| 1687 final value; |
| 1688 const A(this.value); |
| 1689 |
| 1690 toString() => 'A($value)'; |
| 1691 } |
| 1692 |
| 1693 class B { |
| 1694 final value; |
| 1695 const B(this.value); |
| 1696 |
| 1697 toString() => 'B($value)'; |
| 1698 } |
| 1699 |
| 1700 main() { |
| 1701 print(const B(const A('v2'))); |
| 1702 print(const A(const B('v2'))); |
| 1703 } |
| 1704 """, |
| 1705 // TODO(ahe): Broken test, wrong output. |
| 1706 const <String>['B(null)', 'A(null)']), |
| 1707 /* These are the correct expectations: |
| 1708 const <String>['B(A(v2))', 'A(B(v2))']), |
| 1709 */ |
| 1710 ], |
| 1711 |
| 1712 // Test constants of new classes. |
| 1713 const <ProgramResult>[ |
| 1714 const ProgramResult( |
| 1715 r""" |
| 1716 class A { |
| 1717 final value; |
| 1718 const A(this.value); |
| 1719 |
| 1720 toString() => 'A($value)'; |
| 1721 } |
| 1722 |
| 1723 main() { |
| 1724 print(const A('v1')); |
| 1725 } |
| 1726 """, |
| 1727 const <String>['A(v1)']), |
| 1728 |
| 1729 const ProgramResult( |
| 1730 r""" |
| 1731 class A { |
| 1732 final value; |
| 1733 const A(this.value); |
| 1734 |
| 1735 toString() => 'A($value)'; |
| 1736 } |
| 1737 |
| 1738 class B { |
| 1739 final value; |
| 1740 const B(this.value); |
| 1741 |
| 1742 toString() => 'B($value)'; |
| 1743 } |
| 1744 |
| 1745 main() { |
| 1746 print(const A('v2')); |
| 1747 print(const B('v2')); |
| 1748 print(const B(const A('v2'))); |
| 1749 print(const A(const B('v2'))); |
| 1750 } |
| 1751 """, |
| 1752 const <String>['A(v2)', 'B(v2)', 'B(A(v2))', 'A(B(v2))']), |
| 1753 ], |
1658 ]; | 1754 ]; |
1659 | 1755 |
1660 void main() { | 1756 void main() { |
1661 listener.start(); | 1757 listener.start(); |
1662 | 1758 |
1663 document.head.append(lineNumberStyle()); | 1759 document.head.append(lineNumberStyle()); |
1664 | 1760 |
1665 summary = new SpanElement(); | 1761 summary = new SpanElement(); |
1666 document.body.append(new HeadingElement.h1() | 1762 document.body.append(new HeadingElement.h1() |
1667 ..appendText("Incremental compiler tests") | 1763 ..appendText("Incremental compiler tests") |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1848 position: absolute; | 1944 position: absolute; |
1849 left: 0px; | 1945 left: 0px; |
1850 width: 3em; | 1946 width: 3em; |
1851 text-align: right; | 1947 text-align: right; |
1852 background-color: lightgoldenrodyellow; | 1948 background-color: lightgoldenrodyellow; |
1853 } | 1949 } |
1854 '''); | 1950 '''); |
1855 style.type = 'text/css'; | 1951 style.type = 'text/css'; |
1856 return style; | 1952 return style; |
1857 } | 1953 } |
OLD | NEW |