| 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 test.services.correction.fix; | 5 library test.services.correction.fix; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/protocol.dart' hide AnalysisError; | 7 import 'package:analysis_server/src/protocol.dart' hide AnalysisError; |
| 8 import 'package:analysis_server/src/services/correction/fix.dart'; | 8 import 'package:analysis_server/src/services/correction/fix.dart'; |
| 9 import 'package:analysis_server/src/services/index/index.dart'; | 9 import 'package:analysis_server/src/services/index/index.dart'; |
| 10 import 'package:analysis_server/src/services/index/local_memory_index.dart'; | 10 import 'package:analysis_server/src/services/index/local_memory_index.dart'; |
| (...skipping 1828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1839 performAllAnalysisTasks(); | 1839 performAllAnalysisTasks(); |
| 1840 assertHasFix(FixKind.IMPORT_LIBRARY_SDK, ''' | 1840 assertHasFix(FixKind.IMPORT_LIBRARY_SDK, ''' |
| 1841 import 'dart:math'; | 1841 import 'dart:math'; |
| 1842 | 1842 |
| 1843 @PI | 1843 @PI |
| 1844 main() { | 1844 main() { |
| 1845 } | 1845 } |
| 1846 '''); | 1846 '''); |
| 1847 } | 1847 } |
| 1848 | 1848 |
| 1849 void test_importLibrarySdk_withType_AsExpression() { |
| 1850 _indexTestUnit(''' |
| 1851 main(p) { |
| 1852 p as Future; |
| 1853 } |
| 1854 '''); |
| 1855 assertHasFix(FixKind.IMPORT_LIBRARY_SDK, ''' |
| 1856 import 'dart:async'; |
| 1857 |
| 1858 main(p) { |
| 1859 p as Future; |
| 1860 } |
| 1861 '''); |
| 1862 } |
| 1863 |
| 1849 void test_importLibrarySdk_withType_invocationTarget() { | 1864 void test_importLibrarySdk_withType_invocationTarget() { |
| 1850 _indexTestUnit(''' | 1865 _indexTestUnit(''' |
| 1851 main() { | 1866 main() { |
| 1852 Future.wait(null); | 1867 Future.wait(null); |
| 1853 } | 1868 } |
| 1854 '''); | 1869 '''); |
| 1855 assertHasFix(FixKind.IMPORT_LIBRARY_SDK, ''' | 1870 assertHasFix(FixKind.IMPORT_LIBRARY_SDK, ''' |
| 1856 import 'dart:async'; | 1871 import 'dart:async'; |
| 1857 | 1872 |
| 1858 main() { | 1873 main() { |
| 1859 Future.wait(null); | 1874 Future.wait(null); |
| 1860 } | 1875 } |
| 1861 '''); | 1876 '''); |
| 1862 } | 1877 } |
| 1863 | 1878 |
| 1879 void test_importLibrarySdk_withType_IsExpression() { |
| 1880 _indexTestUnit(''' |
| 1881 main(p) { |
| 1882 p is Future; |
| 1883 } |
| 1884 '''); |
| 1885 assertHasFix(FixKind.IMPORT_LIBRARY_SDK, ''' |
| 1886 import 'dart:async'; |
| 1887 |
| 1888 main(p) { |
| 1889 p is Future; |
| 1890 } |
| 1891 '''); |
| 1892 } |
| 1893 |
| 1864 void test_importLibrarySdk_withType_typeAnnotation() { | 1894 void test_importLibrarySdk_withType_typeAnnotation() { |
| 1865 _indexTestUnit(''' | 1895 _indexTestUnit(''' |
| 1866 main() { | 1896 main() { |
| 1867 Future f = null; | 1897 Future f = null; |
| 1868 } | 1898 } |
| 1869 '''); | 1899 '''); |
| 1870 assertHasFix(FixKind.IMPORT_LIBRARY_SDK, ''' | 1900 assertHasFix(FixKind.IMPORT_LIBRARY_SDK, ''' |
| 1871 import 'dart:async'; | 1901 import 'dart:async'; |
| 1872 | 1902 |
| 1873 main() { | 1903 main() { |
| (...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2841 positions.add(new Position(testFile, offset)); | 2871 positions.add(new Position(testFile, offset)); |
| 2842 } | 2872 } |
| 2843 return positions; | 2873 return positions; |
| 2844 } | 2874 } |
| 2845 | 2875 |
| 2846 void _indexTestUnit(String code) { | 2876 void _indexTestUnit(String code) { |
| 2847 resolveTestUnit(code); | 2877 resolveTestUnit(code); |
| 2848 index.indexUnit(context, testUnit); | 2878 index.indexUnit(context, testUnit); |
| 2849 } | 2879 } |
| 2850 } | 2880 } |
| OLD | NEW |