-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
analyzer: move tests to 4 new test files in diagnostics/
Change-Id: Ied68dc6a383c7ca0a44dbcd8381f3a94832d44fe Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153903 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
- Loading branch information
1 parent
90ce990
commit 6e687d1
Showing
7 changed files
with
242 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
pkg/analyzer/test/src/diagnostics/invocation_of_non_function_expression_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'package:analyzer/src/error/codes.dart'; | ||
import 'package:test_reflective_loader/test_reflective_loader.dart'; | ||
|
||
import '../dart/resolution/driver_resolution.dart'; | ||
|
||
main() { | ||
defineReflectiveSuite(() { | ||
defineReflectiveTests(InvocationOfNonFunctionExpressionTest); | ||
}); | ||
} | ||
|
||
@reflectiveTest | ||
class InvocationOfNonFunctionExpressionTest extends DriverResolutionTest { | ||
test_invocationOfNonFunctionExpression_literal() async { | ||
await assertErrorsInCode(r''' | ||
f() { | ||
3(5); | ||
} | ||
''', [ | ||
error(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 8, 1), | ||
]); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
pkg/analyzer/test/src/diagnostics/non_type_as_type_argument_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'package:analyzer/src/error/codes.dart'; | ||
import 'package:test_reflective_loader/test_reflective_loader.dart'; | ||
|
||
import '../dart/resolution/driver_resolution.dart'; | ||
|
||
main() { | ||
defineReflectiveSuite(() { | ||
defineReflectiveTests(NonTypeAsTypeArgumentTest); | ||
}); | ||
} | ||
|
||
@reflectiveTest | ||
class NonTypeAsTypeArgumentTest extends DriverResolutionTest { | ||
test_notAType() async { | ||
await assertErrorsInCode(r''' | ||
int A; | ||
class B<E> {} | ||
f(B<A> b) {} | ||
''', [ | ||
error(StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT, 25, 1), | ||
]); | ||
} | ||
|
||
test_undefinedIdentifier() async { | ||
await assertErrorsInCode(r''' | ||
class B<E> {} | ||
f(B<A> b) {} | ||
''', [ | ||
error(StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT, 18, 1), | ||
]); | ||
} | ||
} |
Oops, something went wrong.