-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move sized_box_for_whitespace tests (#4684)
- Loading branch information
Showing
4 changed files
with
150 additions
and
68 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
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,145 @@ | ||
// Copyright (c) 2023, 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:test_reflective_loader/test_reflective_loader.dart'; | ||
|
||
import '../rule_test_support.dart'; | ||
|
||
main() { | ||
defineReflectiveSuite(() { | ||
defineReflectiveTests(SizedBoxForWhitespaceTest); | ||
}); | ||
} | ||
|
||
@reflectiveTest | ||
class SizedBoxForWhitespaceTest extends LintRuleTest { | ||
@override | ||
bool get addFlutterPackageDep => true; | ||
|
||
@override | ||
String get lintRule => 'sized_box_for_whitespace'; | ||
|
||
test_hasChild() async { | ||
await assertNoDiagnostics(r''' | ||
import 'package:flutter/widgets.dart'; | ||
Widget f() { | ||
return Container( | ||
child: Row(), | ||
); | ||
} | ||
'''); | ||
} | ||
|
||
test_hasHeight_andChild() async { | ||
await assertDiagnostics(r''' | ||
import 'package:flutter/widgets.dart'; | ||
Widget f() { | ||
return Container( | ||
height: 10, | ||
child: Row(), | ||
); | ||
} | ||
''', [ | ||
lint(62, 9), | ||
]); | ||
} | ||
|
||
test_hasHeight_noChild() async { | ||
await assertNoDiagnostics(r''' | ||
import 'package:flutter/widgets.dart'; | ||
Widget f() { | ||
return Container( | ||
height:10, | ||
); | ||
} | ||
'''); | ||
} | ||
|
||
test_hasWidth_andChild() async { | ||
await assertDiagnostics(r''' | ||
import 'package:flutter/widgets.dart'; | ||
Widget f() { | ||
return Container( | ||
width: 10, | ||
child: Row(), | ||
); | ||
} | ||
''', [ | ||
lint(62, 9), | ||
]); | ||
} | ||
|
||
test_hasWidth_noChild() async { | ||
await assertNoDiagnostics(r''' | ||
import 'package:flutter/widgets.dart'; | ||
Widget f() { | ||
return Container( | ||
width: 10, | ||
); | ||
} | ||
'''); | ||
} | ||
|
||
test_hasWidthAndHeight_andChild() async { | ||
await assertDiagnostics(r''' | ||
import 'package:flutter/widgets.dart'; | ||
Widget f() { | ||
return Container( | ||
width: 10, | ||
height: 10, | ||
child: Row(), | ||
); | ||
} | ||
''', [ | ||
lint(62, 9), | ||
]); | ||
} | ||
|
||
test_hasWidthAndHeight_andKey_noChild() async { | ||
await assertDiagnostics(r''' | ||
import 'package:flutter/widgets.dart'; | ||
Widget f() { | ||
return Container( | ||
key: Key(''), | ||
width: 10, | ||
height: 10, | ||
); | ||
} | ||
''', [ | ||
lint(62, 9), | ||
]); | ||
} | ||
|
||
test_hasWidthAndHeight_noChild() async { | ||
await assertDiagnostics(r''' | ||
import 'package:flutter/widgets.dart'; | ||
Widget f() { | ||
return Container( | ||
width: 10, | ||
height: 10, | ||
); | ||
} | ||
''', [ | ||
lint(62, 9), | ||
]); | ||
} | ||
|
||
test_noArguments() async { | ||
await assertNoDiagnostics(r''' | ||
import 'package:flutter/widgets.dart'; | ||
Widget emptyContainer() { | ||
return Container(); | ||
} | ||
'''); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.