Add failing tests for SortConstructorFirst with comments.

Bug: https://github.com/dart-lang/sdk/issues/48966
Change-Id: I2d34a7cc240171759dd331f23118745a5d8ff80e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243841
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Konstantin Shcheglov 2022-05-05 19:03:35 +00:00 committed by Commit Bot
parent 838b68914f
commit f7d4d0d85c

View file

@ -80,6 +80,77 @@ class SortConstructorFirstTest extends FixProcessorLintTest {
@override
String get lintCode => LintNames.sort_constructors_first;
@FailingTest(
reason: 'The beginToken is the comment, which has no previous token.',
issue: 'https://github.com/dart-lang/sdk/issues/48966',
)
Future<void> test_hasComment() async {
await resolveTestCode('''
class A {
void foo() {}
/// comment
A();
}
''');
await assertHasFix('''
class A {
/// comment
A();
void foo() {}
}
''');
}
@FailingTest(
reason: 'The beginToken is the comment, which has no previous token.',
issue: 'https://github.com/dart-lang/sdk/issues/48966',
)
Future<void> test_hasComment_hasMetadata_afterComment() async {
await resolveTestCode('''
const a = 0;
class A {
void foo() {}
/// comment
@a
A();
}
''');
await assertHasFix('''
const a = 0;
class A {
/// comment
@a
A();
void foo() {}
}
''');
}
Future<void> test_hasComment_hasMetadata_beforeComment() async {
await resolveTestCode('''
const a = 0;
class A {
void foo() {}
@a
/// comment
A();
}
''');
await assertHasFix('''
const a = 0;
class A {
@a
/// comment
A();
void foo() {}
}
''');
}
Future<void> test_one_fix() async {
await resolveTestCode('''
class A {