blob: 5799c313446e2c86025dc3c8a9ae4b6a6cfb0319 [file] [log] [blame]
// Copyright (c) 2018, 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:analyzer_plugin/utilities/fixes/fixes.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'fix_processor.dart';
main() {
defineReflectiveSuite(() {
defineReflectiveTests(CreateNoSuchMethodTest);
});
}
@reflectiveTest
class CreateNoSuchMethodTest extends FixProcessorTest {
@override
FixKind get kind => DartFixKind.CREATE_NO_SUCH_METHOD;
test_class() async {
await resolveTestUnit('''
abstract class A {
m1();
int m2();
}
class B extends A {
existing() {}
}
''');
await assertHasFix('''
abstract class A {
m1();
int m2();
}
class B extends A {
existing() {}
noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
}
''');
}
test_classTypeAlias() async {
await resolveTestUnit('''
abstract class A {
m();
}
class B = Object with A;
''');
await assertNoFix();
}
}