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.hint_code_test; | 5 library analyzer.test.generated.hint_code_test; |
6 | 6 |
7 import 'package:analyzer/src/generated/engine.dart'; | 7 import 'package:analyzer/src/generated/engine.dart'; |
8 import 'package:analyzer/src/generated/error.dart'; | 8 import 'package:analyzer/src/generated/error.dart'; |
9 import 'package:analyzer/src/generated/source_io.dart'; | 9 import 'package:analyzer/src/generated/source_io.dart'; |
10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 verify([source]); | 1316 verify([source]); |
1317 } | 1317 } |
1318 | 1318 |
1319 void test_missingReturn_function() { | 1319 void test_missingReturn_function() { |
1320 Source source = addSource("int f() {}"); | 1320 Source source = addSource("int f() {}"); |
1321 computeLibrarySourceErrors(source); | 1321 computeLibrarySourceErrors(source); |
1322 assertErrors(source, [HintCode.MISSING_RETURN]); | 1322 assertErrors(source, [HintCode.MISSING_RETURN]); |
1323 verify([source]); | 1323 verify([source]); |
1324 } | 1324 } |
1325 | 1325 |
| 1326 void test_missingReturn_factory() { |
| 1327 Source source = addSource(r''' |
| 1328 class A { |
| 1329 factory A() {} |
| 1330 } |
| 1331 '''); |
| 1332 computeLibrarySourceErrors(source); |
| 1333 assertErrors(source, [HintCode.MISSING_RETURN]); |
| 1334 verify([source]); |
| 1335 } |
| 1336 |
1326 void test_missingReturn_method() { | 1337 void test_missingReturn_method() { |
1327 Source source = addSource(r''' | 1338 Source source = addSource(r''' |
1328 class A { | 1339 class A { |
1329 int m() {} | 1340 int m() {} |
1330 }'''); | 1341 }'''); |
1331 computeLibrarySourceErrors(source); | 1342 computeLibrarySourceErrors(source); |
1332 assertErrors(source, [HintCode.MISSING_RETURN]); | 1343 assertErrors(source, [HintCode.MISSING_RETURN]); |
1333 verify([source]); | 1344 verify([source]); |
1334 } | 1345 } |
1335 | 1346 |
(...skipping 1950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3286 n() { | 3297 n() { |
3287 var a = m(), b = m(); | 3298 var a = m(), b = m(); |
3288 } | 3299 } |
3289 }'''); | 3300 }'''); |
3290 computeLibrarySourceErrors(source); | 3301 computeLibrarySourceErrors(source); |
3291 assertErrors( | 3302 assertErrors( |
3292 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]); | 3303 source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]); |
3293 verify([source]); | 3304 verify([source]); |
3294 } | 3305 } |
3295 } | 3306 } |
OLD | NEW |