diff --git a/dev/automated_tests/flutter_test/child_directory/second_trivial_test.dart b/dev/automated_tests/flutter_test/child_directory/second_trivial_test.dart new file mode 100644 index 00000000000..3646502e47b --- /dev/null +++ b/dev/automated_tests/flutter_test/child_directory/second_trivial_test.dart @@ -0,0 +1,9 @@ +// Copyright 2017 The Chromium Authors. 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/test.dart' hide TypeMatcher, isInstanceOf; + +void main() { + test('trivial', () { }); +} diff --git a/dev/automated_tests/flutter_test/child_directory/trivial_test.dart b/dev/automated_tests/flutter_test/child_directory/trivial_test.dart new file mode 100644 index 00000000000..3646502e47b --- /dev/null +++ b/dev/automated_tests/flutter_test/child_directory/trivial_test.dart @@ -0,0 +1,9 @@ +// Copyright 2017 The Chromium Authors. 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/test.dart' hide TypeMatcher, isInstanceOf; + +void main() { + test('trivial', () { }); +} diff --git a/packages/flutter_tools/test/general.shard/commands/test_test.dart b/packages/flutter_tools/test/general.shard/commands/test_test.dart index 4217fa1f24c..fc0f664a7ff 100644 --- a/packages/flutter_tools/test/general.shard/commands/test_test.dart +++ b/packages/flutter_tools/test/general.shard/commands/test_test.dart @@ -103,6 +103,21 @@ void main() { expect(result.exitCode, 0); }); + testUsingContext('run all tests inside of a directory with no trailing slash', () async { + Cache.flutterRoot = '../..'; + final ProcessResult result = await _runFlutterTest(null, automatedTestsDirectory, flutterTestDirectory + '/child_directory', + extraArguments: const ['--verbose']); + if ((!result.stdout.contains('+2: All tests passed')) || + (!result.stdout.contains('test 0: starting shell process')) || + (!result.stdout.contains('test 0: deleting temporary directory')) || + (!result.stdout.contains('test 0: finished')) || + (!result.stdout.contains('test package returned with exit code 0'))) + fail('unexpected output from test:\n\n${result.stdout}\n-- end stdout --\n\n'); + if (result.stderr.isNotEmpty) + fail('unexpected error output from test:\n\n${result.stderr}\n-- end stderr --\n\n'); + expect(result.exitCode, 0); + }); + }); } @@ -194,10 +209,20 @@ Future _runFlutterTest( List extraArguments = const [], }) async { - final String testFilePath = fs.path.join(testDirectory, '${testName}_test.dart'); - final File testFile = fs.file(testFilePath); - if (!testFile.existsSync()) - fail('missing test file: $testFile'); + String testPath; + if (testName == null) { + // Test everything in the directory. + testPath = testDirectory; + final Directory directoryToTest = fs.directory(testPath); + if (!directoryToTest.existsSync()) + fail('missing test directory: $directoryToTest'); + } else { + // Test just a specific test file. + testPath = fs.path.join(testDirectory, '${testName}_test.dart'); + final File testFile = fs.file(testPath); + if (!testFile.existsSync()) + fail('missing test file: $testFile'); + } final List args = [ ...dartVmFlags, @@ -205,7 +230,7 @@ Future _runFlutterTest( 'test', '--no-color', ...extraArguments, - testFilePath + testPath ]; while (_testExclusionLock != null)