OLD | NEW |
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/src/generated/error.dart'; | 7 import 'package:analyzer/src/generated/error.dart'; |
8 import 'package:analyzer/src/generated/source_io.dart'; | 8 import 'package:analyzer/src/generated/source_io.dart'; |
9 | 9 |
10 import '../reflective_tests.dart'; | 10 import '../reflective_tests.dart'; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 Source source = addSource(r''' | 151 Source source = addSource(r''' |
152 const bool DEBUG = true; | 152 const bool DEBUG = true; |
153 f() { | 153 f() { |
154 bool b = DEBUG || true; | 154 bool b = DEBUG || true; |
155 }'''); | 155 }'''); |
156 computeLibrarySourceErrors(source); | 156 computeLibrarySourceErrors(source); |
157 assertNoErrors(source); | 157 assertNoErrors(source); |
158 verify([source]); | 158 verify([source]); |
159 } | 159 } |
160 | 160 |
| 161 void test_deadCode_statementAfterIfWithoutElse() { |
| 162 Source source = addSource(r''' |
| 163 f() { |
| 164 if (1 < 0) { |
| 165 return; |
| 166 } |
| 167 int a = 1; |
| 168 }'''); |
| 169 computeLibrarySourceErrors(source); |
| 170 assertNoErrors(source); |
| 171 verify([source]); |
| 172 } |
| 173 |
161 void test_deprecatedMemberUse_inDeprecatedClass() { | 174 void test_deprecatedMemberUse_inDeprecatedClass() { |
162 Source source = addSource(r''' | 175 Source source = addSource(r''' |
163 @deprecated | 176 @deprecated |
164 f() {} | 177 f() {} |
165 | 178 |
166 @deprecated | 179 @deprecated |
167 class C { | 180 class C { |
168 m() { | 181 m() { |
169 f(); | 182 f(); |
170 } | 183 } |
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 | 1239 |
1227 void test_import_valid_outside_lib() { | 1240 void test_import_valid_outside_lib() { |
1228 cacheSource("/myproj/pubspec.yaml", ""); | 1241 cacheSource("/myproj/pubspec.yaml", ""); |
1229 cacheSource("/myproj/web/other.dart", ""); | 1242 cacheSource("/myproj/web/other.dart", ""); |
1230 Source source = | 1243 Source source = |
1231 addNamedSource("/myproj/lib2/test.dart", "import '../web/other.dart';"); | 1244 addNamedSource("/myproj/lib2/test.dart", "import '../web/other.dart';"); |
1232 computeLibrarySourceErrors(source); | 1245 computeLibrarySourceErrors(source); |
1233 assertNoErrors(source); | 1246 assertNoErrors(source); |
1234 } | 1247 } |
1235 } | 1248 } |
OLD | NEW |