@@ -13,28 +13,28 @@ import 'package:test/test.dart' as test_package;
1313 * A marker annotation used to annotate test methods which are expected to fail
1414 * when asserts are enabled.
1515 */
16- const _AssertFailingTest assertFailingTest = const _AssertFailingTest ();
16+ const _AssertFailingTest assertFailingTest = _AssertFailingTest ();
1717
1818/**
1919 * A marker annotation used to annotate test methods which are expected to fail.
2020 */
21- const FailingTest failingTest = const FailingTest ();
21+ const FailingTest failingTest = FailingTest ();
2222
2323/**
2424 * A marker annotation used to instruct dart2js to keep reflection information
2525 * for the annotated classes.
2626 */
27- const _ReflectiveTest reflectiveTest = const _ReflectiveTest ();
27+ const _ReflectiveTest reflectiveTest = _ReflectiveTest ();
2828
2929/**
3030 * A marker annotation used to annotate test methods that should be skipped.
3131 */
32- const SkippedTest skippedTest = const SkippedTest ();
32+ const SkippedTest skippedTest = SkippedTest ();
3333
3434/**
3535 * A marker annotation used to annotate "solo" groups and tests.
3636 */
37- const _SoloTest soloTest = const _SoloTest ();
37+ const _SoloTest soloTest = _SoloTest ();
3838
3939final List <_Group > _currentGroups = < _Group > [];
4040int _currentSuiteLevel = 0 ;
@@ -58,7 +58,7 @@ final bool _isCheckedMode = () {
5858 * create embedded suites. If the current suite is the top-level one, perform
5959 * check for "solo" groups and tests, and run all or only "solo" items.
6060 */
61- void defineReflectiveSuite (void define () , {String name = '' }) {
61+ void defineReflectiveSuite (void Function () define , {String name = '' }) {
6262 String groupName = _currentSuiteName;
6363 _currentSuiteLevel++ ;
6464 try {
@@ -96,15 +96,15 @@ void defineReflectiveTests(Type type) {
9696 if (! classMirror.metadata.any ((InstanceMirror annotation) =>
9797 annotation.type.reflectedType == _ReflectiveTest )) {
9898 String name = MirrorSystem .getName (classMirror.qualifiedName);
99- throw new Exception ('Class $name must have annotation "@reflectiveTest" '
99+ throw Exception ('Class $name must have annotation "@reflectiveTest" '
100100 'in order to be run by runReflectiveTests.' );
101101 }
102102
103103 _Group group;
104104 {
105105 bool isSolo = _hasAnnotationInstance (classMirror, soloTest);
106106 String className = MirrorSystem .getName (classMirror.simpleName);
107- group = new _Group (isSolo, _combineNames (_currentSuiteName, className));
107+ group = _Group (isSolo, _combineNames (_currentSuiteName, className));
108108 _currentGroups.add (group);
109109 }
110110
@@ -229,16 +229,18 @@ bool _hasSkippedTestAnnotation(MethodMirror method) =>
229229
230230Future <Object ?> _invokeSymbolIfExists (
231231 InstanceMirror instanceMirror, Symbol symbol) {
232- Object ? invocationResult = null ;
232+ Object ? invocationResult;
233233 InstanceMirror ? closure;
234234 try {
235235 closure = instanceMirror.getField (symbol);
236- } on NoSuchMethodError {}
236+ } on NoSuchMethodError {
237+ // ignore
238+ }
237239
238240 if (closure is ClosureMirror ) {
239241 invocationResult = closure.apply ([]).reflectee;
240242 }
241- return new Future .value (invocationResult);
243+ return Future .value (invocationResult);
242244}
243245
244246/**
@@ -252,7 +254,8 @@ Future<Object?> _invokeSymbolIfExists(
252254Future <Object ?>? _runFailingTest (ClassMirror classMirror, Symbol symbol) {
253255 bool passed = false ;
254256 return runZonedGuarded (() {
255- return new Future .sync (() => _runTest (classMirror, symbol)).then <void >((_) {
257+ // ignore: void_checks
258+ return Future .sync (() => _runTest (classMirror, symbol)).then <void >((_) {
256259 passed = true ;
257260 test_package.fail ('Test passed - expected to fail.' );
258261 }).catchError ((e) {
@@ -272,7 +275,7 @@ Future<Object?>? _runFailingTest(ClassMirror classMirror, Symbol symbol) {
272275}
273276
274277Future <Object ?> _runTest (ClassMirror classMirror, Symbol symbol) {
275- InstanceMirror instanceMirror = classMirror.newInstance (new Symbol ('' ), []);
278+ InstanceMirror instanceMirror = classMirror.newInstance (Symbol ('' ), []);
276279 return _invokeSymbolIfExists (instanceMirror, #setUp)
277280 .then ((_) => instanceMirror.invoke (symbol, []).reflectee)
278281 .whenComplete (() => _invokeSymbolIfExists (instanceMirror, #tearDown));
@@ -341,15 +344,15 @@ class _Group {
341344
342345 void addSkippedTest (String name) {
343346 var fullName = _combineNames (this .name, name);
344- tests.add (new _Test .skipped (isSolo, fullName));
347+ tests.add (_Test .skipped (isSolo, fullName));
345348 }
346349
347350 void addTest (bool isSolo, String name, MethodMirror memberMirror,
348351 _TestFunction function) {
349352 var fullName = _combineNames (this .name, name);
350353 var timeout =
351354 _getAnnotationInstance (memberMirror, TestTimeout ) as TestTimeout ? ;
352- tests.add (new _Test (isSolo, fullName, function, timeout? ._timeout));
355+ tests.add (_Test (isSolo, fullName, function, timeout? ._timeout));
353356 }
354357}
355358
0 commit comments