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

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

Issue 2397153004: Issue 27536. Quick Fix for 'Avoid using braces in interpolation when not needed'. (Closed)
Patch Set: Created 4 years, 2 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
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 ea55ec18e2cc0a751211f7cb2c699ed714ffdf64..dbfb129d165dc07008bc9e2a35f09455e67c7f4e 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -5273,10 +5273,10 @@ class LintFixTest extends BaseFixProcessorTest {
resultCode = SourceEdit.applySequence(testCode, change.edits[0].edits);
}
- void findLint(String src, String lintCode) {
+ void findLint(String src, String lintCode, {int length: 1}) {
int errorOffset = src.indexOf('/*LINT*/');
resolveTestUnit(src.replaceAll('/*LINT*/', ''));
- error = new AnalysisError(testUnit.element.source, errorOffset, 1,
+ error = new AnalysisError(testUnit.element.source, errorOffset, length,
new LintCode(lintCode, '<ignored>'));
}
@@ -5462,6 +5462,23 @@ class Sub extends Test {
''');
}
+ test_lint_removeInterpolationBraces() async {
+ String src = r'''
+main() {
+ var v = 42;
+ print('v: /*LINT*/${ v}');
+}
+''';
+ findLint(src, LintNames.unnecessary_brace_in_string_interp, length: 4);
+ await applyFix(DartFixKind.LINT_REMOVE_INTERPOLATION_BRACES);
+ verifyResult(r'''
+main() {
+ var v = 42;
+ print('v: $v');
+}
+''');
+ }
+
void verifyResult(String expectedResult) {
expect(resultCode, expectedResult);
}

Powered by Google App Engine
This is Rietveld 408576698