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

Side by Side Diff: pkg/analyzer/test/generated/non_hint_code_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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 analyzer.test.generated.non_hint_code_test; 5 library analyzer.test.generated.non_hint_code_test;
6 6
7 import 'package:analyzer/error/error.dart'; 7 import 'package:analyzer/error/error.dart';
8 import 'package:analyzer/src/error/codes.dart'; 8 import 'package:analyzer/src/error/codes.dart';
9 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/source_io.dart'; 10 import 'package:analyzer/src/generated/source_io.dart';
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 verify([source]); 95 verify([source]);
96 } 96 }
97 97
98 test_deadCode_deadBlock_if_debugConst_prefixedIdentifier2() async { 98 test_deadCode_deadBlock_if_debugConst_prefixedIdentifier2() async {
99 Source source = addSource(r''' 99 Source source = addSource(r'''
100 library L; 100 library L;
101 import 'lib2.dart'; 101 import 'lib2.dart';
102 f() { 102 f() {
103 if(A.DEBUG) {} 103 if(A.DEBUG) {}
104 }'''); 104 }''');
105 addNamedSource( 105 addNamedSource("/lib2.dart", r'''
106 "/lib2.dart",
107 r'''
108 library lib2; 106 library lib2;
109 class A { 107 class A {
110 static const bool DEBUG = false; 108 static const bool DEBUG = false;
111 }'''); 109 }''');
112 await computeAnalysisResult(source); 110 await computeAnalysisResult(source);
113 assertNoErrors(source); 111 assertNoErrors(source);
114 verify([source]); 112 verify([source]);
115 } 113 }
116 114
117 test_deadCode_deadBlock_if_debugConst_propertyAccessor() async { 115 test_deadCode_deadBlock_if_debugConst_propertyAccessor() async {
118 Source source = addSource(r''' 116 Source source = addSource(r'''
119 library L; 117 library L;
120 import 'lib2.dart' as LIB; 118 import 'lib2.dart' as LIB;
121 f() { 119 f() {
122 if(LIB.A.DEBUG) {} 120 if(LIB.A.DEBUG) {}
123 }'''); 121 }''');
124 addNamedSource( 122 addNamedSource("/lib2.dart", r'''
125 "/lib2.dart",
126 r'''
127 library lib2; 123 library lib2;
128 class A { 124 class A {
129 static const bool DEBUG = false; 125 static const bool DEBUG = false;
130 }'''); 126 }''');
131 await computeAnalysisResult(source); 127 await computeAnalysisResult(source);
132 assertNoErrors(source); 128 assertNoErrors(source);
133 verify([source]); 129 verify([source]);
134 } 130 }
135 131
136 test_deadCode_deadBlock_if_debugConst_simpleIdentifier() async { 132 test_deadCode_deadBlock_if_debugConst_simpleIdentifier() async {
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 verify([source]); 337 verify([source]);
342 } 338 }
343 339
344 test_duplicateImport_as() async { 340 test_duplicateImport_as() async {
345 Source source = addSource(r''' 341 Source source = addSource(r'''
346 library L; 342 library L;
347 import 'lib1.dart'; 343 import 'lib1.dart';
348 import 'lib1.dart' as one; 344 import 'lib1.dart' as one;
349 A a; 345 A a;
350 one.A a2;'''); 346 one.A a2;''');
351 addNamedSource( 347 addNamedSource("/lib1.dart", r'''
352 "/lib1.dart",
353 r'''
354 library lib1; 348 library lib1;
355 class A {}'''); 349 class A {}''');
356 await computeAnalysisResult(source); 350 await computeAnalysisResult(source);
357 assertNoErrors(source); 351 assertNoErrors(source);
358 verify([source]); 352 verify([source]);
359 } 353 }
360 354
361 test_duplicateImport_hide() async { 355 test_duplicateImport_hide() async {
362 Source source = addSource(r''' 356 Source source = addSource(r'''
363 library L; 357 library L;
364 import 'lib1.dart'; 358 import 'lib1.dart';
365 import 'lib1.dart' hide A; 359 import 'lib1.dart' hide A;
366 A a; 360 A a;
367 B b;'''); 361 B b;''');
368 addNamedSource( 362 addNamedSource("/lib1.dart", r'''
369 "/lib1.dart",
370 r'''
371 library lib1; 363 library lib1;
372 class A {} 364 class A {}
373 class B {}'''); 365 class B {}''');
374 await computeAnalysisResult(source); 366 await computeAnalysisResult(source);
375 assertNoErrors(source); 367 assertNoErrors(source);
376 verify([source]); 368 verify([source]);
377 } 369 }
378 370
379 test_duplicateImport_show() async { 371 test_duplicateImport_show() async {
380 Source source = addSource(r''' 372 Source source = addSource(r'''
381 library L; 373 library L;
382 import 'lib1.dart'; 374 import 'lib1.dart';
383 import 'lib1.dart' show A; 375 import 'lib1.dart' show A;
384 A a; 376 A a;
385 B b;'''); 377 B b;''');
386 addNamedSource( 378 addNamedSource("/lib1.dart", r'''
387 "/lib1.dart",
388 r'''
389 library lib1; 379 library lib1;
390 class A {} 380 class A {}
391 class B {}'''); 381 class B {}''');
392 await computeAnalysisResult(source); 382 await computeAnalysisResult(source);
393 assertNoErrors(source); 383 assertNoErrors(source);
394 verify([source]); 384 verify([source]);
395 } 385 }
396 386
397 test_importDeferredLibraryWithLoadFunction() async { 387 test_importDeferredLibraryWithLoadFunction() async {
398 await resolveWithErrors(<String>[ 388 await resolveWithErrors(<String>[
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 await computeAnalysisResult(source); 1041 await computeAnalysisResult(source);
1052 assertNoErrors(source); 1042 assertNoErrors(source);
1053 verify([source]); 1043 verify([source]);
1054 } 1044 }
1055 1045
1056 test_unusedImport_annotationOnDirective() async { 1046 test_unusedImport_annotationOnDirective() async {
1057 Source source = addSource(r''' 1047 Source source = addSource(r'''
1058 library L; 1048 library L;
1059 @A() 1049 @A()
1060 import 'lib1.dart';'''); 1050 import 'lib1.dart';''');
1061 Source source2 = addNamedSource( 1051 Source source2 = addNamedSource("/lib1.dart", r'''
1062 "/lib1.dart",
1063 r'''
1064 library lib1; 1052 library lib1;
1065 class A { 1053 class A {
1066 const A() {} 1054 const A() {}
1067 }'''); 1055 }''');
1068 await computeAnalysisResult(source); 1056 await computeAnalysisResult(source);
1069 await computeAnalysisResult(source2); 1057 await computeAnalysisResult(source2);
1070 assertErrors(source); 1058 assertErrors(source);
1071 verify([source, source2]); 1059 verify([source, source2]);
1072 } 1060 }
1073 1061
1074 test_unusedImport_as_equalPrefixes() async { 1062 test_unusedImport_as_equalPrefixes() async {
1075 // 18818 1063 // 18818
1076 Source source = addSource(r''' 1064 Source source = addSource(r'''
1077 library L; 1065 library L;
1078 import 'lib1.dart' as one; 1066 import 'lib1.dart' as one;
1079 import 'lib2.dart' as one; 1067 import 'lib2.dart' as one;
1080 one.A a; 1068 one.A a;
1081 one.B b;'''); 1069 one.B b;''');
1082 Source source2 = addNamedSource( 1070 Source source2 = addNamedSource("/lib1.dart", r'''
1083 "/lib1.dart",
1084 r'''
1085 library lib1; 1071 library lib1;
1086 class A {}'''); 1072 class A {}''');
1087 Source source3 = addNamedSource( 1073 Source source3 = addNamedSource("/lib2.dart", r'''
1088 "/lib2.dart",
1089 r'''
1090 library lib2; 1074 library lib2;
1091 class B {}'''); 1075 class B {}''');
1092 await computeAnalysisResult(source); 1076 await computeAnalysisResult(source);
1093 await computeAnalysisResult(source2); 1077 await computeAnalysisResult(source2);
1094 await computeAnalysisResult(source3); 1078 await computeAnalysisResult(source3);
1095 assertErrors(source); 1079 assertErrors(source);
1096 assertNoErrors(source2); 1080 assertNoErrors(source2);
1097 assertNoErrors(source3); 1081 assertNoErrors(source3);
1098 verify([source, source2, source3]); 1082 verify([source, source2, source3]);
1099 } 1083 }
1100 1084
1101 test_unusedImport_core_library() async { 1085 test_unusedImport_core_library() async {
1102 Source source = addSource(r''' 1086 Source source = addSource(r'''
1103 library L; 1087 library L;
1104 import 'dart:core';'''); 1088 import 'dart:core';''');
1105 await computeAnalysisResult(source); 1089 await computeAnalysisResult(source);
1106 assertNoErrors(source); 1090 assertNoErrors(source);
1107 verify([source]); 1091 verify([source]);
1108 } 1092 }
1109 1093
1110 test_unusedImport_export() async { 1094 test_unusedImport_export() async {
1111 Source source = addSource(r''' 1095 Source source = addSource(r'''
1112 library L; 1096 library L;
1113 import 'lib1.dart'; 1097 import 'lib1.dart';
1114 Two two;'''); 1098 Two two;''');
1115 addNamedSource( 1099 addNamedSource("/lib1.dart", r'''
1116 "/lib1.dart",
1117 r'''
1118 library lib1; 1100 library lib1;
1119 export 'lib2.dart'; 1101 export 'lib2.dart';
1120 class One {}'''); 1102 class One {}''');
1121 addNamedSource( 1103 addNamedSource("/lib2.dart", r'''
1122 "/lib2.dart",
1123 r'''
1124 library lib2; 1104 library lib2;
1125 class Two {}'''); 1105 class Two {}''');
1126 await computeAnalysisResult(source); 1106 await computeAnalysisResult(source);
1127 assertNoErrors(source); 1107 assertNoErrors(source);
1128 verify([source]); 1108 verify([source]);
1129 } 1109 }
1130 1110
1131 test_unusedImport_export2() async { 1111 test_unusedImport_export2() async {
1132 Source source = addSource(r''' 1112 Source source = addSource(r'''
1133 library L; 1113 library L;
1134 import 'lib1.dart'; 1114 import 'lib1.dart';
1135 Three three;'''); 1115 Three three;''');
1136 addNamedSource( 1116 addNamedSource("/lib1.dart", r'''
1137 "/lib1.dart",
1138 r'''
1139 library lib1; 1117 library lib1;
1140 export 'lib2.dart'; 1118 export 'lib2.dart';
1141 class One {}'''); 1119 class One {}''');
1142 addNamedSource( 1120 addNamedSource("/lib2.dart", r'''
1143 "/lib2.dart",
1144 r'''
1145 library lib2; 1121 library lib2;
1146 export 'lib3.dart'; 1122 export 'lib3.dart';
1147 class Two {}'''); 1123 class Two {}''');
1148 addNamedSource( 1124 addNamedSource("/lib3.dart", r'''
1149 "/lib3.dart",
1150 r'''
1151 library lib3; 1125 library lib3;
1152 class Three {}'''); 1126 class Three {}''');
1153 await computeAnalysisResult(source); 1127 await computeAnalysisResult(source);
1154 assertNoErrors(source); 1128 assertNoErrors(source);
1155 verify([source]); 1129 verify([source]);
1156 } 1130 }
1157 1131
1158 test_unusedImport_export_infiniteLoop() async { 1132 test_unusedImport_export_infiniteLoop() async {
1159 Source source = addSource(r''' 1133 Source source = addSource(r'''
1160 library L; 1134 library L;
1161 import 'lib1.dart'; 1135 import 'lib1.dart';
1162 Two two;'''); 1136 Two two;''');
1163 addNamedSource( 1137 addNamedSource("/lib1.dart", r'''
1164 "/lib1.dart",
1165 r'''
1166 library lib1; 1138 library lib1;
1167 export 'lib2.dart'; 1139 export 'lib2.dart';
1168 class One {}'''); 1140 class One {}''');
1169 addNamedSource( 1141 addNamedSource("/lib2.dart", r'''
1170 "/lib2.dart",
1171 r'''
1172 library lib2; 1142 library lib2;
1173 export 'lib3.dart'; 1143 export 'lib3.dart';
1174 class Two {}'''); 1144 class Two {}''');
1175 addNamedSource( 1145 addNamedSource("/lib3.dart", r'''
1176 "/lib3.dart",
1177 r'''
1178 library lib3; 1146 library lib3;
1179 export 'lib2.dart'; 1147 export 'lib2.dart';
1180 class Three {}'''); 1148 class Three {}''');
1181 await computeAnalysisResult(source); 1149 await computeAnalysisResult(source);
1182 assertNoErrors(source); 1150 assertNoErrors(source);
1183 verify([source]); 1151 verify([source]);
1184 } 1152 }
1185 1153
1186 test_unusedImport_metadata() async { 1154 test_unusedImport_metadata() async {
1187 Source source = addSource(r''' 1155 Source source = addSource(r'''
1188 library L; 1156 library L;
1189 @A(x) 1157 @A(x)
1190 import 'lib1.dart'; 1158 import 'lib1.dart';
1191 class A { 1159 class A {
1192 final int value; 1160 final int value;
1193 const A(this.value); 1161 const A(this.value);
1194 }'''); 1162 }''');
1195 addNamedSource( 1163 addNamedSource("/lib1.dart", r'''
1196 "/lib1.dart",
1197 r'''
1198 library lib1; 1164 library lib1;
1199 const x = 0;'''); 1165 const x = 0;''');
1200 await computeAnalysisResult(source); 1166 await computeAnalysisResult(source);
1201 assertNoErrors(source); 1167 assertNoErrors(source);
1202 verify([source]); 1168 verify([source]);
1203 } 1169 }
1204 1170
1205 test_unusedImport_prefix_topLevelFunction() async { 1171 test_unusedImport_prefix_topLevelFunction() async {
1206 Source source = addSource(r''' 1172 Source source = addSource(r'''
1207 library L; 1173 library L;
1208 import 'lib1.dart' hide topLevelFunction; 1174 import 'lib1.dart' hide topLevelFunction;
1209 import 'lib1.dart' as one show topLevelFunction; 1175 import 'lib1.dart' as one show topLevelFunction;
1210 class A { 1176 class A {
1211 static void x() { 1177 static void x() {
1212 One o; 1178 One o;
1213 one.topLevelFunction(); 1179 one.topLevelFunction();
1214 } 1180 }
1215 }'''); 1181 }''');
1216 addNamedSource( 1182 addNamedSource("/lib1.dart", r'''
1217 "/lib1.dart",
1218 r'''
1219 library lib1; 1183 library lib1;
1220 class One {} 1184 class One {}
1221 topLevelFunction() {}'''); 1185 topLevelFunction() {}''');
1222 await computeAnalysisResult(source); 1186 await computeAnalysisResult(source);
1223 assertNoErrors(source); 1187 assertNoErrors(source);
1224 verify([source]); 1188 verify([source]);
1225 } 1189 }
1226 1190
1227 test_unusedImport_prefix_topLevelFunction2() async { 1191 test_unusedImport_prefix_topLevelFunction2() async {
1228 Source source = addSource(r''' 1192 Source source = addSource(r'''
1229 library L; 1193 library L;
1230 import 'lib1.dart' hide topLevelFunction; 1194 import 'lib1.dart' hide topLevelFunction;
1231 import 'lib1.dart' as one show topLevelFunction; 1195 import 'lib1.dart' as one show topLevelFunction;
1232 import 'lib1.dart' as two show topLevelFunction; 1196 import 'lib1.dart' as two show topLevelFunction;
1233 class A { 1197 class A {
1234 static void x() { 1198 static void x() {
1235 One o; 1199 One o;
1236 one.topLevelFunction(); 1200 one.topLevelFunction();
1237 two.topLevelFunction(); 1201 two.topLevelFunction();
1238 } 1202 }
1239 }'''); 1203 }''');
1240 addNamedSource( 1204 addNamedSource("/lib1.dart", r'''
1241 "/lib1.dart",
1242 r'''
1243 library lib1; 1205 library lib1;
1244 class One {} 1206 class One {}
1245 topLevelFunction() {}'''); 1207 topLevelFunction() {}''');
1246 await computeAnalysisResult(source); 1208 await computeAnalysisResult(source);
1247 assertNoErrors(source); 1209 assertNoErrors(source);
1248 verify([source]); 1210 verify([source]);
1249 } 1211 }
1250 1212
1251 test_useOfVoidResult_implicitReturnValue() async { 1213 test_useOfVoidResult_implicitReturnValue() async {
1252 Source source = addSource(r''' 1214 Source source = addSource(r'''
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 1333
1372 test_import_valid_outside_lib() async { 1334 test_import_valid_outside_lib() async {
1373 addNamedSource("/myproj/pubspec.yaml", ""); 1335 addNamedSource("/myproj/pubspec.yaml", "");
1374 addNamedSource("/myproj/web/other.dart", ""); 1336 addNamedSource("/myproj/web/other.dart", "");
1375 Source source = 1337 Source source =
1376 addNamedSource("/myproj/lib2/test.dart", "import '../web/other.dart';"); 1338 addNamedSource("/myproj/lib2/test.dart", "import '../web/other.dart';");
1377 await computeAnalysisResult(source); 1339 await computeAnalysisResult(source);
1378 assertNoErrors(source); 1340 assertNoErrors(source);
1379 } 1341 }
1380 } 1342 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/non_error_resolver_test.dart ('k') | pkg/analyzer/test/generated/package_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698