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

Side by Side Diff: pkg/analysis_server/test/services/refactoring/naming_conventions_test.dart

Issue 684863003: Issue 21333. Constant names are not special anymore in the style guide (Dart version). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
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 test.services.refactoring.naming_conventions; 5 library test.services.refactoring.naming_conventions;
6 6
7 import 'package:analysis_server/src/protocol.dart' show 7 import 'package:analysis_server/src/protocol.dart' show
8 RefactoringProblemSeverity; 8 RefactoringProblemSeverity;
9 import 'package:analysis_server/src/services/refactoring/naming_conventions.dart '; 9 import 'package:analysis_server/src/services/refactoring/naming_conventions.dart ';
10 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; 10 import 'package:analysis_server/src/services/refactoring/refactoring.dart';
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 RefactoringProblemSeverity.FATAL, 83 RefactoringProblemSeverity.FATAL,
84 expectedMessage: "Class name must not be null."); 84 expectedMessage: "Class name must not be null.");
85 } 85 }
86 86
87 void test_validateClassName_trailingBlanks() { 87 void test_validateClassName_trailingBlanks() {
88 assertRefactoringStatus( 88 assertRefactoringStatus(
89 validateClassName("NewName "), 89 validateClassName("NewName "),
90 RefactoringProblemSeverity.FATAL, 90 RefactoringProblemSeverity.FATAL,
91 expectedMessage: "Class name must not start or end with a blank."); 91 expectedMessage: "Class name must not start or end with a blank.");
92 } 92 }
93 void test_validateConstantName_OK() {
94 assertRefactoringStatusOK(validateConstantName("NAME"));
95 }
96
97 void test_validateConstantName_OK_digit() {
98 assertRefactoringStatusOK(validateConstantName("NAME2"));
99 }
100
101 void test_validateConstantName_OK_underscoreLeading() {
102 assertRefactoringStatusOK(validateConstantName("_NAME"));
103 }
104
105 void test_validateConstantName_OK_underscoreMiddle() {
106 assertRefactoringStatusOK(validateConstantName("MY_NEW_NAME"));
107 }
108
109 void test_validateConstantName_empty() {
110 assertRefactoringStatus(
111 validateConstantName(""),
112 RefactoringProblemSeverity.FATAL,
113 expectedMessage: "Constant name must not be empty.");
114 }
115
116 void test_validateConstantName_leadingBlanks() {
117 assertRefactoringStatus(
118 validateConstantName(" NewName"),
119 RefactoringProblemSeverity.FATAL,
120 expectedMessage: "Constant name must not start or end with a blank.");
121 }
122
123 void test_validateConstantName_notAllCaps() {
124 assertRefactoringStatus(
125 validateConstantName("NewName"),
126 RefactoringProblemSeverity.WARNING,
127 expectedMessage: "Constant name should be all uppercase with underscores .");
128 }
129
130 void test_validateConstantName_notIdentifierMiddle() {
131 assertRefactoringStatus(
132 validateConstantName("NA-ME"),
133 RefactoringProblemSeverity.FATAL,
134 expectedMessage: "Constant name must not contain '-'.");
135 }
136
137 void test_validateConstantName_notIdentifierStart() {
138 assertRefactoringStatus(
139 validateConstantName("99_RED_BALLOONS"),
140 RefactoringProblemSeverity.FATAL,
141 expectedMessage:
142 "Constant name must begin with an uppercase letter or underscore.");
143 }
144
145 void test_validateConstantName_null() {
146 assertRefactoringStatus(
147 validateConstantName(null),
148 RefactoringProblemSeverity.FATAL,
149 expectedMessage: "Constant name must not be null.");
150 }
151
152 void test_validateConstantName_trailingBlanks() {
153 assertRefactoringStatus(
154 validateConstantName("NewName "),
155 RefactoringProblemSeverity.FATAL,
156 expectedMessage: "Constant name must not start or end with a blank.");
157 }
158 93
159 void test_validateConstructorName_OK() { 94 void test_validateConstructorName_OK() {
160 assertRefactoringStatusOK(validateConstructorName("newName")); 95 assertRefactoringStatusOK(validateConstructorName("newName"));
161 } 96 }
162 97
163 void test_validateConstructorName_OK_leadingUnderscore() { 98 void test_validateConstructorName_OK_leadingUnderscore() {
164 assertRefactoringStatusOK(validateConstructorName("_newName")); 99 assertRefactoringStatusOK(validateConstructorName("_newName"));
165 } 100 }
166 101
167 void test_validateConstructorName_doesNotStartWithLowerCase() { 102 void test_validateConstructorName_doesNotStartWithLowerCase() {
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 expectedMessage: "Variable name must not be null."); 721 expectedMessage: "Variable name must not be null.");
787 } 722 }
788 723
789 void test_validateVariableName_trailingBlanks() { 724 void test_validateVariableName_trailingBlanks() {
790 assertRefactoringStatus( 725 assertRefactoringStatus(
791 validateVariableName("newName "), 726 validateVariableName("newName "),
792 RefactoringProblemSeverity.FATAL, 727 RefactoringProblemSeverity.FATAL,
793 expectedMessage: "Variable name must not start or end with a blank."); 728 expectedMessage: "Variable name must not start or end with a blank.");
794 } 729 }
795 } 730 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698