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

Unified Diff: pkg/analysis_server/test/services/refactoring/naming_conventions_test.dart

Issue 2802433002: do not allow built-in keywords to specified when refactoring (Closed)
Patch Set: add tests Created 3 years, 8 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/analysis_server/lib/src/services/refactoring/naming_conventions.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/refactoring/naming_conventions_test.dart
diff --git a/pkg/analysis_server/test/services/refactoring/naming_conventions_test.dart b/pkg/analysis_server/test/services/refactoring/naming_conventions_test.dart
index 04afda2a25a763a8af15e1e4d2eae9305157c6b5..42f6700ee65c9ec608f8fb6d11338a14f244f202 100644
--- a/pkg/analysis_server/test/services/refactoring/naming_conventions_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/naming_conventions_test.dart
@@ -165,6 +165,18 @@ class NamingConventionsTest extends RefactoringTest {
"Field name must begin with a lowercase letter or underscore.");
}
+ void test_validateFieldName_notKeyword() {
+ assertRefactoringStatus(
+ validateFieldName("for"), RefactoringProblemSeverity.FATAL,
+ expectedMessage: "Field name must not be a keyword.");
+ }
+
+ void test_validateFieldName_notPseudoKeyword() {
+ assertRefactoringStatus(
+ validateFieldName("await"), RefactoringProblemSeverity.FATAL,
+ expectedMessage: "Field name must not be a keyword.");
+ }
+
void test_validateFieldName_null() {
assertRefactoringStatus(
validateFieldName(null), RefactoringProblemSeverity.FATAL,
@@ -220,6 +232,18 @@ class NamingConventionsTest extends RefactoringTest {
"Function name must begin with a lowercase letter or underscore.");
}
+ void test_validateFunctionName_notKeyword() {
+ assertRefactoringStatus(
+ validateFunctionName("new"), RefactoringProblemSeverity.FATAL,
+ expectedMessage: "Function name must not be a keyword.");
+ }
+
+ void test_validateFunctionName_notPseudoKeyword() {
+ assertRefactoringStatus(
+ validateFunctionName("yield"), RefactoringProblemSeverity.FATAL,
+ expectedMessage: "Function name must not be a keyword.");
+ }
+
void test_validateFunctionName_null() {
assertRefactoringStatus(
validateFunctionName(null), RefactoringProblemSeverity.FATAL,
@@ -337,6 +361,18 @@ class NamingConventionsTest extends RefactoringTest {
"Import prefix name must begin with a lowercase letter or underscore.");
}
+ void test_validateImportPrefixName_notKeyword() {
+ assertRefactoringStatus(
+ validateImportPrefixName("while"), RefactoringProblemSeverity.FATAL,
+ expectedMessage: "Import prefix name must not be a keyword.");
+ }
+
+ void test_validateImportPrefixName_notPseudoKeyword() {
+ assertRefactoringStatus(
+ validateImportPrefixName("await"), RefactoringProblemSeverity.FATAL,
+ expectedMessage: "Import prefix name must not be a keyword.");
+ }
+
void test_validateImportPrefixName_null() {
assertRefactoringStatus(
validateImportPrefixName(null), RefactoringProblemSeverity.FATAL,
@@ -393,6 +429,18 @@ class NamingConventionsTest extends RefactoringTest {
"Label name must begin with a lowercase letter or underscore.");
}
+ void test_validateLabelName_notKeyword() {
+ assertRefactoringStatus(
+ validateLabelName("for"), RefactoringProblemSeverity.FATAL,
+ expectedMessage: "Label name must not be a keyword.");
+ }
+
+ void test_validateLabelName_notPseudoKeyword() {
+ assertRefactoringStatus(
+ validateLabelName("await"), RefactoringProblemSeverity.FATAL,
+ expectedMessage: "Label name must not be a keyword.");
+ }
+
void test_validateLabelName_null() {
assertRefactoringStatus(
validateLabelName(null), RefactoringProblemSeverity.FATAL,
@@ -467,6 +515,12 @@ class NamingConventionsTest extends RefactoringTest {
"Library name identifier must begin with a lowercase letter or underscore.");
}
+ void test_validateLibraryName_notKeyword() {
+ assertRefactoringStatus(
+ validateLibraryName("my.yield.name"), RefactoringProblemSeverity.FATAL,
+ expectedMessage: "Library name identifier must not be a keyword.");
+ }
+
void test_validateLibraryName_null() {
assertRefactoringStatus(
validateLibraryName(null), RefactoringProblemSeverity.FATAL,
@@ -478,7 +532,7 @@ class NamingConventionsTest extends RefactoringTest {
}
void test_validateLibraryName_OK_severalIdentifiers() {
- assertRefactoringStatusOK(validateLibraryName("my.library.name"));
+ assertRefactoringStatusOK(validateLibraryName("my.lib.name"));
}
void test_validateLibraryName_trailingBlanks() {
@@ -525,6 +579,18 @@ class NamingConventionsTest extends RefactoringTest {
"Method name must begin with a lowercase letter or underscore.");
}
+ void test_validateMethodName_notKeyword() {
+ assertRefactoringStatus(
+ validateMethodName("do"), RefactoringProblemSeverity.FATAL,
+ expectedMessage: "Method name must not be a keyword.");
+ }
+
+ void test_validateMethodName_notPseudoKeyword() {
+ assertRefactoringStatus(
+ validateMethodName("yield"), RefactoringProblemSeverity.FATAL,
+ expectedMessage: "Method name must not be a keyword.");
+ }
+
void test_validateMethodName_null() {
assertRefactoringStatus(
validateMethodName(null), RefactoringProblemSeverity.FATAL,
@@ -581,6 +647,18 @@ class NamingConventionsTest extends RefactoringTest {
"Parameter name must begin with a lowercase letter or underscore.");
}
+ void test_validateParameterName_notKeyword() {
+ assertRefactoringStatus(
+ validateParameterName("while"), RefactoringProblemSeverity.FATAL,
+ expectedMessage: "Parameter name must not be a keyword.");
+ }
+
+ void test_validateParameterName_notPseudoKeyword() {
+ assertRefactoringStatus(
+ validateParameterName("await"), RefactoringProblemSeverity.FATAL,
+ expectedMessage: "Parameter name must not be a keyword.");
+ }
+
void test_validateParameterName_null() {
assertRefactoringStatus(
validateParameterName(null), RefactoringProblemSeverity.FATAL,
@@ -636,6 +714,18 @@ class NamingConventionsTest extends RefactoringTest {
"Variable name must begin with a lowercase letter or underscore.");
}
+ void test_validateVariableName_notKeyword() {
+ assertRefactoringStatus(
+ validateVariableName("for"), RefactoringProblemSeverity.FATAL,
+ expectedMessage: "Variable name must not be a keyword.");
+ }
+
+ void test_validateVariableName_notPseudoKeyword() {
+ assertRefactoringStatus(
+ validateVariableName("await"), RefactoringProblemSeverity.FATAL,
+ expectedMessage: "Variable name must not be a keyword.");
+ }
+
void test_validateVariableName_null() {
assertRefactoringStatus(
validateVariableName(null), RefactoringProblemSeverity.FATAL,
« no previous file with comments | « pkg/analysis_server/lib/src/services/refactoring/naming_conventions.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698