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

Unified Diff: pkg/analyzer_cli/test/error_test.dart

Issue 2992623002: Re-land of CL 2990703002, adding fixes to analyzer_test and error_test. (Closed)
Patch Set: Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/test/generated/static_warning_code_test.dart ('k') | tests/co19/co19-analyzer2.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer_cli/test/error_test.dart
diff --git a/pkg/analyzer_cli/test/error_test.dart b/pkg/analyzer_cli/test/error_test.dart
index f71a21257dc29025e27840a7e7127765ab9f1f15..c8d1d0fd69ec1b11724fabd68d993faca5a6ca27 100644
--- a/pkg/analyzer_cli/test/error_test.dart
+++ b/pkg/analyzer_cli/test/error_test.dart
@@ -8,6 +8,10 @@ import 'package:test/test.dart';
import 'utils.dart';
+const badDeclaration = 'var int foo;';
+const badDeclarationMessage = 'Error in test.dart: '
+ 'Variables can\'t be declared using both \'var\' and a type name.\n';
+
void main() {
group('error', () {
test("a valid Dart file doesn't throw any errors", () {
@@ -19,47 +23,33 @@ void main() {
});
test("an error on the first line", () {
- expect(
- errorsForFile('void foo;\n'),
- equals(
- "Error in test.dart: Variables can't have a type of 'void'.\n"));
+ expect(errorsForFile('$badDeclaration\n'), equals(badDeclarationMessage));
});
test("an error on the last line", () {
- expect(
- errorsForFile('\nvoid foo;'),
- equals(
- "Error in test.dart: Variables can't have a type of 'void'.\n"));
+ expect(errorsForFile('\n$badDeclaration'), equals(badDeclarationMessage));
});
test("an error in the middle", () {
expect(
- errorsForFile('\nvoid foo;\n'),
- equals(
- "Error in test.dart: Variables can't have a type of 'void'.\n"));
+ errorsForFile('\n$badDeclaration\n'), equals(badDeclarationMessage));
});
var veryLongString = new List.filled(107, ' ').join('');
test("an error at the end of a very long line", () {
- expect(
- errorsForFile('$veryLongString void foo;'),
- equals(
- "Error in test.dart: Variables can't have a type of 'void'.\n"));
+ expect(errorsForFile('$veryLongString $badDeclaration'),
+ equals(badDeclarationMessage));
});
test("an error at the beginning of a very long line", () {
- expect(
- errorsForFile('void foo; $veryLongString'),
- equals(
- "Error in test.dart: Variables can't have a type of 'void'.\n"));
+ expect(errorsForFile('$badDeclaration $veryLongString'),
+ equals(badDeclarationMessage));
});
test("an error in the middle of a very long line", () {
- expect(
- errorsForFile('$veryLongString void foo;$veryLongString'),
- equals(
- "Error in test.dart: Variables can't have a type of 'void'.\n"));
+ expect(errorsForFile('$veryLongString $badDeclaration$veryLongString'),
+ equals(badDeclarationMessage));
});
});
}
« no previous file with comments | « pkg/analyzer/test/generated/static_warning_code_test.dart ('k') | tests/co19/co19-analyzer2.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698