Chromium Code Reviews| 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 engine.static_warning_code_test; | 5 library engine.static_warning_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 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 | 10 |
| (...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1265 } | 1265 } |
| 1266 | 1266 |
| 1267 void test_exportDuplicatedLibraryUnnamed() { | 1267 void test_exportDuplicatedLibraryUnnamed() { |
| 1268 Source source = addSource(r''' | 1268 Source source = addSource(r''' |
| 1269 library test; | 1269 library test; |
| 1270 export 'lib1.dart'; | 1270 export 'lib1.dart'; |
| 1271 export 'lib2.dart';'''); | 1271 export 'lib2.dart';'''); |
| 1272 addNamedSource("/lib1.dart", ""); | 1272 addNamedSource("/lib1.dart", ""); |
| 1273 addNamedSource("/lib2.dart", ""); | 1273 addNamedSource("/lib2.dart", ""); |
| 1274 computeLibrarySourceErrors(source); | 1274 computeLibrarySourceErrors(source); |
| 1275 assertErrors(source, [StaticWarningCode.EXPORT_DUPLICATED_LIBRARY_UNNAMED]); | 1275 assertErrors(source, [ |
|
Paul Berry
2015/08/20 20:57:37
Use assertNoErrors() and move this test into the N
pquitslund
2015/08/20 21:23:43
Good call. Done!
| |
| 1276 // No warning (https://github.com/dart-lang/sdk/issues/24156) | |
| 1277 ]); | |
| 1276 verify([source]); | 1278 verify([source]); |
| 1277 } | 1279 } |
| 1278 | 1280 |
| 1279 void test_extraPositionalArguments() { | 1281 void test_extraPositionalArguments() { |
| 1280 Source source = addSource(r''' | 1282 Source source = addSource(r''' |
| 1281 f() {} | 1283 f() {} |
| 1282 main() { | 1284 main() { |
| 1283 f(0, 1, '2'); | 1285 f(0, 1, '2'); |
| 1284 }'''); | 1286 }'''); |
| 1285 computeLibrarySourceErrors(source); | 1287 computeLibrarySourceErrors(source); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1490 | 1492 |
| 1491 void test_importDuplicatedLibraryUnnamed() { | 1493 void test_importDuplicatedLibraryUnnamed() { |
| 1492 Source source = addSource(r''' | 1494 Source source = addSource(r''' |
| 1493 library test; | 1495 library test; |
| 1494 import 'lib1.dart'; | 1496 import 'lib1.dart'; |
| 1495 import 'lib2.dart';'''); | 1497 import 'lib2.dart';'''); |
| 1496 addNamedSource("/lib1.dart", ""); | 1498 addNamedSource("/lib1.dart", ""); |
| 1497 addNamedSource("/lib2.dart", ""); | 1499 addNamedSource("/lib2.dart", ""); |
| 1498 computeLibrarySourceErrors(source); | 1500 computeLibrarySourceErrors(source); |
| 1499 assertErrors(source, [ | 1501 assertErrors(source, [ |
| 1500 StaticWarningCode.IMPORT_DUPLICATED_LIBRARY_UNNAMED, | 1502 // No warning (https://github.com/dart-lang/sdk/issues/24156) |
|
Paul Berry
2015/08/20 20:57:37
I think this test should be moved into NonErrorRes
pquitslund
2015/08/20 21:23:43
Works for me. Done.
| |
| 1501 HintCode.UNUSED_IMPORT, | 1503 HintCode.UNUSED_IMPORT, |
| 1502 HintCode.UNUSED_IMPORT | 1504 HintCode.UNUSED_IMPORT |
| 1503 ]); | 1505 ]); |
| 1504 verify([source]); | 1506 verify([source]); |
| 1505 } | 1507 } |
| 1506 | 1508 |
| 1507 void test_importOfNonLibrary() { | 1509 void test_importOfNonLibrary() { |
| 1508 resolveWithErrors(<String>[ | 1510 resolveWithErrors(<String>[ |
| 1509 r''' | 1511 r''' |
| 1510 part of lib; | 1512 part of lib; |
| (...skipping 2096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3607 | 3609 |
| 3608 void test_voidReturnForGetter() { | 3610 void test_voidReturnForGetter() { |
| 3609 Source source = addSource(r''' | 3611 Source source = addSource(r''' |
| 3610 class S { | 3612 class S { |
| 3611 void get value {} | 3613 void get value {} |
| 3612 }'''); | 3614 }'''); |
| 3613 computeLibrarySourceErrors(source); | 3615 computeLibrarySourceErrors(source); |
| 3614 assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]); | 3616 assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]); |
| 3615 } | 3617 } |
| 3616 } | 3618 } |
| OLD | NEW |