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 3353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3364 computeLibrarySourceErrors(source); | 3364 computeLibrarySourceErrors(source); |
3365 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); | 3365 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); |
3366 } | 3366 } |
3367 | 3367 |
3368 void test_undefinedIdentifier_function() { | 3368 void test_undefinedIdentifier_function() { |
3369 Source source = addSource("int a() => b;"); | 3369 Source source = addSource("int a() => b;"); |
3370 computeLibrarySourceErrors(source); | 3370 computeLibrarySourceErrors(source); |
3371 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); | 3371 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); |
3372 } | 3372 } |
3373 | 3373 |
| 3374 void test_undefinedIdentifier_importCore_withShow() { |
| 3375 Source source = addSource(r''' |
| 3376 import 'dart:core' show List; |
| 3377 main() { |
| 3378 List; |
| 3379 String; |
| 3380 }'''); |
| 3381 computeLibrarySourceErrors(source); |
| 3382 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); |
| 3383 } |
| 3384 |
3374 void test_undefinedIdentifier_initializer() { | 3385 void test_undefinedIdentifier_initializer() { |
3375 Source source = addSource("var a = b;"); | 3386 Source source = addSource("var a = b;"); |
3376 computeLibrarySourceErrors(source); | 3387 computeLibrarySourceErrors(source); |
3377 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); | 3388 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); |
3378 } | 3389 } |
3379 | 3390 |
3380 void test_undefinedIdentifier_methodInvocation() { | 3391 void test_undefinedIdentifier_methodInvocation() { |
3381 Source source = addSource("f() { C.m(); }"); | 3392 Source source = addSource("f() { C.m(); }"); |
3382 computeLibrarySourceErrors(source); | 3393 computeLibrarySourceErrors(source); |
3383 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); | 3394 assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3501 | 3512 |
3502 void test_voidReturnForGetter() { | 3513 void test_voidReturnForGetter() { |
3503 Source source = addSource(r''' | 3514 Source source = addSource(r''' |
3504 class S { | 3515 class S { |
3505 void get value {} | 3516 void get value {} |
3506 }'''); | 3517 }'''); |
3507 computeLibrarySourceErrors(source); | 3518 computeLibrarySourceErrors(source); |
3508 assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]); | 3519 assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]); |
3509 } | 3520 } |
3510 } | 3521 } |
OLD | NEW |