-
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: I7e79ad37681afdbd94d7968451a768e74217578e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/95708 Commit-Queue: Phil Quitslund <pquitslund@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
- Loading branch information
Showing
3 changed files
with
58 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
42 changes: 42 additions & 0 deletions
42
pkg/analysis_server/test/src/services/correction/fix/use_rethrow_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,42 @@ | ||
// 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(UseRethrowTest); | ||
}); | ||
} | ||
|
||
@reflectiveTest | ||
class UseRethrowTest extends FixProcessorLintTest { | ||
@override | ||
FixKind get kind => DartFixKind.USE_RETHROW; | ||
|
||
@override | ||
String get lintCode => LintNames.use_rethrow_when_possible; | ||
|
||
test_rethrow() async { | ||
await resolveTestUnit(''' | ||
void bad1() { | ||
try {} catch (e) { | ||
throw/*LINT*/ e; | ||
} | ||
} | ||
'''); | ||
await assertHasFix(''' | ||
void bad1() { | ||
try {} catch (e) { | ||
rethrow; | ||
} | ||
} | ||
'''); | ||
} | ||
} |