7516af7237
This gives us a way to specify that a test is only meaningful for certain NNBD modes and should be skipped on other configurations. My hope is we can extend this for other platform capabilities and then eventually use this to express "skips" instead of relying on status files for them. Change-Id: I99548c326ee6fbe6db64e28e7f7f07d2fc1fd23c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117080 Commit-Queue: Bob Nystrom <rnystrom@google.com> Reviewed-by: Mayank Patke <fishythefish@google.com>
36 lines
1.4 KiB
Dart
36 lines
1.4 KiB
Dart
// Copyright (c) 2019, 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_runner/src/configuration.dart';
|
|
import 'package:test_runner/src/options.dart';
|
|
import 'package:test_runner/src/path.dart';
|
|
import 'package:test_runner/src/test_file.dart';
|
|
import 'package:test_runner/src/test_suite.dart';
|
|
|
|
final Path _suiteDirectory = Path("language_2");
|
|
|
|
TestFile parseTestFile(String source, {String path = "some_test.dart"}) {
|
|
path = _suiteDirectory.absolute.append(path).toNativePath();
|
|
return TestFile.parse(_suiteDirectory.absolute, path, source);
|
|
}
|
|
|
|
// TODO(rnystrom): Would be nice if there was a simpler way to create a
|
|
// configuration for use in unit tests.
|
|
TestConfiguration makeConfiguration(List<String> arguments) =>
|
|
OptionsParser().parse([...arguments, "language_2"]).first;
|
|
|
|
/// Creates a [StandardTestSuite] hardcoded to contain [testFiles].
|
|
StandardTestSuite makeTestSuite(
|
|
TestConfiguration configuration, List<TestFile> testFiles) =>
|
|
_MockTestSuite(configuration, testFiles);
|
|
|
|
class _MockTestSuite extends StandardTestSuite {
|
|
final List<TestFile> _testFiles;
|
|
|
|
_MockTestSuite(TestConfiguration configuration, this._testFiles)
|
|
: super(configuration, "language_2", _suiteDirectory, []);
|
|
|
|
@override
|
|
Iterable<TestFile> findTests() => _testFiles;
|
|
}
|