Migrate another big chunk of the engine repo to package:test (flutter/engine#54853)
There are almost no behavioral changes. Because `dart test` runs with assertions, and the former command does not, I had to tweak some of the engine tool tests because they would assert that there were duplicate names - but I didn't change any actual code besides the test expectations themselves/the fixtures. This is not all of the engine, but is approximately 1/3 of all imports of `package:litetest` migrated.
This commit is contained in:
@@ -20,6 +20,5 @@ dependencies:
|
||||
process: any
|
||||
|
||||
dev_dependencies:
|
||||
async_helper: any
|
||||
expect: any
|
||||
litetest: any
|
||||
engine_repo_tools: any
|
||||
test: any
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
|
||||
import 'dart:io' as io;
|
||||
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:engine_repo_tools/engine_repo_tools.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../bin/format.dart' as target;
|
||||
|
||||
final io.File script = io.File.fromUri(io.Platform.script).absolute;
|
||||
final io.Directory repoDir = script.parent.parent.parent;
|
||||
final io.Directory repoDir = Engine.findWithin().flutterDir;
|
||||
|
||||
class FileContentPair {
|
||||
FileContentPair(this.original, this.formatted);
|
||||
@@ -32,22 +32,21 @@ final FileContentPair pythonContentPair = FileContentPair(
|
||||
"if __name__=='__main__':\n sys.exit(\nMain(sys.argv)\n)\n",
|
||||
"if __name__ == '__main__':\n sys.exit(Main(sys.argv))\n");
|
||||
final FileContentPair whitespaceContentPair = FileContentPair(
|
||||
'int main() {\n return 0; \n}\n',
|
||||
'int main() {\n return 0;\n}\n');
|
||||
'int main() {\n return 0; \n}\n', 'int main() {\n return 0;\n}\n');
|
||||
final FileContentPair headerContentPair = FileContentPair(
|
||||
<String>[
|
||||
'#ifndef FOO_H_',
|
||||
'#define FOO_H_',
|
||||
'',
|
||||
'#endif // FOO_H_',
|
||||
].join('\n'),
|
||||
<String>[
|
||||
'#ifndef FLUTTER_FORMAT_TEST_H_',
|
||||
'#define FLUTTER_FORMAT_TEST_H_',
|
||||
'',
|
||||
'#endif // FLUTTER_FORMAT_TEST_H_',
|
||||
'',
|
||||
].join('\n'),
|
||||
<String>[
|
||||
'#ifndef FOO_H_',
|
||||
'#define FOO_H_',
|
||||
'',
|
||||
'#endif // FOO_H_',
|
||||
].join('\n'),
|
||||
<String>[
|
||||
'#ifndef FLUTTER_FORMAT_TEST_H_',
|
||||
'#define FLUTTER_FORMAT_TEST_H_',
|
||||
'',
|
||||
'#endif // FLUTTER_FORMAT_TEST_H_',
|
||||
'',
|
||||
].join('\n'),
|
||||
);
|
||||
|
||||
class TestFileFixture {
|
||||
@@ -238,7 +237,8 @@ void main() {
|
||||
try {
|
||||
fixture.gitAdd();
|
||||
io.Process.runSync(
|
||||
formatterPath, <String>['--check', 'header', '--fix'],
|
||||
formatterPath,
|
||||
<String>['--check', 'header', '--fix'],
|
||||
workingDirectory: repoDir.path,
|
||||
);
|
||||
final Iterable<FileContentPair> files = fixture.getFileContents();
|
||||
|
||||
@@ -966,10 +966,7 @@ def uses_package_test_runner(package):
|
||||
# arguments to pass to each of the packages tests.
|
||||
def build_dart_host_test_list(build_dir):
|
||||
dart_host_tests = [
|
||||
(
|
||||
os.path.join('flutter', 'ci'),
|
||||
[os.path.join(BUILDROOT_DIR, 'flutter')],
|
||||
),
|
||||
(os.path.join('flutter', 'ci'), []),
|
||||
(
|
||||
os.path.join('flutter', 'flutter_frontend_server'),
|
||||
[
|
||||
|
||||
@@ -18,7 +18,4 @@ dependencies:
|
||||
path: any
|
||||
|
||||
dev_dependencies:
|
||||
async_helper: any
|
||||
expect: any
|
||||
litetest: any
|
||||
smith: any
|
||||
test: any
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
import 'dart:io' as io;
|
||||
|
||||
import 'package:build_bucket_golden_scraper/build_bucket_golden_scraper.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:test/test.dart';
|
||||
|
||||
int main(List<String> args) {
|
||||
void main() {
|
||||
test('parses command-line arguments', () {
|
||||
// Create a fake engine directory.
|
||||
final io.Directory buildRoot = io.Directory.systemTemp.createTempSync('build_bucket_golden_scraper_test_engine');
|
||||
@@ -69,6 +69,4 @@ iVBORw0KGgoAAAANSUhEUgAAADcAAAA3CAYAAACo29JGAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAA
|
||||
buildRoot.deleteSync(recursive: true);
|
||||
}
|
||||
});
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -9,5 +9,6 @@ environment:
|
||||
resolution: workspace
|
||||
|
||||
dev_dependencies:
|
||||
litetest: any
|
||||
engine_repo_tools: any
|
||||
path: any
|
||||
test: any
|
||||
|
||||
@@ -4,12 +4,17 @@
|
||||
|
||||
import 'dart:io' as io;
|
||||
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:engine_repo_tools/engine_repo_tools.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
// Find a path to `dir_contents_diff.dart` from the working directory.
|
||||
final String pkgPath = io.File.fromUri(io.Platform.script).parent.parent.path;
|
||||
final String pkgPath = p.join(
|
||||
Engine.findWithin().flutterDir.path,
|
||||
'tools',
|
||||
'dir_contents_diff',
|
||||
);
|
||||
final String binPath = p.join(
|
||||
pkgPath,
|
||||
'bin',
|
||||
@@ -44,7 +49,8 @@ void main() {
|
||||
});
|
||||
|
||||
test('lists files and diffs successfully, even with an EOF newline', () {
|
||||
final String goldenPath = p.join(pkgPath, 'test', 'file_ok_eof_newline.txt');
|
||||
final String goldenPath =
|
||||
p.join(pkgPath, 'test', 'file_ok_eof_newline.txt');
|
||||
final String dirPath = p.join(pkgPath, 'test', 'fixtures');
|
||||
final (int exitCode, String output) = runSync(goldenPath, dirPath);
|
||||
if (exitCode != 0) {
|
||||
@@ -67,7 +73,8 @@ void main() {
|
||||
});
|
||||
|
||||
test('diff fails when an unexpected file is present', () {
|
||||
final String goldenPath = p.join(pkgPath, 'test', 'file_bad_unexpected.txt');
|
||||
final String goldenPath =
|
||||
p.join(pkgPath, 'test', 'file_bad_unexpected.txt');
|
||||
final String dirPath = p.join(pkgPath, 'test', 'fixtures');
|
||||
final (int exitCode, String output) = runSync(goldenPath, dirPath);
|
||||
if (exitCode == 0) {
|
||||
|
||||
@@ -24,5 +24,5 @@ dependencies:
|
||||
process_runner: any
|
||||
|
||||
dev_dependencies:
|
||||
litetest: any
|
||||
process_fakes: any
|
||||
test: any
|
||||
|
||||
@@ -10,9 +10,9 @@ import 'package:engine_tool/src/build_utils.dart';
|
||||
import 'package:engine_tool/src/commands/command_runner.dart';
|
||||
import 'package:engine_tool/src/environment.dart';
|
||||
import 'package:engine_tool/src/logger.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:platform/platform.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'fixtures.dart' as fixtures;
|
||||
import 'utils.dart';
|
||||
@@ -38,7 +38,6 @@ void main() {
|
||||
|
||||
final Map<String, BuilderConfig> configs = <String, BuilderConfig>{
|
||||
'linux_test_config': linuxTestConfig,
|
||||
'linux_test_config2': linuxTestConfig,
|
||||
'mac_test_config': macTestConfig,
|
||||
'win_test_config': winTestConfig,
|
||||
};
|
||||
@@ -53,8 +52,9 @@ void main() {
|
||||
cannedProcesses: cannedProcesses,
|
||||
);
|
||||
try {
|
||||
final List<Build> result = runnableBuilds(testEnv.environment, configs, true);
|
||||
expect(result.length, equals(8));
|
||||
final List<Build> result =
|
||||
runnableBuilds(testEnv.environment, configs, true);
|
||||
expect(result.length, equals(4));
|
||||
expect(result[0].name, equals('ci/build_name'));
|
||||
} finally {
|
||||
testEnv.cleanup();
|
||||
@@ -123,7 +123,7 @@ void main() {
|
||||
expect(testEnv.processHistory.length, greaterThanOrEqualTo(3));
|
||||
expect(
|
||||
testEnv.processHistory[2].command,
|
||||
containsStringsInOrder(<String>['python3', 'gen/script.py']),
|
||||
containsAllInOrder(<String>['python3', 'gen/script.py']),
|
||||
);
|
||||
} finally {
|
||||
testEnv.cleanup();
|
||||
@@ -251,7 +251,7 @@ void main() {
|
||||
expect(testEnv.processHistory[0].command[0],
|
||||
contains(path.join('tools', 'gn')));
|
||||
expect(testEnv.processHistory[0].command,
|
||||
doesNotContainAny(<String>['--rbe']));
|
||||
isNot(contains(<String>['--rbe'])));
|
||||
expect(testEnv.processHistory[1].command[0],
|
||||
contains(path.join('ninja', 'ninja')));
|
||||
} finally {
|
||||
@@ -278,7 +278,7 @@ void main() {
|
||||
expect(testEnv.processHistory[0].command[0],
|
||||
contains(path.join('tools', 'gn')));
|
||||
expect(testEnv.processHistory[0].command,
|
||||
doesNotContainAny(<String>['--rbe']));
|
||||
isNot(contains(<String>['--rbe'])));
|
||||
expect(testEnv.processHistory[1].command[0],
|
||||
contains(path.join('ninja', 'ninja')));
|
||||
} finally {
|
||||
@@ -305,7 +305,10 @@ void main() {
|
||||
);
|
||||
try {
|
||||
final Environment env = testEnv.environment;
|
||||
expectArgumentError(() => mangleConfigName(env, 'build'));
|
||||
expect(
|
||||
() => mangleConfigName(env, 'build'),
|
||||
throwsArgumentError,
|
||||
);
|
||||
} finally {
|
||||
testEnv.cleanup();
|
||||
}
|
||||
@@ -316,9 +319,9 @@ void main() {
|
||||
cannedProcesses: cannedProcesses,
|
||||
);
|
||||
try {
|
||||
final Environment env = testEnv.environment;
|
||||
expect(demangleConfigName(env, 'build'), equals('linux/build'));
|
||||
expect(demangleConfigName(env, 'ci/build'), equals('ci/build'));
|
||||
final Environment env = testEnv.environment;
|
||||
expect(demangleConfigName(env, 'build'), equals('linux/build'));
|
||||
expect(demangleConfigName(env, 'ci/build'), equals('ci/build'));
|
||||
} finally {
|
||||
testEnv.cleanup();
|
||||
}
|
||||
@@ -453,9 +456,9 @@ void main() {
|
||||
|
||||
test('build command gracefully handles no matched targets', () async {
|
||||
final List<CannedProcess> cannedProcesses = <CannedProcess>[
|
||||
CannedProcess((List<String> command) =>
|
||||
command.contains('desc'),
|
||||
stdout: fixtures.gnDescOutputEmpty(gnPattern: 'testing/scenario_app:sceario_app'),
|
||||
CannedProcess((List<String> command) => command.contains('desc'),
|
||||
stdout: fixtures.gnDescOutputEmpty(
|
||||
gnPattern: 'testing/scenario_app:sceario_app'),
|
||||
exitCode: 1),
|
||||
];
|
||||
final TestEnvironment testEnv = TestEnvironment.withTestEngine(
|
||||
@@ -496,7 +499,8 @@ void main() {
|
||||
help: true,
|
||||
);
|
||||
final int result = await runner.run(<String>[
|
||||
'help', 'build',
|
||||
'help',
|
||||
'build',
|
||||
]);
|
||||
expect(result, equals(0));
|
||||
} finally {
|
||||
@@ -528,7 +532,8 @@ void main() {
|
||||
help: true,
|
||||
);
|
||||
final int result = await runner.run(<String>[
|
||||
'help', 'build',
|
||||
'help',
|
||||
'build',
|
||||
]);
|
||||
expect(result, equals(0));
|
||||
} finally {
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
import 'dart:io' as io;
|
||||
|
||||
import 'package:engine_repo_tools/engine_repo_tools.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:platform/platform.dart';
|
||||
import 'package:process_runner/process_runner.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
final Engine engine;
|
||||
|
||||
@@ -10,10 +10,10 @@ import 'package:engine_repo_tools/engine_repo_tools.dart';
|
||||
import 'package:engine_tool/src/commands/command_runner.dart';
|
||||
import 'package:engine_tool/src/environment.dart';
|
||||
import 'package:engine_tool/src/logger.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:platform/platform.dart';
|
||||
import 'package:process_fakes/process_fakes.dart';
|
||||
import 'package:process_runner/process_runner.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
final Engine? engine = Engine.tryFindWithin();
|
||||
@@ -62,7 +62,7 @@ void main() {
|
||||
expect(runHistory.length, greaterThanOrEqualTo(1));
|
||||
expect(
|
||||
runHistory[0],
|
||||
containsStringsInOrder(<String>['gclient', 'sync', '-D']),
|
||||
containsAllInOrder(<String>['gclient', 'sync', '-D']),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -78,7 +78,7 @@ void main() {
|
||||
expect(runHistory.length, greaterThanOrEqualTo(1));
|
||||
expect(
|
||||
runHistory[0],
|
||||
containsStringsInOrder(<String>['gclient', 'sync', '-D']),
|
||||
containsAllInOrder(<String>['gclient', 'sync', '-D']),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,13 +2,15 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
String testConfig(String osDimension, String osPlatform) => '''
|
||||
String testConfig(String osDimension, String osPlatform,
|
||||
{String suffix = ''}) =>
|
||||
'''
|
||||
{
|
||||
"builds": [
|
||||
{
|
||||
"archives": [
|
||||
{
|
||||
"name": "build_name",
|
||||
"name": "build_name$suffix",
|
||||
"base_path": "base/path",
|
||||
"type": "gcs",
|
||||
"include_paths": ["include/path"],
|
||||
@@ -22,16 +24,16 @@ String testConfig(String osDimension, String osPlatform) => '''
|
||||
"variable": false
|
||||
},
|
||||
"gn": ["--gn-arg", "--lto", "--no-rbe"],
|
||||
"name": "ci/build_name",
|
||||
"name": "ci/build_name$suffix",
|
||||
"description": "This is a very long description that will test that the help message is wrapped correctly at an appropriate number of characters.",
|
||||
"ninja": {
|
||||
"config": "build_name",
|
||||
"config": "build_name$suffix",
|
||||
"targets": ["ninja_target"]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"language": "python3",
|
||||
"name": "build_name tests",
|
||||
"name": "build_name$suffix tests",
|
||||
"parameters": ["--test-params"],
|
||||
"script": "test/script.py",
|
||||
"contexts": ["context"]
|
||||
@@ -55,9 +57,9 @@ String testConfig(String osDimension, String osPlatform) => '''
|
||||
"os=$osDimension"
|
||||
],
|
||||
"gn": ["--gn-arg", "--lto", "--no-rbe"],
|
||||
"name": "$osPlatform/host_debug",
|
||||
"name": "$osPlatform/host_debug$suffix",
|
||||
"ninja": {
|
||||
"config": "host_debug",
|
||||
"config": "host_debug$suffix",
|
||||
"targets": ["ninja_target"]
|
||||
}
|
||||
},
|
||||
@@ -66,9 +68,9 @@ String testConfig(String osDimension, String osPlatform) => '''
|
||||
"os=$osDimension"
|
||||
],
|
||||
"gn": ["--gn-arg", "--lto", "--no-rbe"],
|
||||
"name": "$osPlatform/android_debug_arm64",
|
||||
"name": "$osPlatform/android_debug${suffix}_arm64",
|
||||
"ninja": {
|
||||
"config": "android_debug_arm64",
|
||||
"config": "android_debug${suffix}_arm64",
|
||||
"targets": ["ninja_target"]
|
||||
}
|
||||
},
|
||||
@@ -77,9 +79,9 @@ String testConfig(String osDimension, String osPlatform) => '''
|
||||
"os=$osDimension"
|
||||
],
|
||||
"gn": ["--gn-arg", "--lto", "--rbe"],
|
||||
"name": "ci/android_debug_rbe_arm64",
|
||||
"name": "ci/android_debug${suffix}_rbe_arm64",
|
||||
"ninja": {
|
||||
"config": "android_debug_rbe_arm64",
|
||||
"config": "android_debug${suffix}_rbe_arm64",
|
||||
"targets": ["ninja_target"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,11 +11,11 @@ import 'package:engine_tool/src/commands/command_runner.dart';
|
||||
import 'package:engine_tool/src/commands/flags.dart';
|
||||
import 'package:engine_tool/src/environment.dart';
|
||||
import 'package:engine_tool/src/logger.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:logging/logging.dart' as log;
|
||||
import 'package:platform/platform.dart';
|
||||
import 'package:process_fakes/process_fakes.dart';
|
||||
import 'package:process_runner/process_runner.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
final Engine engine;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import 'package:engine_tool/src/gn.dart';
|
||||
import 'package:engine_tool/src/label.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'utils.dart';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:engine_tool/src/label.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
group('Label', () {
|
||||
|
||||
@@ -11,10 +11,10 @@ import 'package:engine_repo_tools/engine_repo_tools.dart';
|
||||
import 'package:engine_tool/src/commands/command_runner.dart';
|
||||
import 'package:engine_tool/src/environment.dart';
|
||||
import 'package:engine_tool/src/logger.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:platform/platform.dart';
|
||||
import 'package:process_fakes/process_fakes.dart';
|
||||
import 'package:process_runner/process_runner.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'fixtures.dart' as fixtures;
|
||||
|
||||
@@ -47,7 +47,6 @@ void main() {
|
||||
|
||||
final Map<String, BuilderConfig> configs = <String, BuilderConfig>{
|
||||
'linux_test_config': linuxTestConfig,
|
||||
'linux_test_config2': linuxTestConfig,
|
||||
'mac_test_config': macTestConfig,
|
||||
'win_test_config': winTestConfig,
|
||||
};
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:engine_tool/src/logger.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:logging/logging.dart' as log;
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
List<String> stringsFromLogs(List<log.LogRecord> logs) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:engine_tool/src/phone_home.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
test('can et phone home', () async {
|
||||
|
||||
@@ -10,10 +10,10 @@ import 'package:engine_tool/src/environment.dart';
|
||||
import 'package:engine_tool/src/logger.dart';
|
||||
import 'package:engine_tool/src/proc_utils.dart';
|
||||
import 'package:engine_tool/src/worker_pool.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:platform/platform.dart';
|
||||
import 'package:process_fakes/process_fakes.dart';
|
||||
import 'package:process_runner/process_runner.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
final Engine engine;
|
||||
@@ -79,7 +79,7 @@ void main() {
|
||||
ProcessTask('F', env, io.Directory.current, <String>['failure']);
|
||||
final bool r = await wp.run(<WorkerTask>{task});
|
||||
expect(r, equals(false));
|
||||
expect(task.processArtifacts.exitCode, notEquals(0));
|
||||
expect(task.processArtifacts.exitCode, isNot(0));
|
||||
final ProcessArtifacts loaded =
|
||||
ProcessArtifacts.fromFile(io.File(task.processArtifactsPath));
|
||||
expect(loaded.stdout, equals('stdout failure'));
|
||||
|
||||
@@ -7,9 +7,9 @@ import 'dart:convert' as convert;
|
||||
import 'package:engine_build_configs/engine_build_configs.dart';
|
||||
import 'package:engine_tool/src/commands/command_runner.dart';
|
||||
import 'package:engine_tool/src/environment.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:logging/logging.dart' as log;
|
||||
import 'package:platform/platform.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'fixtures.dart' as fixtures;
|
||||
import 'utils.dart';
|
||||
@@ -21,6 +21,12 @@ void main() {
|
||||
as Map<String, Object?>,
|
||||
);
|
||||
|
||||
final BuilderConfig linuxTestConfig2 = BuilderConfig.fromJson(
|
||||
path: 'ci/builders/linux_test_config2.json',
|
||||
map: convert.jsonDecode(fixtures.testConfig('Linux', Platform.linux, suffix: '2'))
|
||||
as Map<String, Object?>,
|
||||
);
|
||||
|
||||
final BuilderConfig macTestConfig = BuilderConfig.fromJson(
|
||||
path: 'ci/builders/mac_test_config.json',
|
||||
map: convert.jsonDecode(fixtures.testConfig('Mac-12', Platform.macOS))
|
||||
@@ -35,7 +41,7 @@ void main() {
|
||||
|
||||
final Map<String, BuilderConfig> configs = <String, BuilderConfig>{
|
||||
'linux_test_config': linuxTestConfig,
|
||||
'linux_test_config2': linuxTestConfig,
|
||||
'linux_test_config2': linuxTestConfig2,
|
||||
'mac_test_config': macTestConfig,
|
||||
'win_test_config': winTestConfig,
|
||||
};
|
||||
@@ -75,10 +81,10 @@ void main() {
|
||||
' "linux/android_debug_arm64" config\n',
|
||||
' "ci/android_debug_rbe_arm64" config\n',
|
||||
'"linux_test_config2" builder:\n',
|
||||
' "ci/build_name" config\n',
|
||||
' "linux/host_debug" config\n',
|
||||
' "linux/android_debug_arm64" config\n',
|
||||
' "ci/android_debug_rbe_arm64" config\n',
|
||||
' "ci/build_name2" config\n',
|
||||
' "linux/host_debug2" config\n',
|
||||
' "linux/android_debug2_arm64" config\n',
|
||||
' "ci/android_debug2_rbe_arm64" config\n',
|
||||
]),
|
||||
);
|
||||
} finally {
|
||||
|
||||
@@ -13,10 +13,10 @@ import 'package:engine_tool/src/environment.dart';
|
||||
import 'package:engine_tool/src/label.dart';
|
||||
import 'package:engine_tool/src/logger.dart';
|
||||
import 'package:engine_tool/src/run_utils.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:platform/platform.dart';
|
||||
import 'package:process_fakes/process_fakes.dart';
|
||||
import 'package:process_runner/process_runner.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'fixtures.dart' as fixtures;
|
||||
|
||||
@@ -50,7 +50,6 @@ void main() {
|
||||
|
||||
final Map<String, BuilderConfig> configs = <String, BuilderConfig>{
|
||||
'linux_test_config': linuxTestConfig,
|
||||
'linux_test_config2': linuxTestConfig,
|
||||
'mac_test_config': macTestConfig,
|
||||
'win_test_config': winTestConfig,
|
||||
};
|
||||
@@ -62,10 +61,10 @@ void main() {
|
||||
abi: ffi.Abi.linuxX64,
|
||||
engine: engine,
|
||||
platform: FakePlatform(
|
||||
operatingSystem: Platform.linux,
|
||||
resolvedExecutable: io.Platform.resolvedExecutable,
|
||||
pathSeparator: '/',
|
||||
numberOfProcessors: 32,
|
||||
operatingSystem: Platform.linux,
|
||||
resolvedExecutable: io.Platform.resolvedExecutable,
|
||||
pathSeparator: '/',
|
||||
numberOfProcessors: 32,
|
||||
),
|
||||
processRunner: ProcessRunner(
|
||||
processManager: FakeProcessManager(onStart: (List<String> command) {
|
||||
@@ -100,7 +99,7 @@ void main() {
|
||||
expect(result, equals(0));
|
||||
expect(runHistory.length, greaterThanOrEqualTo(6));
|
||||
expect(runHistory[5],
|
||||
containsStringsInOrder(<String>['flutter', 'run', '--weird_argument']));
|
||||
containsAllInOrder(<String>['flutter', 'run', '--weird_argument']));
|
||||
});
|
||||
|
||||
test('parse devices list', () async {
|
||||
@@ -165,7 +164,7 @@ void main() {
|
||||
// Observe that we selected android_debug_arm64 as the target.
|
||||
expect(
|
||||
runHistory[5],
|
||||
containsStringsInOrder(<String>[
|
||||
containsAllInOrder(<String>[
|
||||
'flutter',
|
||||
'run',
|
||||
'--local-engine',
|
||||
|
||||
@@ -7,8 +7,8 @@ import 'dart:convert' as convert;
|
||||
import 'package:engine_build_configs/engine_build_configs.dart';
|
||||
import 'package:engine_tool/src/commands/command_runner.dart';
|
||||
import 'package:engine_tool/src/environment.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:platform/platform.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'fixtures.dart' as fixtures;
|
||||
import 'utils.dart';
|
||||
@@ -34,7 +34,6 @@ void main() {
|
||||
|
||||
final Map<String, BuilderConfig> configs = <String, BuilderConfig>{
|
||||
'linux_test_config': linuxTestConfig,
|
||||
'linux_test_config2': linuxTestConfig,
|
||||
'mac_test_config': macTestConfig,
|
||||
'win_test_config': winTestConfig,
|
||||
};
|
||||
|
||||
@@ -3,23 +3,27 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:engine_tool/src/typed_json.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
group('JsonObject.string', () {
|
||||
test('returns string value', () {
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 'value'});
|
||||
const JsonObject jsonObject =
|
||||
JsonObject(<String, Object?>{'key': 'value'});
|
||||
expect(jsonObject.string('key'), 'value');
|
||||
});
|
||||
|
||||
test('throws due to missing key', () {
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 'value'});
|
||||
expect(() => jsonObject.string('missing'), throwsA(isInstanceOf<MissingKeyJsonReadException>()));
|
||||
const JsonObject jsonObject =
|
||||
JsonObject(<String, Object?>{'key': 'value'});
|
||||
expect(() => jsonObject.string('missing'),
|
||||
throwsA(const isInstanceOf<MissingKeyJsonReadException>()));
|
||||
});
|
||||
|
||||
test('throws due to wrong type', () {
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 42});
|
||||
expect(() => jsonObject.string('key'), throwsA(isInstanceOf<InvalidTypeJsonReadException>()));
|
||||
expect(() => jsonObject.string('key'),
|
||||
throwsA(const isInstanceOf<InvalidTypeJsonReadException>()));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -31,12 +35,15 @@ void main() {
|
||||
|
||||
test('throws due to missing key', () {
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 42});
|
||||
expect(() => jsonObject.integer('missing'), throwsA(isInstanceOf<MissingKeyJsonReadException>()));
|
||||
expect(() => jsonObject.integer('missing'),
|
||||
throwsA(const isInstanceOf<MissingKeyJsonReadException>()));
|
||||
});
|
||||
|
||||
test('throws due to wrong type', () {
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 'value'});
|
||||
expect(() => jsonObject.integer('key'), throwsA(isInstanceOf<InvalidTypeJsonReadException>()));
|
||||
const JsonObject jsonObject =
|
||||
JsonObject(<String, Object?>{'key': 'value'});
|
||||
expect(() => jsonObject.integer('key'),
|
||||
throwsA(const isInstanceOf<InvalidTypeJsonReadException>()));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -48,51 +55,67 @@ void main() {
|
||||
|
||||
test('throws due to missing key', () {
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': true});
|
||||
expect(() => jsonObject.boolean('missing'), throwsA(isInstanceOf<MissingKeyJsonReadException>()));
|
||||
expect(() => jsonObject.boolean('missing'),
|
||||
throwsA(const isInstanceOf<MissingKeyJsonReadException>()));
|
||||
});
|
||||
|
||||
test('throws due to wrong type', () {
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 'value'});
|
||||
expect(() => jsonObject.boolean('key'), throwsA(isInstanceOf<InvalidTypeJsonReadException>()));
|
||||
const JsonObject jsonObject =
|
||||
JsonObject(<String, Object?>{'key': 'value'});
|
||||
expect(() => jsonObject.boolean('key'),
|
||||
throwsA(const isInstanceOf<InvalidTypeJsonReadException>()));
|
||||
});
|
||||
});
|
||||
|
||||
group('JsonObject.stringList', () {
|
||||
test('returns string list value', () {
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': <Object?>['value1', 'value2']});
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{
|
||||
'key': <Object?>['value1', 'value2']
|
||||
});
|
||||
expect(jsonObject.stringList('key'), <String>['value1', 'value2']);
|
||||
});
|
||||
|
||||
test('throws due to missing key', () {
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': <Object?>['value1', 'value2']});
|
||||
expect(() => jsonObject.stringList('missing'), throwsA(isInstanceOf<MissingKeyJsonReadException>()));
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{
|
||||
'key': <Object?>['value1', 'value2']
|
||||
});
|
||||
expect(() => jsonObject.stringList('missing'),
|
||||
throwsA(const isInstanceOf<MissingKeyJsonReadException>()));
|
||||
});
|
||||
|
||||
test('throws due to wrong type', () {
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 'value'});
|
||||
expect(() => jsonObject.stringList('key'), throwsA(isInstanceOf<InvalidTypeJsonReadException>()));
|
||||
const JsonObject jsonObject =
|
||||
JsonObject(<String, Object?>{'key': 'value'});
|
||||
expect(() => jsonObject.stringList('key'),
|
||||
throwsA(const isInstanceOf<InvalidTypeJsonReadException>()));
|
||||
});
|
||||
|
||||
test('throws due to wrong element type', () {
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': <Object?>['value1', 42]});
|
||||
expect(() => jsonObject.stringList('key'), throwsA(isInstanceOf<InvalidTypeJsonReadException>()));
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{
|
||||
'key': <Object?>['value1', 42]
|
||||
});
|
||||
expect(() => jsonObject.stringList('key'),
|
||||
throwsA(const isInstanceOf<InvalidTypeJsonReadException>()));
|
||||
});
|
||||
});
|
||||
|
||||
group('JsonObject.stringOrNull', () {
|
||||
test('returns string value', () {
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 'value'});
|
||||
const JsonObject jsonObject =
|
||||
JsonObject(<String, Object?>{'key': 'value'});
|
||||
expect(jsonObject.stringOrNull('key'), 'value');
|
||||
});
|
||||
|
||||
test('returns null due to missing key', () {
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 'value'});
|
||||
const JsonObject jsonObject =
|
||||
JsonObject(<String, Object?>{'key': 'value'});
|
||||
expect(jsonObject.stringOrNull('missing'), isNull);
|
||||
});
|
||||
|
||||
test('throws due to wrong type', () {
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 42});
|
||||
expect(() => jsonObject.stringOrNull('key'), throwsA(isInstanceOf<InvalidTypeJsonReadException>()));
|
||||
expect(() => jsonObject.stringOrNull('key'),
|
||||
throwsA(const isInstanceOf<InvalidTypeJsonReadException>()));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -108,8 +131,10 @@ void main() {
|
||||
});
|
||||
|
||||
test('throws due to wrong type', () {
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 'value'});
|
||||
expect(() => jsonObject.integerOrNull('key'), throwsA(isInstanceOf<InvalidTypeJsonReadException>()));
|
||||
const JsonObject jsonObject =
|
||||
JsonObject(<String, Object?>{'key': 'value'});
|
||||
expect(() => jsonObject.integerOrNull('key'),
|
||||
throwsA(const isInstanceOf<InvalidTypeJsonReadException>()));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -125,36 +150,48 @@ void main() {
|
||||
});
|
||||
|
||||
test('throws due to wrong type', () {
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 'value'});
|
||||
expect(() => jsonObject.booleanOrNull('key'), throwsA(isInstanceOf<InvalidTypeJsonReadException>()));
|
||||
const JsonObject jsonObject =
|
||||
JsonObject(<String, Object?>{'key': 'value'});
|
||||
expect(() => jsonObject.booleanOrNull('key'),
|
||||
throwsA(const isInstanceOf<InvalidTypeJsonReadException>()));
|
||||
});
|
||||
});
|
||||
|
||||
group('JsonObject.stringListOrNull', () {
|
||||
test('returns string list value', () {
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': <Object?>['value1', 'value2']});
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{
|
||||
'key': <Object?>['value1', 'value2']
|
||||
});
|
||||
expect(jsonObject.stringListOrNull('key'), <String>['value1', 'value2']);
|
||||
});
|
||||
|
||||
test('returns null due to missing key', () {
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': <Object?>['value1', 'value2']});
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{
|
||||
'key': <Object?>['value1', 'value2']
|
||||
});
|
||||
expect(jsonObject.stringListOrNull('missing'), isNull);
|
||||
});
|
||||
|
||||
test('throws due to wrong type', () {
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': 'value'});
|
||||
expect(() => jsonObject.stringListOrNull('key'), throwsA(isInstanceOf<InvalidTypeJsonReadException>()));
|
||||
const JsonObject jsonObject =
|
||||
JsonObject(<String, Object?>{'key': 'value'});
|
||||
expect(() => jsonObject.stringListOrNull('key'),
|
||||
throwsA(const isInstanceOf<InvalidTypeJsonReadException>()));
|
||||
});
|
||||
|
||||
test('throws due to wrong element type', () {
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{'key': <Object?>['value1', 42]});
|
||||
expect(() => jsonObject.stringListOrNull('key'), throwsA(isInstanceOf<InvalidTypeJsonReadException>()));
|
||||
const JsonObject jsonObject = JsonObject(<String, Object?>{
|
||||
'key': <Object?>['value1', 42]
|
||||
});
|
||||
expect(() => jsonObject.stringListOrNull('key'),
|
||||
throwsA(const isInstanceOf<InvalidTypeJsonReadException>()));
|
||||
});
|
||||
});
|
||||
|
||||
group('JsonObject.map', () {
|
||||
test('returns multiple fields', () {
|
||||
final (String name, int age, bool isStudent) = const JsonObject(<String, Object?>{
|
||||
final (String name, int age, bool isStudent) =
|
||||
const JsonObject(<String, Object?>{
|
||||
'name': 'Alice',
|
||||
'age': 42,
|
||||
'isStudent': true,
|
||||
@@ -185,9 +222,13 @@ void main() {
|
||||
fail('Expected JsonMapException');
|
||||
} on JsonMapException catch (e) {
|
||||
expect(
|
||||
e.exceptions.map((JsonReadException e) => (e as MissingKeyJsonReadException).key).toList(),
|
||||
containsStringsInOrder(<String>['name', 'isStudent'],
|
||||
));
|
||||
e.exceptions
|
||||
.map((JsonReadException e) =>
|
||||
(e as MissingKeyJsonReadException).key)
|
||||
.toList(),
|
||||
containsAllInOrder(
|
||||
<String>['name', 'isStudent'],
|
||||
));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -207,18 +248,22 @@ void main() {
|
||||
fail('Expected JsonMapException');
|
||||
} on JsonMapException catch (e) {
|
||||
expect(
|
||||
e.exceptions.map((JsonReadException e) => switch (e) {
|
||||
final InvalidTypeJsonReadException e => e.key,
|
||||
final MissingKeyJsonReadException e => e.key,
|
||||
_ => throw StateError('Unexpected exception type: $e'),
|
||||
}).toList(),
|
||||
containsStringsInOrder(<String>['name', 'age'],
|
||||
));
|
||||
e.exceptions
|
||||
.map((JsonReadException e) => switch (e) {
|
||||
final InvalidTypeJsonReadException e => e.key,
|
||||
final MissingKeyJsonReadException e => e.key,
|
||||
_ => throw StateError('Unexpected exception type: $e'),
|
||||
})
|
||||
.toList(),
|
||||
containsAllInOrder(
|
||||
<String>['name', 'age'],
|
||||
));
|
||||
}
|
||||
});
|
||||
|
||||
test('allows a default with onError', () {
|
||||
final (String name, int age, bool isStudent) = const JsonObject(<String, Object?>{
|
||||
final (String name, int age, bool isStudent) =
|
||||
const JsonObject(<String, Object?>{
|
||||
'name': 'Alice',
|
||||
'age': 42,
|
||||
'isStudent': 'true',
|
||||
@@ -230,11 +275,13 @@ void main() {
|
||||
);
|
||||
}, onError: expectAsync2((_, JsonMapException e) {
|
||||
expect(
|
||||
e.exceptions.map((JsonReadException e) => switch (e) {
|
||||
final InvalidTypeJsonReadException e => e.key,
|
||||
final MissingKeyJsonReadException e => e.key,
|
||||
_ => throw StateError('Unexpected exception type: $e'),
|
||||
}).toList(),
|
||||
e.exceptions
|
||||
.map((JsonReadException e) => switch (e) {
|
||||
final InvalidTypeJsonReadException e => e.key,
|
||||
final MissingKeyJsonReadException e => e.key,
|
||||
_ => throw StateError('Unexpected exception type: $e'),
|
||||
})
|
||||
.toList(),
|
||||
<String>['isStudent'],
|
||||
);
|
||||
return ('Bob', 0, false);
|
||||
@@ -258,7 +305,7 @@ void main() {
|
||||
json.boolean('isStudent'),
|
||||
);
|
||||
});
|
||||
}, throwsA(isInstanceOf<ArgumentError>()));
|
||||
}, throwsA(const isInstanceOf<ArgumentError>()));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,11 +8,11 @@ import 'dart:io' as io;
|
||||
import 'package:engine_repo_tools/engine_repo_tools.dart';
|
||||
import 'package:engine_tool/src/environment.dart';
|
||||
import 'package:engine_tool/src/logger.dart';
|
||||
import 'package:litetest/litetest.dart' show Expect, Matcher;
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:platform/platform.dart';
|
||||
import 'package:process_fakes/process_fakes.dart';
|
||||
import 'package:process_runner/process_runner.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
/// Each CannedProcess has a command matcher and the result of an executed
|
||||
/// process. The matcher is used to determine when to use a registered
|
||||
@@ -211,48 +211,18 @@ io.ProcessResult _getCannedProcessResult(
|
||||
return io.ProcessResult(0, 0, '', '');
|
||||
}
|
||||
|
||||
typedef CommandMatcher = bool Function(List<String> command);
|
||||
Matcher containsCommand(bool Function(List<String> command) matcher) {
|
||||
return predicate((List<ExecutedProcess> history) {
|
||||
return history.any((ExecutedProcess process) {
|
||||
return matcher(process.command);
|
||||
});
|
||||
}, 'contains command');
|
||||
}
|
||||
|
||||
/// Returns a [Matcher] that fails the test if no process has a matching command.
|
||||
///
|
||||
/// Usage:
|
||||
/// expect(testEnv.processHistory,
|
||||
/// containsCommand((List<String> command) {
|
||||
/// return command.length > 5 &&
|
||||
/// command[0].contains('ninja') &&
|
||||
/// command[2].endsWith('/host_debug') &&
|
||||
/// command[5] == 'flutter/fml:fml_arc_unittests';
|
||||
/// })
|
||||
/// );
|
||||
Matcher containsCommand(CommandMatcher commandMatcher) => (dynamic processes) {
|
||||
Expect.type<List<ExecutedProcess>>(processes);
|
||||
final List<List<String>> commands = (processes as List<ExecutedProcess>)
|
||||
.map((ExecutedProcess process) => process.command)
|
||||
.toList();
|
||||
if (!commands.any(commandMatcher)) {
|
||||
Expect.fail('No process found with matching command');
|
||||
}
|
||||
};
|
||||
|
||||
/// Returns a [Matcher] that fails the test if any process has a matching
|
||||
/// command.
|
||||
///
|
||||
/// Usage:
|
||||
/// expect(testEnv.processHistory,
|
||||
/// doesNotContainCommand((List<String> command) {
|
||||
/// return command.length > 5 &&
|
||||
/// command[0].contains('ninja') &&
|
||||
/// command[2].endsWith('/host_debug') &&
|
||||
/// command[5] == 'flutter/fml:fml_arc_unittests';
|
||||
/// })
|
||||
/// );
|
||||
Matcher doesNotContainCommand(CommandMatcher commandMatcher) =>
|
||||
(dynamic processes) {
|
||||
Expect.type<List<ExecutedProcess>>(processes);
|
||||
final List<List<String>> commands = (processes as List<ExecutedProcess>)
|
||||
.map((ExecutedProcess process) => process.command)
|
||||
.toList();
|
||||
if (commands.any(commandMatcher)) {
|
||||
Expect.fail('Process found with matching command');
|
||||
}
|
||||
};
|
||||
Matcher doesNotContainCommand(bool Function(List<String> command) matcher) {
|
||||
return predicate((List<ExecutedProcess> history) {
|
||||
return !history.any((ExecutedProcess process) {
|
||||
return matcher(process.command);
|
||||
});
|
||||
}, 'does not contain command');
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'utils.dart';
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@ import 'package:engine_repo_tools/engine_repo_tools.dart';
|
||||
import 'package:engine_tool/src/environment.dart';
|
||||
import 'package:engine_tool/src/logger.dart';
|
||||
import 'package:engine_tool/src/worker_pool.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:platform/platform.dart';
|
||||
import 'package:process_fakes/process_fakes.dart';
|
||||
import 'package:process_runner/process_runner.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
class TestWorkerPoolProgressReporter implements WorkerPoolProgressReporter {
|
||||
int _successCount = 0;
|
||||
|
||||
@@ -19,7 +19,4 @@ dependencies:
|
||||
path: any
|
||||
|
||||
dev_dependencies:
|
||||
async_helper: any
|
||||
expect: any
|
||||
litetest: any
|
||||
smith: any
|
||||
test: any
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import 'dart:io' as io;
|
||||
|
||||
import 'package:githooks/githooks.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
test('Fails gracefully without a command', () async {
|
||||
|
||||
@@ -21,4 +21,4 @@ dependencies:
|
||||
path: any
|
||||
|
||||
dev_dependencies:
|
||||
litetest: any
|
||||
test: any
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:licenses/formatter.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
test('Block comments', () {
|
||||
|
||||
@@ -23,9 +23,6 @@ dependencies:
|
||||
yaml: any
|
||||
|
||||
dev_dependencies:
|
||||
async_helper: any
|
||||
expect: any
|
||||
litetest: any
|
||||
process_fakes: any
|
||||
smith: any
|
||||
source_span: any
|
||||
test: any
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:engine_build_configs/src/build_config.dart';
|
||||
import 'package:engine_build_configs/src/build_config_loader.dart';
|
||||
import 'package:file/file.dart';
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'fixtures.dart' as fixtures;
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ import 'dart:io' as io;
|
||||
import 'package:engine_build_configs/src/build_config.dart';
|
||||
import 'package:engine_build_configs/src/build_config_runner.dart';
|
||||
import 'package:engine_repo_tools/engine_repo_tools.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:platform/platform.dart';
|
||||
import 'package:process_fakes/process_fakes.dart';
|
||||
import 'package:process_runner/process_runner.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'fixtures.dart' as fixtures;
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
import 'dart:convert' as convert;
|
||||
|
||||
import 'package:engine_build_configs/src/build_config.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:platform/platform.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'fixtures.dart' as fixtures;
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ import 'dart:io' as io;
|
||||
|
||||
import 'package:engine_build_configs/src/ci_yaml.dart';
|
||||
import 'package:engine_repo_tools/engine_repo_tools.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:source_span/source_span.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:yaml/yaml.dart' as y;
|
||||
|
||||
void main() {
|
||||
|
||||
@@ -17,7 +17,4 @@ dependencies:
|
||||
path: any
|
||||
|
||||
dev_dependencies:
|
||||
async_helper: any
|
||||
expect: any
|
||||
litetest: any
|
||||
smith: any
|
||||
test: any
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:io' as io;
|
||||
import 'package:async_helper/async_helper.dart';
|
||||
|
||||
import 'package:engine_repo_tools/engine_repo_tools.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
late io.Directory emptyDir;
|
||||
@@ -25,9 +25,9 @@ void main() {
|
||||
setUp();
|
||||
try {
|
||||
expect(
|
||||
() => Engine.fromSrcPath(emptyDir.path),
|
||||
_throwsInvalidEngineException,
|
||||
);
|
||||
() => Engine.fromSrcPath(emptyDir.path),
|
||||
throwsA(const TypeMatcher<InvalidEngineException>()),
|
||||
);
|
||||
} finally {
|
||||
tearDown();
|
||||
}
|
||||
@@ -38,7 +38,7 @@ void main() {
|
||||
try {
|
||||
expect(
|
||||
() => Engine.fromSrcPath(p.join(emptyDir.path, 'src')),
|
||||
_throwsInvalidEngineException,
|
||||
throwsA(const TypeMatcher<InvalidEngineException>()),
|
||||
);
|
||||
} finally {
|
||||
tearDown();
|
||||
@@ -51,7 +51,7 @@ void main() {
|
||||
final io.Directory srcDir = io.Directory(p.join(emptyDir.path, 'src'))..createSync();
|
||||
expect(
|
||||
() => Engine.fromSrcPath(srcDir.path),
|
||||
_throwsInvalidEngineException,
|
||||
throwsA(const TypeMatcher<InvalidEngineException>()),
|
||||
);
|
||||
} finally {
|
||||
tearDown();
|
||||
@@ -241,33 +241,3 @@ void main() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// This is needed because async_minitest and friends is not a proper testing
|
||||
// library and is missing a lot of functionality that was exclusively added
|
||||
// to pkg/test.
|
||||
void _throwsInvalidEngineException(Object? o) {
|
||||
_checkThrow<InvalidEngineException>(o, (_){});
|
||||
}
|
||||
|
||||
// Mostly copied from async_minitest.
|
||||
void _checkThrow<T extends Object>(dynamic v, void Function(dynamic error) onError) {
|
||||
if (v is Future) {
|
||||
asyncStart();
|
||||
v.then((_) {
|
||||
Expect.fail('Did not throw');
|
||||
}, onError: (Object e, StackTrace s) {
|
||||
if (e is! T) {
|
||||
// ignore: only_throw_errors
|
||||
throw e;
|
||||
}
|
||||
onError(e);
|
||||
asyncEnd();
|
||||
});
|
||||
return;
|
||||
}
|
||||
v as void Function();
|
||||
Expect.throws<T>(v, (T e) {
|
||||
onError(e);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -19,8 +19,5 @@ dependencies:
|
||||
process_runner: any
|
||||
|
||||
dev_dependencies:
|
||||
async_helper: any
|
||||
expect: any
|
||||
litetest: any
|
||||
process_fakes: any
|
||||
smith: any
|
||||
test: any
|
||||
|
||||
@@ -5,13 +5,12 @@
|
||||
import 'dart:io' as io;
|
||||
|
||||
import 'package:git_repo_tools/git_repo_tools.dart';
|
||||
import 'package:litetest/litetest.dart';
|
||||
import 'package:process_fakes/process_fakes.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
const String fakeShaHash = 'fake-sha-hash';
|
||||
|
||||
|
||||
test('returns non-deleted files which differ from merge-base with main', () async {
|
||||
final Fixture fixture = Fixture(
|
||||
processManager: FakeProcessManager(
|
||||
|
||||
Reference in New Issue
Block a user