-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See: https://github.com/dart-lang/linter/issues/1374. Change-Id: Ieeddf25718ddde77a9e52cb93cbcf34ca2c1f81f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95542 Commit-Queue: Phil Quitslund <pquitslund@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
- Loading branch information
Showing
4 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
pkg/analysis_server/test/src/services/correction/fix/remove_unnecessary_const_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file | ||
// 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. | ||
|
||
import 'package:analysis_server/src/services/correction/fix.dart'; | ||
import 'package:analysis_server/src/services/correction/fix_internal.dart'; | ||
import 'package:analyzer_plugin/utilities/fixes/fixes.dart'; | ||
import 'package:test_reflective_loader/test_reflective_loader.dart'; | ||
|
||
import 'fix_processor.dart'; | ||
|
||
main() { | ||
defineReflectiveSuite(() { | ||
defineReflectiveTests(UnnecessaryConstTest); | ||
}); | ||
} | ||
|
||
@reflectiveTest | ||
class UnnecessaryConstTest extends FixProcessorLintTest { | ||
@override | ||
FixKind get kind => DartFixKind.REMOVE_UNNECESSARY_CONST; | ||
|
||
@override | ||
String get lintCode => LintNames.unnecessary_const; | ||
|
||
test_constConstructor() async { | ||
await resolveTestUnit(''' | ||
class A { const A(); } | ||
m(){ | ||
const a = /*LINT*/const A(); | ||
} | ||
'''); | ||
await assertHasFix(''' | ||
class A { const A(); } | ||
m(){ | ||
const a = /*LINT*/A(); | ||
} | ||
'''); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters