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.checked_mode_compile_time_error_code_test; | 5 library analyzer.test.generated.checked_mode_compile_time_error_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:test_reflective_loader/test_reflective_loader.dart'; |
9 | 10 |
10 import '../reflective_tests.dart'; | |
11 import '../utils.dart'; | 11 import '../utils.dart'; |
12 import 'resolver_test_case.dart'; | 12 import 'resolver_test_case.dart'; |
13 | 13 |
14 main() { | 14 main() { |
15 initializeTestEnvironment(); | 15 initializeTestEnvironment(); |
16 runReflectiveTests(CheckedModeCompileTimeErrorCodeTest); | 16 defineReflectiveTests(CheckedModeCompileTimeErrorCodeTest); |
17 } | 17 } |
18 | 18 |
19 @reflectiveTest | 19 @reflectiveTest |
20 class CheckedModeCompileTimeErrorCodeTest extends ResolverTestCase { | 20 class CheckedModeCompileTimeErrorCodeTest extends ResolverTestCase { |
21 void test_fieldFormalParameterAssignableToField_extends() { | 21 void test_fieldFormalParameterAssignableToField_extends() { |
22 // According to checked-mode type checking rules, a value of type B is | 22 // According to checked-mode type checking rules, a value of type B is |
23 // assignable to a field of type A, because B extends A (and hence is a | 23 // assignable to a field of type A, because B extends A (and hence is a |
24 // subtype of A). | 24 // subtype of A). |
25 Source source = addSource(r''' | 25 Source source = addSource(r''' |
26 class A { | 26 class A { |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 void test_topLevelVarNotAssignable_undefined() { | 610 void test_topLevelVarNotAssignable_undefined() { |
611 Source source = addSource("const Unresolved x = 'foo';"); | 611 Source source = addSource("const Unresolved x = 'foo';"); |
612 computeLibrarySourceErrors(source); | 612 computeLibrarySourceErrors(source); |
613 assertErrors(source, [ | 613 assertErrors(source, [ |
614 CheckedModeCompileTimeErrorCode.VARIABLE_TYPE_MISMATCH, | 614 CheckedModeCompileTimeErrorCode.VARIABLE_TYPE_MISMATCH, |
615 StaticWarningCode.UNDEFINED_CLASS | 615 StaticWarningCode.UNDEFINED_CLASS |
616 ]); | 616 ]); |
617 verify([source]); | 617 verify([source]); |
618 } | 618 } |
619 } | 619 } |
OLD | NEW |