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 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1642 } | 1642 } |
1643 """, | 1643 """, |
1644 | 1644 |
1645 ], | 1645 ], |
1646 const <ProgramExpectation>[ | 1646 const <ProgramExpectation>[ |
1647 const ProgramExpectation( | 1647 const ProgramExpectation( |
1648 const <String>['A(v1)']), | 1648 const <String>['A(v1)']), |
1649 const ProgramExpectation( | 1649 const ProgramExpectation( |
1650 const <String>['A(v2)', 'B(v2)', 'B(A(v2))', 'A(B(v2))']), | 1650 const <String>['A(v2)', 'B(v2)', 'B(A(v2))', 'A(B(v2))']), |
1651 ]), | 1651 ]), |
| 1652 |
| 1653 const EncodedResult( |
| 1654 r""" |
| 1655 ==> main.dart <== |
| 1656 library test.main; |
| 1657 |
| 1658 part 'part.dart'; |
| 1659 ==> part.dart.patch <== |
| 1660 part of test.main; |
| 1661 |
| 1662 main() { |
| 1663 <<<<<<< |
| 1664 print('Hello, World!'); |
| 1665 ======= |
| 1666 print('Hello, Brave New World!'); |
| 1667 >>>>>>> |
| 1668 } |
| 1669 """, |
| 1670 const [ |
| 1671 'Hello, World!', |
| 1672 const ProgramExpectation( |
| 1673 const <String>['Hello, Brave New World!'], |
| 1674 // TODO(ahe): Shouldn't throw. |
| 1675 compileUpdatesShouldThrow: true), |
| 1676 ]), |
1652 ]; | 1677 ]; |
1653 | 1678 |
1654 void main() { | 1679 void main() { |
1655 listener.start(); | 1680 listener.start(); |
1656 | 1681 |
1657 document.head.append(lineNumberStyle()); | 1682 document.head.append(lineNumberStyle()); |
1658 | 1683 |
1659 summary = new SpanElement(); | 1684 summary = new SpanElement(); |
1660 document.body.append(new HeadingElement.h1() | 1685 document.body.append(new HeadingElement.h1() |
1661 ..appendText("Incremental compiler tests") | 1686 ..appendText("Incremental compiler tests") |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1818 void logger(x) { | 1843 void logger(x) { |
1819 print(x); | 1844 print(x); |
1820 bool isCheckedMode = false; | 1845 bool isCheckedMode = false; |
1821 assert(isCheckedMode = true); | 1846 assert(isCheckedMode = true); |
1822 int timeout = isCheckedMode ? TIMEOUT * 2 : TIMEOUT; | 1847 int timeout = isCheckedMode ? TIMEOUT * 2 : TIMEOUT; |
1823 if (listener.elapsed > timeout) { | 1848 if (listener.elapsed > timeout) { |
1824 throw 'Test timed out.'; | 1849 throw 'Test timed out.'; |
1825 } | 1850 } |
1826 } | 1851 } |
1827 | 1852 |
1828 DivElement numberedLines(String code) { | 1853 DivElement numberedLines(code) { |
| 1854 if (code is! Map) { |
| 1855 code = {'main.dart': code}; |
| 1856 } |
1829 DivElement result = new DivElement(); | 1857 DivElement result = new DivElement(); |
1830 result.classes.add("output"); | 1858 code.forEach((String fileName, String code) { |
| 1859 result.append(new HeadingElement.h4()..appendText(fileName)); |
| 1860 DivElement lines = new DivElement(); |
| 1861 result.append(lines); |
| 1862 lines.classes.add("output"); |
1831 | 1863 |
1832 for (String text in splitLines(code)) { | 1864 for (String text in splitLines(code)) { |
1833 PreElement line = new PreElement() | 1865 PreElement line = new PreElement() |
1834 ..appendText(text.trimRight()) | 1866 ..appendText(text.trimRight()) |
1835 ..classes.add("line"); | 1867 ..classes.add("line"); |
1836 result.append(line); | 1868 lines.append(line); |
1837 } | 1869 } |
1838 | 1870 }); |
1839 return result; | 1871 return result; |
1840 } | 1872 } |
1841 | 1873 |
1842 StyleElement lineNumberStyle() { | 1874 StyleElement lineNumberStyle() { |
1843 StyleElement style = new StyleElement()..appendText(''' | 1875 StyleElement style = new StyleElement()..appendText(''' |
1844 h2, h3 { | 1876 h2, h3, h4 { |
1845 color: black; | 1877 color: black; |
1846 } | 1878 } |
1847 | 1879 |
1848 .output { | 1880 .output { |
1849 padding: 0px; | 1881 padding: 0px; |
1850 counter-reset: line-number; | 1882 counter-reset: line-number; |
1851 padding-bottom: 1em; | 1883 padding-bottom: 1em; |
1852 } | 1884 } |
1853 | 1885 |
1854 .line { | 1886 .line { |
1855 white-space: pre-wrap; | 1887 white-space: pre-wrap; |
1856 padding-left: 3.5em; | 1888 padding-left: 3.5em; |
1857 margin-top: 0; | 1889 margin-top: 0; |
1858 margin-bottom: 0; | 1890 margin-bottom: 0; |
1859 } | 1891 } |
1860 | 1892 |
1861 .line::before { | 1893 .line::before { |
1862 counter-increment: line-number; | 1894 counter-increment: line-number; |
1863 content: counter(line-number) " "; | 1895 content: counter(line-number) " "; |
1864 position: absolute; | 1896 position: absolute; |
1865 left: 0px; | 1897 left: 0px; |
1866 width: 3em; | 1898 width: 3em; |
1867 text-align: right; | 1899 text-align: right; |
1868 background-color: lightgoldenrodyellow; | 1900 background-color: lightgoldenrodyellow; |
1869 } | 1901 } |
1870 '''); | 1902 '''); |
1871 style.type = 'text/css'; | 1903 style.type = 'text/css'; |
1872 return style; | 1904 return style; |
1873 } | 1905 } |
OLD | NEW |