Add a test to ensure that error codes are not being missed and add missed error codes

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2992243002 .
This commit is contained in:
Brian Wilkerson 2017-08-04 07:45:45 -07:00
parent 83fcb7aa94
commit defb2990d2
4 changed files with 41 additions and 37 deletions

View file

@ -42,6 +42,9 @@ const List<ErrorCode> errorCodeValues = const [
// need to be filled in by hand.
//
AnalysisOptionsErrorCode.PARSE_ERROR,
AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR,
AnalysisOptionsWarningCode.INCLUDE_FILE_NOT_FOUND,
AnalysisOptionsWarningCode.INCLUDED_FILE_WARNING,
AnalysisOptionsWarningCode.UNRECOGNIZED_ERROR_CODE,
AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUE,
AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUES,

View file

@ -14,17 +14,8 @@ import 'package:analyzer/error/error.dart';
*/
class AnalysisOptionsErrorCode extends ErrorCode {
/**
* An error code indicating that there is a syntactic error in the file.
*
* Parameters:
* 0: the error message from the parse error
*/
static const AnalysisOptionsErrorCode PARSE_ERROR =
const AnalysisOptionsErrorCode('PARSE_ERROR', '{0}');
/**
* An error code indicating that there is a syntactic error
* in the included file.
* An error code indicating that there is a syntactic error in the included
* file.
*
* Parameters:
* 0: the path of the file containing the error
@ -32,8 +23,18 @@ class AnalysisOptionsErrorCode extends ErrorCode {
* 2: the ending offset of the text in the file that contains the error
* 3: the error message
*/
static const INCLUDED_FILE_PARSE_ERROR = const AnalysisOptionsErrorCode(
'INCLUDED_FILE_PARSE_ERROR', '{3} in {0}({1}..{2})');
static const AnalysisOptionsErrorCode INCLUDED_FILE_PARSE_ERROR =
const AnalysisOptionsErrorCode(
'INCLUDED_FILE_PARSE_ERROR', '{3} in {0}({1}..{2})');
/**
* An error code indicating that there is a syntactic error in the file.
*
* Parameters:
* 0: the error message from the parse error
*/
static const AnalysisOptionsErrorCode PARSE_ERROR =
const AnalysisOptionsErrorCode('PARSE_ERROR', '{0}');
/**
* Initialize a newly created error code to have the given [name].
@ -81,19 +82,15 @@ class AnalysisOptionsWarningCode extends ErrorCode {
"Warning in the included options file {0}({1}..{2}): {3}");
/**
* An error code indicating that a plugin is being configured with an
* unsupported option and legal options are provided.
* An error code indicating that an unrecognized error code is being used to
* specify an error filter.
*
* Parameters:
* 0: the plugin name
* 1: the unsupported option key
* 2: legal values
* 0: the unrecognized error code
*/
static const AnalysisOptionsWarningCode UNSUPPORTED_OPTION_WITH_LEGAL_VALUES =
static const AnalysisOptionsWarningCode UNRECOGNIZED_ERROR_CODE =
const AnalysisOptionsWarningCode(
'UNSUPPORTED_OPTION_WITH_LEGAL_VALUES',
"The option '{1}' isn't supported by '{0}'.",
"Try using one of the supported options: {2}.");
'UNRECOGNIZED_ERROR_CODE', "'{0}' isn't a recognized error code.");
/**
* An error code indicating that a plugin is being configured with an
@ -110,6 +107,21 @@ class AnalysisOptionsWarningCode extends ErrorCode {
"The option '{1}' isn't supported by '{0}'."
"Try using the only supported option: '{2}'.");
/**
* An error code indicating that a plugin is being configured with an
* unsupported option and legal options are provided.
*
* Parameters:
* 0: the plugin name
* 1: the unsupported option key
* 2: legal values
*/
static const AnalysisOptionsWarningCode UNSUPPORTED_OPTION_WITH_LEGAL_VALUES =
const AnalysisOptionsWarningCode(
'UNSUPPORTED_OPTION_WITH_LEGAL_VALUES',
"The option '{1}' isn't supported by '{0}'.",
"Try using one of the supported options: {2}.");
/**
* An error code indicating that an option entry is being configured with an
* unsupported value.
@ -125,17 +137,6 @@ class AnalysisOptionsWarningCode extends ErrorCode {
"The value '{1}' isn't supported by '{0}'.",
"Try using one of the supported options: {2}.");
/**
* An error code indicating that an unrecognized error code is being used to
* specify an error filter.
*
* Parameters:
* 0: the unrecognized error code
*/
static const AnalysisOptionsWarningCode UNRECOGNIZED_ERROR_CODE =
const AnalysisOptionsWarningCode(
'UNRECOGNIZED_ERROR_CODE', "'{0}' isn't a recognized error code.");
/**
* Initialize a newly created warning code to have the given [name].
*/

View file

@ -1098,7 +1098,7 @@ class CompileTimeErrorCode extends ErrorCode {
*
* TODO(paulberry): remove this once dartbug.com/28515 is fixed.
*/
static const GENERIC_FUNCTION_TYPED_PARAM_UNSUPPORTED =
static const CompileTimeErrorCode GENERIC_FUNCTION_TYPED_PARAM_UNSUPPORTED =
const CompileTimeErrorCode(
'GENERIC_FUNCTION_TYPED_PARAM_UNSUPPORTED',
"Analysis of generic function typed parameters is not yet supported.",
@ -4992,7 +4992,7 @@ class StrongModeCode extends ErrorCode {
* hints and then clean up the function _errorSeverity in
* test/src/task/strong/strong_test_helper.dart.
*/
/* TODO(leafp) Delete most of these.
/* TODO(leafp) Delete most of these.
*/
static const StrongModeCode TOP_LEVEL_CYCLE = const StrongModeCode(
ErrorType.HINT,

View file

@ -2,13 +2,12 @@
// 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.
library analyzer.test.test_all;
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'cancelable_future_test.dart' as cancelable_future_test;
import 'context/test_all.dart' as context;
import 'dart/test_all.dart' as dart;
import 'error/test_all.dart' as error;
import 'file_system/test_all.dart' as file_system;
import 'generated/test_all.dart' as generated;
import 'instrumentation/test_all.dart' as instrumentation;
@ -22,6 +21,7 @@ main() {
cancelable_future_test.main();
context.main();
dart.main();
error.main();
file_system.main();
generated.main();
instrumentation.main();