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

Unified Diff: pkg/analysis_server/test/services/correction/fix_test.dart

Issue 1116593002: Issue 23337. Quick Fix for removing dead code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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/correction/fix_internal.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/correction/fix_test.dart
diff --git a/pkg/analysis_server/test/services/correction/fix_test.dart b/pkg/analysis_server/test/services/correction/fix_test.dart
index a1840ce89adbb47df53033de248fd86650ee177c..e9e14e1327981773385d2c4d07bfadd688caffcf 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -2449,6 +2449,56 @@ main(p) {
}
}
+ void test_removeDeadCode_condition() {
+ resolveTestUnit('''
+main(int p) {
+ if (true || p > 5) {
+ print(1);
+ }
+}
+''');
+ assertHasFix(DartFixKind.REMOVE_DEAD_CODE, '''
+main(int p) {
+ if (true) {
+ print(1);
+ }
+}
+''');
+ }
+
+ void test_removeDeadCode_statements_one() {
+ resolveTestUnit('''
+int main() {
+ print(0);
+ return 42;
+ print(1);
+}
+''');
+ assertHasFix(DartFixKind.REMOVE_DEAD_CODE, '''
+int main() {
+ print(0);
+ return 42;
+}
+''');
+ }
+
+ void test_removeDeadCode_statements_two() {
+ resolveTestUnit('''
+int main() {
+ print(0);
+ return 42;
+ print(1);
+ print(2);
+}
+''');
+ assertHasFix(DartFixKind.REMOVE_DEAD_CODE, '''
+int main() {
+ print(0);
+ return 42;
+}
+''');
+ }
+
void test_removeParentheses_inGetterDeclaration() {
resolveTestUnit('''
class A {
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/fix_internal.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698