Remove extra version info (#2539)
Follow up to https://github.com/dart-lang/test/pull/2538
This is only relevant when using the test runner as a git or path
dependency. In these cases the version will already end in `-WIP` with
our current development practices and in the places where it may come up
the users don't need help understanding where the code is coming from.
diff --git a/pkgs/test_core/lib/src/runner/version.dart b/pkgs/test_core/lib/src/runner/version.dart
index 05054ce..99f1e56 100644
--- a/pkgs/test_core/lib/src/runner/version.dart
+++ b/pkgs/test_core/lib/src/runner/version.dart
@@ -9,10 +9,8 @@
import 'package:path/path.dart' as p;
import 'package:yaml/yaml.dart';
-/// The version number of the test runner, or `null` if it couldn't be loaded.
-///
-/// This is a semantic version, optionally followed by a space and additional
-/// data about its source.
+/// The semantic version number of the test runner, or `null` if it couldn't be
+/// found.
final String? testVersion = _readWorkspaceRef() ?? _readPubspecLock();
String? _readWorkspaceRef() {
@@ -58,36 +56,8 @@
if (packages is! Map) return null;
var package = packages['test'];
if (package is! Map) return null;
-
var source = package['source'];
if (source is! String) return null;
-
- switch (source) {
- case 'hosted':
- var version = package['version'];
- return (version is String) ? version : null;
-
- case 'git':
- var version = package['version'];
- if (version is! String) return null;
- var description = package['description'];
- if (description is! Map) return null;
- var ref = description['resolved-ref'];
- if (ref is! String) return null;
-
- return '$version (${ref.substring(0, 7)})';
-
- case 'path':
- var version = package['version'];
- if (version is! String) return null;
- var description = package['description'];
- if (description is! Map) return null;
- var path = description['path'];
- if (path is! String) return null;
-
- return '$version (from $path)';
-
- default:
- return null;
- }
+ var version = package['version'];
+ return (version is String) ? version : null;
}