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

Side by Side Diff: pkg/analysis_server/test/context_manager_test.dart

Issue 2975253002: Format analyzer, analysis_server, analyzer_plugin, front_end and kernel with the latest dartfmt. (Closed)
Patch Set: 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
OLDNEW
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.context.directory.manager; 5 library test.context.directory.manager;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/context_manager.dart'; 9 import 'package:analysis_server/src/context_manager.dart';
10 import 'package:analysis_server/src/plugin/notification_manager.dart'; 10 import 'package:analysis_server/src/plugin/notification_manager.dart';
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // Create files. 93 // Create files.
94 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]); 94 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
95 newFile([libPath, 'main.dart']); 95 newFile([libPath, 'main.dart']);
96 newFile([libPath, 'nope.dart']); 96 newFile([libPath, 'nope.dart']);
97 String embedderPath = newFolder([projPath, 'embedder']); 97 String embedderPath = newFolder([projPath, 'embedder']);
98 newFile([embedderPath, 'entry.dart']); 98 newFile([embedderPath, 'entry.dart']);
99 String embedderSrcPath = newFolder([projPath, 'embedder', 'src']); 99 String embedderSrcPath = newFolder([projPath, 'embedder', 'src']);
100 newFile([embedderSrcPath, 'part.dart']); 100 newFile([embedderSrcPath, 'part.dart']);
101 101
102 // Setup _embedder.yaml. 102 // Setup _embedder.yaml.
103 newFile( 103 newFile([libPath, '_embedder.yaml'], r'''
104 [libPath, '_embedder.yaml'],
105 r'''
106 embedded_libs: 104 embedded_libs:
107 "dart:foobar": "../embedder/entry.dart" 105 "dart:foobar": "../embedder/entry.dart"
108 "dart:typed_data": "../embedder/src/part" 106 "dart:typed_data": "../embedder/src/part"
109 '''); 107 ''');
110 108
111 Folder projectFolder = resourceProvider.newFolder(projPath); 109 Folder projectFolder = resourceProvider.newFolder(projPath);
112 110
113 // NOTE that this is Not in our package path yet. 111 // NOTE that this is Not in our package path yet.
114 112
115 // Setup context. 113 // Setup context.
116 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 114 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
117 await pumpEventQueue(); 115 await pumpEventQueue();
118 // Confirm that one driver / context was created. 116 // Confirm that one driver / context was created.
119 List<AnalysisDriver> drivers = 117 List<AnalysisDriver> drivers =
120 manager.getDriversInAnalysisRoot(projectFolder); 118 manager.getDriversInAnalysisRoot(projectFolder);
121 expect(drivers, isNotNull); 119 expect(drivers, isNotNull);
122 expect(drivers, hasLength(1)); 120 expect(drivers, hasLength(1));
123 121
124 // No embedded libs yet. 122 // No embedded libs yet.
125 expect(sourceFactory.forUri('dart:typed_data'), isNull); 123 expect(sourceFactory.forUri('dart:typed_data'), isNull);
126 124
127 // Add .packages file that introduces a dependency with embedded libs. 125 // Add .packages file that introduces a dependency with embedded libs.
128 newFile( 126 newFile([projPath, '.packages'], r'''
129 [projPath, '.packages'],
130 r'''
131 test_pack:lib/'''); 127 test_pack:lib/''');
132 128
133 await pumpEventQueue(); 129 await pumpEventQueue();
134 130
135 // Confirm that we still have just one driver / context. 131 // Confirm that we still have just one driver / context.
136 drivers = manager.getDriversInAnalysisRoot(projectFolder); 132 drivers = manager.getDriversInAnalysisRoot(projectFolder);
137 expect(drivers, isNotNull); 133 expect(drivers, isNotNull);
138 expect(drivers, hasLength(1)); 134 expect(drivers, hasLength(1));
139 135
140 // Embedded lib should be defined now. 136 // Embedded lib should be defined now.
141 expect(sourceFactory.forUri('dart:typed_data'), isNotNull); 137 expect(sourceFactory.forUri('dart:typed_data'), isNotNull);
142 } 138 }
143 139
144 test_embedder_packagespec() async { 140 test_embedder_packagespec() async {
145 // Create files. 141 // Create files.
146 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]); 142 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
147 newFile([libPath, 'main.dart']); 143 newFile([libPath, 'main.dart']);
148 newFile([libPath, 'nope.dart']); 144 newFile([libPath, 'nope.dart']);
149 String sdkExtPath = newFolder([projPath, 'sdk_ext']); 145 String sdkExtPath = newFolder([projPath, 'sdk_ext']);
150 newFile([sdkExtPath, 'entry.dart']); 146 newFile([sdkExtPath, 'entry.dart']);
151 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']); 147 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
152 newFile([sdkExtSrcPath, 'part.dart']); 148 newFile([sdkExtSrcPath, 'part.dart']);
153 // Setup _embedder.yaml. 149 // Setup _embedder.yaml.
154 newFile( 150 newFile([libPath, '_embedder.yaml'], r'''
155 [libPath, '_embedder.yaml'],
156 r'''
157 embedded_libs: 151 embedded_libs:
158 "dart:foobar": "../sdk_ext/entry.dart" 152 "dart:foobar": "../sdk_ext/entry.dart"
159 "dart:typed_data": "../sdk_ext/src/part" 153 "dart:typed_data": "../sdk_ext/src/part"
160 '''); 154 ''');
161 // Setup .packages file 155 // Setup .packages file
162 newFile( 156 newFile([projPath, '.packages'], r'''
163 [projPath, '.packages'],
164 r'''
165 test_pack:lib/'''); 157 test_pack:lib/''');
166 // Setup context. 158 // Setup context.
167 159
168 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 160 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
169 await pumpEventQueue(); 161 await pumpEventQueue();
170 // Confirm that one context was created. 162 // Confirm that one context was created.
171 int count = manager 163 int count = manager
172 .numberOfContextsInAnalysisRoot(resourceProvider.newFolder(projPath)); 164 .numberOfContextsInAnalysisRoot(resourceProvider.newFolder(projPath));
173 expect(count, equals(1)); 165 expect(count, equals(1));
174 var source = sourceFactory.forUri('dart:foobar'); 166 var source = sourceFactory.forUri('dart:foobar');
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 test_sdk_ext_packagespec() async { 370 test_sdk_ext_packagespec() async {
379 // Create files. 371 // Create files.
380 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]); 372 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
381 newFile([libPath, 'main.dart']); 373 newFile([libPath, 'main.dart']);
382 newFile([libPath, 'nope.dart']); 374 newFile([libPath, 'nope.dart']);
383 String sdkExtPath = newFolder([projPath, 'sdk_ext']); 375 String sdkExtPath = newFolder([projPath, 'sdk_ext']);
384 newFile([sdkExtPath, 'entry.dart']); 376 newFile([sdkExtPath, 'entry.dart']);
385 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']); 377 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
386 newFile([sdkExtSrcPath, 'part.dart']); 378 newFile([sdkExtSrcPath, 'part.dart']);
387 // Setup sdk extension mapping. 379 // Setup sdk extension mapping.
388 newFile( 380 newFile([libPath, '_sdkext'], r'''
389 [libPath, '_sdkext'],
390 r'''
391 { 381 {
392 "dart:foobar": "../sdk_ext/entry.dart" 382 "dart:foobar": "../sdk_ext/entry.dart"
393 } 383 }
394 '''); 384 ''');
395 // Setup .packages file 385 // Setup .packages file
396 newFile( 386 newFile([projPath, '.packages'], r'''
397 [projPath, '.packages'],
398 r'''
399 test_pack:lib/'''); 387 test_pack:lib/''');
400 // Setup context. 388 // Setup context.
401 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 389 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
402 // Confirm that one context was created. 390 // Confirm that one context was created.
403 int count = manager 391 int count = manager
404 .numberOfContextsInAnalysisRoot(resourceProvider.newFolder(projPath)); 392 .numberOfContextsInAnalysisRoot(resourceProvider.newFolder(projPath));
405 expect(count, equals(1)); 393 expect(count, equals(1));
406 var source = sourceFactory.forUri('dart:foobar'); 394 var source = sourceFactory.forUri('dart:foobar');
407 expect(source.fullName, equals('/my/proj/sdk_ext/entry.dart')); 395 expect(source.fullName, equals('/my/proj/sdk_ext/entry.dart'));
408 } 396 }
(...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1843 @reflectiveTest 1831 @reflectiveTest
1844 class ContextManagerWithOldOptionsTest extends ContextManagerWithOptionsTest { 1832 class ContextManagerWithOldOptionsTest extends ContextManagerWithOptionsTest {
1845 String get optionsFileName => AnalysisEngine.ANALYSIS_OPTIONS_FILE; 1833 String get optionsFileName => AnalysisEngine.ANALYSIS_OPTIONS_FILE;
1846 } 1834 }
1847 1835
1848 abstract class ContextManagerWithOptionsTest extends ContextManagerTest { 1836 abstract class ContextManagerWithOptionsTest extends ContextManagerTest {
1849 String get optionsFileName; 1837 String get optionsFileName;
1850 1838
1851 test_analysis_options_file_delete() async { 1839 test_analysis_options_file_delete() async {
1852 // Setup analysis options 1840 // Setup analysis options
1853 newFile( 1841 newFile([projPath, optionsFileName], r'''
1854 [projPath, optionsFileName],
1855 r'''
1856 embedded_libs: 1842 embedded_libs:
1857 "dart:foobar": "../sdk_ext/entry.dart" 1843 "dart:foobar": "../sdk_ext/entry.dart"
1858 analyzer: 1844 analyzer:
1859 language: 1845 language:
1860 enableStrictCallChecks: true 1846 enableStrictCallChecks: true
1861 errors: 1847 errors:
1862 unused_local_variable: false 1848 unused_local_variable: false
1863 linter: 1849 linter:
1864 rules: 1850 rules:
1865 - camel_case_types 1851 - camel_case_types
(...skipping 17 matching lines...) Expand all
1883 expect(lints, isEmpty); 1869 expect(lints, isEmpty);
1884 expect(analysisOptions.enableStrictCallChecks, isFalse); 1870 expect(analysisOptions.enableStrictCallChecks, isFalse);
1885 } 1871 }
1886 1872
1887 @failingTest 1873 @failingTest
1888 test_analysis_options_file_delete_with_embedder() async { 1874 test_analysis_options_file_delete_with_embedder() async {
1889 // This fails because the ContextBuilder doesn't pick up the strongMode 1875 // This fails because the ContextBuilder doesn't pick up the strongMode
1890 // flag from the embedder.yaml file. 1876 // flag from the embedder.yaml file.
1891 // Setup _embedder.yaml. 1877 // Setup _embedder.yaml.
1892 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]); 1878 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
1893 newFile( 1879 newFile([libPath, '_embedder.yaml'], r'''
1894 [libPath, '_embedder.yaml'],
1895 r'''
1896 analyzer: 1880 analyzer:
1897 strong-mode: true 1881 strong-mode: true
1898 errors: 1882 errors:
1899 missing_return: false 1883 missing_return: false
1900 linter: 1884 linter:
1901 rules: 1885 rules:
1902 - avoid_as 1886 - avoid_as
1903 '''); 1887 ''');
1904 1888
1905 // Setup .packages file 1889 // Setup .packages file
1906 newFile( 1890 newFile([projPath, '.packages'], r'''
1907 [projPath, '.packages'],
1908 r'''
1909 test_pack:lib/'''); 1891 test_pack:lib/''');
1910 1892
1911 // Setup analysis options 1893 // Setup analysis options
1912 newFile( 1894 newFile([projPath, optionsFileName], r'''
1913 [projPath, optionsFileName],
1914 r'''
1915 analyzer: 1895 analyzer:
1916 language: 1896 language:
1917 enableStrictCallChecks: true 1897 enableStrictCallChecks: true
1918 errors: 1898 errors:
1919 unused_local_variable: false 1899 unused_local_variable: false
1920 linter: 1900 linter:
1921 rules: 1901 rules:
1922 - camel_case_types 1902 - camel_case_types
1923 '''); 1903 ''');
1924 1904
(...skipping 21 matching lines...) Expand all
1946 1926
1947 test_analysis_options_include() async { 1927 test_analysis_options_include() async {
1948 // Create files. 1928 // Create files.
1949 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]); 1929 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
1950 newFile([libPath, 'main.dart']); 1930 newFile([libPath, 'main.dart']);
1951 String sdkExtPath = newFolder([projPath, 'sdk_ext']); 1931 String sdkExtPath = newFolder([projPath, 'sdk_ext']);
1952 newFile([sdkExtPath, 'entry.dart']); 1932 newFile([sdkExtPath, 'entry.dart']);
1953 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']); 1933 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
1954 newFile([sdkExtSrcPath, 'part.dart']); 1934 newFile([sdkExtSrcPath, 'part.dart']);
1955 // Setup analysis options file which includes another options file. 1935 // Setup analysis options file which includes another options file.
1956 newFile( 1936 newFile([projPath, optionsFileName], r'''
1957 [projPath, optionsFileName],
1958 r'''
1959 include: other_options.yaml 1937 include: other_options.yaml
1960 '''); 1938 ''');
1961 newFile( 1939 newFile([projPath, 'other_options.yaml'], r'''
1962 [projPath, 'other_options.yaml'],
1963 r'''
1964 analyzer: 1940 analyzer:
1965 language: 1941 language:
1966 enableStrictCallChecks: true 1942 enableStrictCallChecks: true
1967 errors: 1943 errors:
1968 unused_local_variable: false 1944 unused_local_variable: false
1969 linter: 1945 linter:
1970 rules: 1946 rules:
1971 - camel_case_types 1947 - camel_case_types
1972 '''); 1948 ''');
1973 // Setup context. 1949 // Setup context.
1974 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 1950 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
1975 await pumpEventQueue(); 1951 await pumpEventQueue();
1976 // Verify options were set. 1952 // Verify options were set.
1977 expect(analysisOptions.enableStrictCallChecks, isTrue); 1953 expect(analysisOptions.enableStrictCallChecks, isTrue);
1978 expect(errorProcessors, hasLength(1)); 1954 expect(errorProcessors, hasLength(1));
1979 expect(lints, hasLength(1)); 1955 expect(lints, hasLength(1));
1980 expect(lints[0].name, 'camel_case_types'); 1956 expect(lints[0].name, 'camel_case_types');
1981 } 1957 }
1982 1958
1983 test_analysis_options_include_package() async { 1959 test_analysis_options_include_package() async {
1984 // Create files. 1960 // Create files.
1985 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]); 1961 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
1986 newFile([libPath, 'main.dart']); 1962 newFile([libPath, 'main.dart']);
1987 String sdkExtPath = newFolder([projPath, 'sdk_ext']); 1963 String sdkExtPath = newFolder([projPath, 'sdk_ext']);
1988 newFile([sdkExtPath, 'entry.dart']); 1964 newFile([sdkExtPath, 'entry.dart']);
1989 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']); 1965 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
1990 newFile([sdkExtSrcPath, 'part.dart']); 1966 newFile([sdkExtSrcPath, 'part.dart']);
1991 // Setup package 1967 // Setup package
1992 String booLibPosixPath = '/my/pkg/boo/lib'; 1968 String booLibPosixPath = '/my/pkg/boo/lib';
1993 newFile( 1969 newFile([booLibPosixPath, 'other_options.yaml'], r'''
1994 [booLibPosixPath, 'other_options.yaml'],
1995 r'''
1996 analyzer: 1970 analyzer:
1997 language: 1971 language:
1998 enableStrictCallChecks: true 1972 enableStrictCallChecks: true
1999 errors: 1973 errors:
2000 unused_local_variable: false 1974 unused_local_variable: false
2001 linter: 1975 linter:
2002 rules: 1976 rules:
2003 - camel_case_types 1977 - camel_case_types
2004 '''); 1978 ''');
2005 // Setup analysis options file which includes another options file. 1979 // Setup analysis options file which includes another options file.
2006 newFile([projPath, ContextManagerImpl.PACKAGE_SPEC_NAME], 1980 newFile([projPath, ContextManagerImpl.PACKAGE_SPEC_NAME],
2007 'boo:$booLibPosixPath\n'); 1981 'boo:$booLibPosixPath\n');
2008 newFile( 1982 newFile([projPath, optionsFileName], r'''
2009 [projPath, optionsFileName],
2010 r'''
2011 include: package:boo/other_options.yaml 1983 include: package:boo/other_options.yaml
2012 '''); 1984 ''');
2013 // Setup context. 1985 // Setup context.
2014 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 1986 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
2015 await pumpEventQueue(); 1987 await pumpEventQueue();
2016 // Verify options were set. 1988 // Verify options were set.
2017 expect(analysisOptions.enableStrictCallChecks, isTrue); 1989 expect(analysisOptions.enableStrictCallChecks, isTrue);
2018 expect(errorProcessors, hasLength(1)); 1990 expect(errorProcessors, hasLength(1));
2019 expect(lints, hasLength(1)); 1991 expect(lints, hasLength(1));
2020 expect(lints[0].name, 'camel_case_types'); 1992 expect(lints[0].name, 'camel_case_types');
2021 } 1993 }
2022 1994
2023 test_analysis_options_parse_failure() async { 1995 test_analysis_options_parse_failure() async {
2024 // Create files. 1996 // Create files.
2025 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]); 1997 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
2026 newFile([libPath, 'main.dart']); 1998 newFile([libPath, 'main.dart']);
2027 String sdkExtPath = newFolder([projPath, 'sdk_ext']); 1999 String sdkExtPath = newFolder([projPath, 'sdk_ext']);
2028 newFile([sdkExtPath, 'entry.dart']); 2000 newFile([sdkExtPath, 'entry.dart']);
2029 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']); 2001 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
2030 newFile([sdkExtSrcPath, 'part.dart']); 2002 newFile([sdkExtSrcPath, 'part.dart']);
2031 // Setup analysis options file with ignore list. 2003 // Setup analysis options file with ignore list.
2032 String optionsFilePath = newFile( 2004 String optionsFilePath = newFile([projPath, optionsFileName], r'''
2033 [projPath, optionsFileName],
2034 r'''
2035 ; 2005 ;
2036 '''); 2006 ''');
2037 // Setup context. 2007 // Setup context.
2038 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 2008 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
2039 2009
2040 // Check that an error was produced. 2010 // Check that an error was produced.
2041 TestNotificationManager notificationManager = callbacks.notificationManager; 2011 TestNotificationManager notificationManager = callbacks.notificationManager;
2042 var errors = notificationManager.recordedErrors; 2012 var errors = notificationManager.recordedErrors;
2043 expect(errors, hasLength(1)); 2013 expect(errors, hasLength(1));
2044 expect(errors[errors.keys.first][optionsFilePath], hasLength(1)); 2014 expect(errors[errors.keys.first][optionsFilePath], hasLength(1));
(...skipping 17 matching lines...) Expand all
2062 // This fails because the ContextBuilder doesn't pick up the strongMode 2032 // This fails because the ContextBuilder doesn't pick up the strongMode
2063 // flag from the embedder.yaml file. 2033 // flag from the embedder.yaml file.
2064 // Create files. 2034 // Create files.
2065 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]); 2035 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
2066 String sdkExtPath = newFolder([projPath, 'sdk_ext']); 2036 String sdkExtPath = newFolder([projPath, 'sdk_ext']);
2067 newFile([projPath, 'test', 'test.dart']); 2037 newFile([projPath, 'test', 'test.dart']);
2068 newFile([sdkExtPath, 'entry.dart']); 2038 newFile([sdkExtPath, 'entry.dart']);
2069 List<int> bytes = new SummaryBuilder([], null, true).build(); 2039 List<int> bytes = new SummaryBuilder([], null, true).build();
2070 newFileFromBytes([projPath, 'sdk.ds'], bytes); 2040 newFileFromBytes([projPath, 'sdk.ds'], bytes);
2071 // Setup _embedder.yaml. 2041 // Setup _embedder.yaml.
2072 newFile( 2042 newFile([libPath, '_embedder.yaml'], r'''
2073 [libPath, '_embedder.yaml'],
2074 r'''
2075 embedded_libs: 2043 embedded_libs:
2076 "dart:foobar": "../sdk_ext/entry.dart" 2044 "dart:foobar": "../sdk_ext/entry.dart"
2077 analyzer: 2045 analyzer:
2078 strong-mode: true 2046 strong-mode: true
2079 language: 2047 language:
2080 enableSuperMixins: true 2048 enableSuperMixins: true
2081 errors: 2049 errors:
2082 missing_return: false 2050 missing_return: false
2083 linter: 2051 linter:
2084 rules: 2052 rules:
2085 - avoid_as 2053 - avoid_as
2086 '''); 2054 ''');
2087 // Setup .packages file 2055 // Setup .packages file
2088 newFile( 2056 newFile([projPath, '.packages'], r'''
2089 [projPath, '.packages'],
2090 r'''
2091 test_pack:lib/'''); 2057 test_pack:lib/''');
2092 2058
2093 // Setup analysis options 2059 // Setup analysis options
2094 newFile( 2060 newFile([projPath, optionsFileName], r'''
2095 [projPath, optionsFileName],
2096 r'''
2097 analyzer: 2061 analyzer:
2098 exclude: 2062 exclude:
2099 - 'test/**' 2063 - 'test/**'
2100 language: 2064 language:
2101 enableStrictCallChecks: true 2065 enableStrictCallChecks: true
2102 errors: 2066 errors:
2103 unused_local_variable: false 2067 unused_local_variable: false
2104 linter: 2068 linter:
2105 rules: 2069 rules:
2106 - camel_case_types 2070 - camel_case_types
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2146 ['avoid_as' /* embedder */, 'camel_case_types' /* options */])); 2110 ['avoid_as' /* embedder */, 'camel_case_types' /* options */]));
2147 2111
2148 // Sanity check embedder libs. 2112 // Sanity check embedder libs.
2149 var source = sourceFactory.forUri('dart:foobar'); 2113 var source = sourceFactory.forUri('dart:foobar');
2150 expect(source, isNotNull); 2114 expect(source, isNotNull);
2151 expect(source.fullName, '/my/proj/sdk_ext/entry.dart'); 2115 expect(source.fullName, '/my/proj/sdk_ext/entry.dart');
2152 } 2116 }
2153 2117
2154 test_error_filter_analysis_option() async { 2118 test_error_filter_analysis_option() async {
2155 // Create files. 2119 // Create files.
2156 newFile( 2120 newFile([projPath, optionsFileName], r'''
2157 [projPath, optionsFileName],
2158 r'''
2159 analyzer: 2121 analyzer:
2160 errors: 2122 errors:
2161 unused_local_variable: ignore 2123 unused_local_variable: ignore
2162 '''); 2124 ''');
2163 // Setup context. 2125 // Setup context.
2164 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 2126 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
2165 2127
2166 // Verify filter setup. 2128 // Verify filter setup.
2167 expect(errorProcessors, hasLength(1)); 2129 expect(errorProcessors, hasLength(1));
2168 expect(getProcessor(unused_local_variable).severity, isNull); 2130 expect(getProcessor(unused_local_variable).severity, isNull);
2169 } 2131 }
2170 2132
2171 test_error_filter_analysis_option_multiple_filters() async { 2133 test_error_filter_analysis_option_multiple_filters() async {
2172 // Create files. 2134 // Create files.
2173 newFile( 2135 newFile([projPath, optionsFileName], r'''
2174 [projPath, optionsFileName],
2175 r'''
2176 analyzer: 2136 analyzer:
2177 errors: 2137 errors:
2178 invalid_assignment: ignore 2138 invalid_assignment: ignore
2179 unused_local_variable: error 2139 unused_local_variable: error
2180 '''); 2140 ''');
2181 // Setup context. 2141 // Setup context.
2182 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 2142 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
2183 2143
2184 // Verify filter setup. 2144 // Verify filter setup.
2185 expect(errorProcessors, hasLength(2)); 2145 expect(errorProcessors, hasLength(2));
2186 2146
2187 expect(getProcessor(invalid_assignment_error).severity, isNull); 2147 expect(getProcessor(invalid_assignment_error).severity, isNull);
2188 expect(getProcessor(unused_local_variable).severity, ErrorSeverity.ERROR); 2148 expect(getProcessor(unused_local_variable).severity, ErrorSeverity.ERROR);
2189 } 2149 }
2190 2150
2191 test_error_filter_analysis_option_synonyms() async { 2151 test_error_filter_analysis_option_synonyms() async {
2192 // Create files. 2152 // Create files.
2193 newFile( 2153 newFile([projPath, optionsFileName], r'''
2194 [projPath, optionsFileName],
2195 r'''
2196 analyzer: 2154 analyzer:
2197 errors: 2155 errors:
2198 unused_local_variable: ignore 2156 unused_local_variable: ignore
2199 ambiguous_import: false 2157 ambiguous_import: false
2200 '''); 2158 ''');
2201 // Setup context. 2159 // Setup context.
2202 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 2160 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
2203 2161
2204 // Verify filter setup. 2162 // Verify filter setup.
2205 expect(errorProcessors, isNotNull); 2163 expect(errorProcessors, isNotNull);
2206 expect(errorProcessors, hasLength(2)); 2164 expect(errorProcessors, hasLength(2));
2207 } 2165 }
2208 2166
2209 test_error_filter_analysis_option_unpsecified() async { 2167 test_error_filter_analysis_option_unpsecified() async {
2210 // Create files. 2168 // Create files.
2211 newFile( 2169 newFile([projPath, optionsFileName], r'''
2212 [projPath, optionsFileName],
2213 r'''
2214 analyzer: 2170 analyzer:
2215 # errors: 2171 # errors:
2216 # unused_local_variable: ignore 2172 # unused_local_variable: ignore
2217 '''); 2173 ''');
2218 // Setup context. 2174 // Setup context.
2219 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 2175 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
2220 2176
2221 // Verify filter setup. 2177 // Verify filter setup.
2222 expect(errorProcessors, isEmpty); 2178 expect(errorProcessors, isEmpty);
2223 } 2179 }
2224 2180
2225 @failingTest 2181 @failingTest
2226 test_optionsFile_update_strongMode() async { 2182 test_optionsFile_update_strongMode() async {
2227 // It appears that this fails because we are not correctly updating the 2183 // It appears that this fails because we are not correctly updating the
2228 // analysis options in the driver when the file is modified. 2184 // analysis options in the driver when the file is modified.
2229 //return super.test_optionsFile_update_strongMode(); 2185 //return super.test_optionsFile_update_strongMode();
2230 // After a few other changes, the test now times out on my machine, so I'm 2186 // After a few other changes, the test now times out on my machine, so I'm
2231 // disabling it in order to prevent it from being flaky. 2187 // disabling it in order to prevent it from being flaky.
2232 fail('Test times out'); 2188 fail('Test times out');
2233 var file = resourceProvider.newFile( 2189 var file = resourceProvider.newFile('$projPath/bin/test.dart', r'''
2234 '$projPath/bin/test.dart',
2235 r'''
2236 main() { 2190 main() {
2237 var paths = <int>[]; 2191 var paths = <int>[];
2238 var names = <String>[]; 2192 var names = <String>[];
2239 paths.addAll(names.map((s) => s.length)); 2193 paths.addAll(names.map((s) => s.length));
2240 } 2194 }
2241 '''); 2195 ''');
2242 resourceProvider.newFile( 2196 resourceProvider.newFile('$projPath/$optionsFileName', r'''
2243 '$projPath/$optionsFileName',
2244 r'''
2245 analyzer: 2197 analyzer:
2246 strong-mode: false 2198 strong-mode: false
2247 '''); 2199 ''');
2248 // Create the context. 2200 // Create the context.
2249 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 2201 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
2250 await pumpEventQueue(); 2202 await pumpEventQueue();
2251 2203
2252 AnalysisResult result = await callbacks.currentDriver.getResult(file.path); 2204 AnalysisResult result = await callbacks.currentDriver.getResult(file.path);
2253 2205
2254 // Not strong mode - both in the context and the SDK context. 2206 // Not strong mode - both in the context and the SDK context.
2255 AnalysisContext sdkContext = sourceFactory.dartSdk.context; 2207 AnalysisContext sdkContext = sourceFactory.dartSdk.context;
2256 expect(analysisOptions.strongMode, isFalse); 2208 expect(analysisOptions.strongMode, isFalse);
2257 expect(sdkContext.analysisOptions.strongMode, isFalse); 2209 expect(sdkContext.analysisOptions.strongMode, isFalse);
2258 expect(result.errors, isEmpty); 2210 expect(result.errors, isEmpty);
2259 2211
2260 // Update the options file - turn on 'strong-mode'. 2212 // Update the options file - turn on 'strong-mode'.
2261 resourceProvider.updateFile( 2213 resourceProvider.updateFile('$projPath/$optionsFileName', r'''
2262 '$projPath/$optionsFileName',
2263 r'''
2264 analyzer: 2214 analyzer:
2265 strong-mode: true 2215 strong-mode: true
2266 '''); 2216 ''');
2267 await pumpEventQueue(); 2217 await pumpEventQueue();
2268 2218
2269 // Strong mode - both in the context and the SDK context. 2219 // Strong mode - both in the context and the SDK context.
2270 result = await callbacks.currentDriver.getResult(file.path); 2220 result = await callbacks.currentDriver.getResult(file.path);
2271 2221
2272 // Not strong mode - both in the context and the SDK context. 2222 // Not strong mode - both in the context and the SDK context.
2273 sdkContext = sourceFactory.dartSdk.context; 2223 sdkContext = sourceFactory.dartSdk.context;
2274 expect(analysisOptions.strongMode, isTrue); 2224 expect(analysisOptions.strongMode, isTrue);
2275 expect(sdkContext.analysisOptions.strongMode, isTrue); 2225 expect(sdkContext.analysisOptions.strongMode, isTrue);
2276 // The code is strong-mode clean. 2226 // The code is strong-mode clean.
2277 // Verify that TypeSystem was reset. 2227 // Verify that TypeSystem was reset.
2278 expect(result.errors, isEmpty); 2228 expect(result.errors, isEmpty);
2279 } 2229 }
2280 2230
2281 @failingTest 2231 @failingTest
2282 test_path_filter_analysis_option() async { 2232 test_path_filter_analysis_option() async {
2283 // This fails because we're not analyzing the analysis options file. 2233 // This fails because we're not analyzing the analysis options file.
2284 // Create files. 2234 // Create files.
2285 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]); 2235 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
2286 newFile([libPath, 'main.dart']); 2236 newFile([libPath, 'main.dart']);
2287 newFile([libPath, 'nope.dart']); 2237 newFile([libPath, 'nope.dart']);
2288 String sdkExtPath = newFolder([projPath, 'sdk_ext']); 2238 String sdkExtPath = newFolder([projPath, 'sdk_ext']);
2289 newFile([sdkExtPath, 'entry.dart']); 2239 newFile([sdkExtPath, 'entry.dart']);
2290 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']); 2240 String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
2291 newFile([sdkExtSrcPath, 'part.dart']); 2241 newFile([sdkExtSrcPath, 'part.dart']);
2292 // Setup analysis options file with ignore list. 2242 // Setup analysis options file with ignore list.
2293 newFile( 2243 newFile([projPath, optionsFileName], r'''
2294 [projPath, optionsFileName],
2295 r'''
2296 analyzer: 2244 analyzer:
2297 exclude: 2245 exclude:
2298 - lib/nope.dart 2246 - lib/nope.dart
2299 - 'sdk_ext/**' 2247 - 'sdk_ext/**'
2300 '''); 2248 ''');
2301 // Setup context. 2249 // Setup context.
2302 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 2250 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
2303 2251
2304 // Verify that analysis options was parsed and the ignore patterns applied. 2252 // Verify that analysis options was parsed and the ignore patterns applied.
2305 Folder projectFolder = resourceProvider.newFolder(projPath); 2253 Folder projectFolder = resourceProvider.newFolder(projPath);
2306 var drivers = manager.getDriversInAnalysisRoot(projectFolder); 2254 var drivers = manager.getDriversInAnalysisRoot(projectFolder);
2307 expect(drivers, hasLength(1)); 2255 expect(drivers, hasLength(1));
2308 AnalysisDriver driver = drivers[0]; 2256 AnalysisDriver driver = drivers[0];
2309 expect( 2257 expect(
2310 driver.addedFiles, 2258 driver.addedFiles,
2311 unorderedEquals( 2259 unorderedEquals(
2312 ['/my/proj/lib/main.dart', '/my/proj/$optionsFileName'])); 2260 ['/my/proj/lib/main.dart', '/my/proj/$optionsFileName']));
2313 } 2261 }
2314 2262
2315 test_path_filter_child_contexts_option() async { 2263 test_path_filter_child_contexts_option() async {
2316 // Create files. 2264 // Create files.
2317 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]); 2265 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
2318 newFile([libPath, 'main.dart']); 2266 newFile([libPath, 'main.dart']);
2319 newFile( 2267 newFile([libPath, 'pubspec.yaml'], r'''
2320 [libPath, 'pubspec.yaml'],
2321 r'''
2322 name: foobar 2268 name: foobar
2323 '''); 2269 ''');
2324 String otherLibPath = newFolder([projPath, 'other_lib']); 2270 String otherLibPath = newFolder([projPath, 'other_lib']);
2325 newFile([otherLibPath, 'entry.dart']); 2271 newFile([otherLibPath, 'entry.dart']);
2326 newFile( 2272 newFile([otherLibPath, 'pubspec.yaml'], r'''
2327 [otherLibPath, 'pubspec.yaml'],
2328 r'''
2329 name: other_lib 2273 name: other_lib
2330 '''); 2274 ''');
2331 // Setup analysis options file with ignore list that ignores the 'other_lib' 2275 // Setup analysis options file with ignore list that ignores the 'other_lib'
2332 // directory by name. 2276 // directory by name.
2333 newFile( 2277 newFile([projPath, optionsFileName], r'''
2334 [projPath, optionsFileName],
2335 r'''
2336 analyzer: 2278 analyzer:
2337 exclude: 2279 exclude:
2338 - 'other_lib' 2280 - 'other_lib'
2339 '''); 2281 ''');
2340 // Setup context. 2282 // Setup context.
2341 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 2283 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
2342 // Verify that the context in other_lib wasn't created and that the 2284 // Verify that the context in other_lib wasn't created and that the
2343 // context in lib was created. 2285 // context in lib was created.
2344 Folder projectFolder = resourceProvider.newFolder(projPath); 2286 Folder projectFolder = resourceProvider.newFolder(projPath);
2345 var drivers = manager.getDriversInAnalysisRoot(projectFolder); 2287 var drivers = manager.getDriversInAnalysisRoot(projectFolder);
2346 expect(drivers, hasLength(2)); 2288 expect(drivers, hasLength(2));
2347 expect(drivers[0].name, equals('/my/proj')); 2289 expect(drivers[0].name, equals('/my/proj'));
2348 expect(drivers[1].name, equals('/my/proj/lib')); 2290 expect(drivers[1].name, equals('/my/proj/lib'));
2349 } 2291 }
2350 2292
2351 test_path_filter_recursive_wildcard_child_contexts_option() async { 2293 test_path_filter_recursive_wildcard_child_contexts_option() async {
2352 // Create files. 2294 // Create files.
2353 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]); 2295 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
2354 newFile([libPath, 'main.dart']); 2296 newFile([libPath, 'main.dart']);
2355 newFile( 2297 newFile([libPath, 'pubspec.yaml'], r'''
2356 [libPath, 'pubspec.yaml'],
2357 r'''
2358 name: foobar 2298 name: foobar
2359 '''); 2299 ''');
2360 String otherLibPath = newFolder([projPath, 'other_lib']); 2300 String otherLibPath = newFolder([projPath, 'other_lib']);
2361 newFile([otherLibPath, 'entry.dart']); 2301 newFile([otherLibPath, 'entry.dart']);
2362 newFile( 2302 newFile([otherLibPath, 'pubspec.yaml'], r'''
2363 [otherLibPath, 'pubspec.yaml'],
2364 r'''
2365 name: other_lib 2303 name: other_lib
2366 '''); 2304 ''');
2367 // Setup analysis options file with ignore list that ignores 'other_lib' 2305 // Setup analysis options file with ignore list that ignores 'other_lib'
2368 // and all descendants. 2306 // and all descendants.
2369 newFile( 2307 newFile([projPath, optionsFileName], r'''
2370 [projPath, optionsFileName],
2371 r'''
2372 analyzer: 2308 analyzer:
2373 exclude: 2309 exclude:
2374 - 'other_lib/**' 2310 - 'other_lib/**'
2375 '''); 2311 ''');
2376 // Setup context. 2312 // Setup context.
2377 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 2313 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
2378 2314
2379 // Verify that the context in other_lib wasn't created and that the 2315 // Verify that the context in other_lib wasn't created and that the
2380 // context in lib was created. 2316 // context in lib was created.
2381 Folder projectFolder = resourceProvider.newFolder(projPath); 2317 Folder projectFolder = resourceProvider.newFolder(projPath);
2382 var drivers = manager.getDriversInAnalysisRoot(projectFolder); 2318 var drivers = manager.getDriversInAnalysisRoot(projectFolder);
2383 expect(drivers, hasLength(2)); 2319 expect(drivers, hasLength(2));
2384 expect(drivers[0].name, equals('/my/proj')); 2320 expect(drivers[0].name, equals('/my/proj'));
2385 expect(drivers[1].name, equals('/my/proj/lib')); 2321 expect(drivers[1].name, equals('/my/proj/lib'));
2386 } 2322 }
2387 2323
2388 test_path_filter_wildcard_child_contexts_option() async { 2324 test_path_filter_wildcard_child_contexts_option() async {
2389 // Create files. 2325 // Create files.
2390 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]); 2326 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
2391 newFile([libPath, 'main.dart']); 2327 newFile([libPath, 'main.dart']);
2392 newFile( 2328 newFile([libPath, 'pubspec.yaml'], r'''
2393 [libPath, 'pubspec.yaml'],
2394 r'''
2395 name: foobar 2329 name: foobar
2396 '''); 2330 ''');
2397 String otherLibPath = newFolder([projPath, 'other_lib']); 2331 String otherLibPath = newFolder([projPath, 'other_lib']);
2398 newFile([otherLibPath, 'entry.dart']); 2332 newFile([otherLibPath, 'entry.dart']);
2399 newFile( 2333 newFile([otherLibPath, 'pubspec.yaml'], r'''
2400 [otherLibPath, 'pubspec.yaml'],
2401 r'''
2402 name: other_lib 2334 name: other_lib
2403 '''); 2335 ''');
2404 // Setup analysis options file with ignore list that ignores 'other_lib' 2336 // Setup analysis options file with ignore list that ignores 'other_lib'
2405 // and all immediate children. 2337 // and all immediate children.
2406 newFile( 2338 newFile([projPath, optionsFileName], r'''
2407 [projPath, optionsFileName],
2408 r'''
2409 analyzer: 2339 analyzer:
2410 exclude: 2340 exclude:
2411 - 'other_lib/*' 2341 - 'other_lib/*'
2412 '''); 2342 ''');
2413 // Setup context / driver. 2343 // Setup context / driver.
2414 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 2344 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
2415 2345
2416 Folder projectFolder = resourceProvider.newFolder(projPath); 2346 Folder projectFolder = resourceProvider.newFolder(projPath);
2417 var drivers = manager.getDriversInAnalysisRoot(projectFolder); 2347 var drivers = manager.getDriversInAnalysisRoot(projectFolder);
2418 expect(drivers, hasLength(2)); 2348 expect(drivers, hasLength(2));
2419 expect(drivers[0].name, equals('/my/proj')); 2349 expect(drivers[0].name, equals('/my/proj'));
2420 expect(drivers[1].name, equals('/my/proj/lib')); 2350 expect(drivers[1].name, equals('/my/proj/lib'));
2421 } 2351 }
2422 2352
2423 void test_setRoots_nested_excludedByOuter() { 2353 void test_setRoots_nested_excludedByOuter() {
2424 String project = '/project'; 2354 String project = '/project';
2425 String projectPubspec = '$project/pubspec.yaml'; 2355 String projectPubspec = '$project/pubspec.yaml';
2426 String example = '$project/example'; 2356 String example = '$project/example';
2427 String examplePubspec = '$example/pubspec.yaml'; 2357 String examplePubspec = '$example/pubspec.yaml';
2428 // create files 2358 // create files
2429 resourceProvider.newFile(projectPubspec, 'name: project'); 2359 resourceProvider.newFile(projectPubspec, 'name: project');
2430 resourceProvider.newFile(examplePubspec, 'name: example'); 2360 resourceProvider.newFile(examplePubspec, 'name: example');
2431 newFile( 2361 newFile([project, optionsFileName], r'''
2432 [project, optionsFileName],
2433 r'''
2434 analyzer: 2362 analyzer:
2435 exclude: 2363 exclude:
2436 - 'example' 2364 - 'example'
2437 '''); 2365 ''');
2438 manager 2366 manager
2439 .setRoots(<String>[project, example], <String>[], <String, String>{}); 2367 .setRoots(<String>[project, example], <String>[], <String, String>{});
2440 // verify 2368 // verify
2441 { 2369 {
2442 ContextInfo rootInfo = manager.rootInfo; 2370 ContextInfo rootInfo = manager.rootInfo;
2443 expect(rootInfo.children, hasLength(1)); 2371 expect(rootInfo.children, hasLength(1));
(...skipping 13 matching lines...) Expand all
2457 } 2385 }
2458 2386
2459 void test_setRoots_nested_excludedByOuter_deep() { 2387 void test_setRoots_nested_excludedByOuter_deep() {
2460 String a = '/a'; 2388 String a = '/a';
2461 String c = '$a/b/c'; 2389 String c = '$a/b/c';
2462 String aPubspec = '$a/pubspec.yaml'; 2390 String aPubspec = '$a/pubspec.yaml';
2463 String cPubspec = '$c/pubspec.yaml'; 2391 String cPubspec = '$c/pubspec.yaml';
2464 // create files 2392 // create files
2465 resourceProvider.newFile(aPubspec, 'name: aaa'); 2393 resourceProvider.newFile(aPubspec, 'name: aaa');
2466 resourceProvider.newFile(cPubspec, 'name: ccc'); 2394 resourceProvider.newFile(cPubspec, 'name: ccc');
2467 newFile( 2395 newFile([a, optionsFileName], r'''
2468 [a, optionsFileName],
2469 r'''
2470 analyzer: 2396 analyzer:
2471 exclude: 2397 exclude:
2472 - 'b**' 2398 - 'b**'
2473 '''); 2399 ''');
2474 manager.setRoots(<String>[a, c], <String>[], <String, String>{}); 2400 manager.setRoots(<String>[a, c], <String>[], <String, String>{});
2475 // verify 2401 // verify
2476 { 2402 {
2477 ContextInfo rootInfo = manager.rootInfo; 2403 ContextInfo rootInfo = manager.rootInfo;
2478 expect(rootInfo.children, hasLength(1)); 2404 expect(rootInfo.children, hasLength(1));
2479 { 2405 {
2480 ContextInfo aInfo = rootInfo.children[0]; 2406 ContextInfo aInfo = rootInfo.children[0];
2481 expect(aInfo.folder.path, a); 2407 expect(aInfo.folder.path, a);
2482 expect(aInfo.children, hasLength(1)); 2408 expect(aInfo.children, hasLength(1));
2483 { 2409 {
2484 ContextInfo cInfo = aInfo.children[0]; 2410 ContextInfo cInfo = aInfo.children[0];
2485 expect(cInfo.folder.path, c); 2411 expect(cInfo.folder.path, c);
2486 expect(cInfo.children, isEmpty); 2412 expect(cInfo.children, isEmpty);
2487 } 2413 }
2488 } 2414 }
2489 } 2415 }
2490 expect(callbacks.currentContextRoots, hasLength(2)); 2416 expect(callbacks.currentContextRoots, hasLength(2));
2491 expect(callbacks.currentContextRoots, unorderedEquals([a, c])); 2417 expect(callbacks.currentContextRoots, unorderedEquals([a, c]));
2492 } 2418 }
2493 2419
2494 test_strong_mode_analysis_option() async { 2420 test_strong_mode_analysis_option() async {
2495 // Create files. 2421 // Create files.
2496 newFile( 2422 newFile([projPath, optionsFileName], r'''
2497 [projPath, optionsFileName],
2498 r'''
2499 analyzer: 2423 analyzer:
2500 strong-mode: true 2424 strong-mode: true
2501 '''); 2425 ''');
2502 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]); 2426 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
2503 newFile([libPath, 'main.dart']); 2427 newFile([libPath, 'main.dart']);
2504 // Setup context. 2428 // Setup context.
2505 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 2429 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
2506 // Verify that analysis options was parsed and strong-mode set. 2430 // Verify that analysis options was parsed and strong-mode set.
2507 expect(analysisOptions.strongMode, true); 2431 expect(analysisOptions.strongMode, true);
2508 } 2432 }
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
2762 class TestUriResolver extends UriResolver { 2686 class TestUriResolver extends UriResolver {
2763 Map<Uri, Source> uriMap; 2687 Map<Uri, Source> uriMap;
2764 2688
2765 TestUriResolver(this.uriMap); 2689 TestUriResolver(this.uriMap);
2766 2690
2767 @override 2691 @override
2768 Source resolveAbsolute(Uri uri, [Uri actualUri]) { 2692 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
2769 return uriMap[uri]; 2693 return uriMap[uri];
2770 } 2694 }
2771 } 2695 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/completion_test.dart ('k') | pkg/analysis_server/test/domain_analysis_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698