Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: pkg/analyzer/test/generated/static_warning_code_test.dart

Issue 1933783002: Add a failing test for generic tear-offs (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 analyzer.test.generated.static_warning_code_test; 5 library analyzer.test.generated.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
11 import '../reflective_tests.dart'; 11 import '../reflective_tests.dart';
12 import '../utils.dart'; 12 import '../utils.dart';
13 import 'resolver_test_case.dart'; 13 import 'resolver_test_case.dart';
14 14
15 main() { 15 main() {
16 initializeTestEnvironment(); 16 initializeTestEnvironment();
17 runReflectiveTests(StaticWarningCodeTest); 17 runReflectiveTests(StaticWarningCodeTest);
18 } 18 }
19 19
20 @reflectiveTest 20 @reflectiveTest
21 class StaticWarningCodeTest extends ResolverTestCase { 21 class StaticWarningCodeTest extends ResolverTestCase {
22 void fail_argumentTypeNotAssignable_tearOff_required() {
23 Source source = addSource(r'''
24 class C {
25 Object/*=T*/ f/*<T>*/(Object/*=T*/ x) => x;
26 }
27 g(C c) {
28 var h = c.f/*<int>*/;
29 print(h('s'));
30 }
31 ''');
32 computeLibrarySourceErrors(source);
33 assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
34 verify([source]);
35 }
36
22 void fail_undefinedGetter() { 37 void fail_undefinedGetter() {
23 Source source = addSource(r''' 38 Source source = addSource(r'''
24 '''); 39 ''');
25 computeLibrarySourceErrors(source); 40 computeLibrarySourceErrors(source);
26 assertErrors(source, [StaticWarningCode.UNDEFINED_GETTER]); 41 assertErrors(source, [StaticWarningCode.UNDEFINED_GETTER]);
27 verify([source]); 42 verify([source]);
28 } 43 }
29 44
30 void fail_undefinedIdentifier_commentReference() { 45 void fail_undefinedIdentifier_commentReference() {
31 Source source = addSource(r''' 46 Source source = addSource(r'''
(...skipping 3609 matching lines...) Expand 10 before | Expand all | Expand 10 after
3641 3656
3642 void test_voidReturnForGetter() { 3657 void test_voidReturnForGetter() {
3643 Source source = addSource(r''' 3658 Source source = addSource(r'''
3644 class S { 3659 class S {
3645 void get value {} 3660 void get value {}
3646 }'''); 3661 }''');
3647 computeLibrarySourceErrors(source); 3662 computeLibrarySourceErrors(source);
3648 assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]); 3663 assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]);
3649 } 3664 }
3650 } 3665 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698