| 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/parser.dart' show ParserErrorCode; | 8 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode; |
| 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 3290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3301 } | 3301 } |
| 3302 | 3302 |
| 3303 void test_typeTestNonType() { | 3303 void test_typeTestNonType() { |
| 3304 Source source = addSource(r''' | 3304 Source source = addSource(r''' |
| 3305 var A = 0; | 3305 var A = 0; |
| 3306 f(var p) { | 3306 f(var p) { |
| 3307 if (p is A) { | 3307 if (p is A) { |
| 3308 } | 3308 } |
| 3309 }'''); | 3309 }'''); |
| 3310 resolve(source); | 3310 resolve(source); |
| 3311 assertErrors(source, [StaticWarningCode.TYPE_TEST_NON_TYPE]); | 3311 assertErrors(source, [StaticWarningCode.TYPE_TEST_WITH_NON_TYPE]); |
| 3312 verify([source]); | 3312 verify([source]); |
| 3313 } | 3313 } |
| 3314 | 3314 |
| 3315 void test_typeTestWithUndefinedName() { |
| 3316 Source source = addSource(r''' |
| 3317 f(var p) { |
| 3318 if (p is A) { |
| 3319 } |
| 3320 }'''); |
| 3321 resolve(source); |
| 3322 assertErrors(source, [StaticWarningCode.TYPE_TEST_WITH_UNDEFINED_NAME]); |
| 3323 verify([source]); |
| 3324 } |
| 3325 |
| 3315 void test_undefinedClass_instanceCreation() { | 3326 void test_undefinedClass_instanceCreation() { |
| 3316 Source source = addSource("f() { new C(); }"); | 3327 Source source = addSource("f() { new C(); }"); |
| 3317 resolve(source); | 3328 resolve(source); |
| 3318 assertErrors(source, [StaticWarningCode.UNDEFINED_CLASS]); | 3329 assertErrors(source, [StaticWarningCode.UNDEFINED_CLASS]); |
| 3319 } | 3330 } |
| 3320 | 3331 |
| 3321 void test_undefinedClass_variableDeclaration() { | 3332 void test_undefinedClass_variableDeclaration() { |
| 3322 Source source = addSource("f() { C c; }"); | 3333 Source source = addSource("f() { C c; }"); |
| 3323 resolve(source); | 3334 resolve(source); |
| 3324 assertErrors(source, [StaticWarningCode.UNDEFINED_CLASS]); | 3335 assertErrors(source, [StaticWarningCode.UNDEFINED_CLASS]); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3516 | 3527 |
| 3517 void test_voidReturnForGetter() { | 3528 void test_voidReturnForGetter() { |
| 3518 Source source = addSource(r''' | 3529 Source source = addSource(r''' |
| 3519 class S { | 3530 class S { |
| 3520 void get value {} | 3531 void get value {} |
| 3521 }'''); | 3532 }'''); |
| 3522 resolve(source); | 3533 resolve(source); |
| 3523 assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]); | 3534 assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]); |
| 3524 } | 3535 } |
| 3525 } | 3536 } |
| OLD | NEW |