From 7a0f3d340506784822bfba577f2341623eb8a534 Mon Sep 17 00:00:00 2001 From: Ian Hickson Date: Thu, 22 Sep 2016 16:07:56 -0700 Subject: [PATCH] Remove a sketchy override of a field (#6009) The way this was implemented is sketchy, especially in strong mode. --- .../flutter_tools/lib/src/commands/test.dart | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/packages/flutter_tools/lib/src/commands/test.dart b/packages/flutter_tools/lib/src/commands/test.dart index 6fb7276126..4a08ed1fc3 100644 --- a/packages/flutter_tools/lib/src/commands/test.dart +++ b/packages/flutter_tools/lib/src/commands/test.dart @@ -36,6 +36,17 @@ class TestCommand extends FlutterCommand { defaultsTo: 'coverage/lcov.info', help: 'Where to store coverage information (if coverage is enabled).' ); + commandValidator = () { + if (!FileSystemEntity.isFileSync('pubspec.yaml')) { + printError( + 'Error: No pubspec.yaml file found in the current working directory.\n' + 'Run this command from the root of your project. Test files must be\n' + 'called *_test.dart and must reside in the package\'s \'test\'\n' + 'directory (or one of its subdirectories).'); + return false; + } + return true; + }; } @override @@ -44,19 +55,6 @@ class TestCommand extends FlutterCommand { @override String get description => 'Run Flutter unit tests for the current project.'; - @override - Validator commandValidator = () { - if (!FileSystemEntity.isFileSync('pubspec.yaml')) { - printError( - 'Error: No pubspec.yaml file found in the current working directory.\n' - 'Run this command from the root of your project. Test files must be\n' - 'called *_test.dart and must reside in the package\'s \'test\'\n' - 'directory (or one of its subdirectories).'); - return false; - } - return true; - }; - Iterable _findTests(Directory directory) { return directory.listSync(recursive: true, followLinks: false) .where((FileSystemEntity entity) => entity.path.endsWith('_test.dart') &&