Skip to content

Commit ea2ebbc

Browse files
committed
Deprecate Dependency.matchesAny in favor of VersionRange
1 parent f358dbf commit ea2ebbc

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

source/dub/dependency.d

+8-7
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ struct Dependency {
427427
428428
This is true in particular for the `any` constant.
429429
*/
430+
deprecated("Use `VersionRange.matchesAny` directly")
430431
bool matchesAny() const scope @safe {
431432
return this.m_value.match!(
432433
(Repository v) => true,
@@ -435,13 +436,6 @@ struct Dependency {
435436
);
436437
}
437438

438-
unittest {
439-
assert(Dependency("*").matchesAny);
440-
assert(!Dependency(">0.0.0").matchesAny);
441-
assert(!Dependency(">=1.0.0").matchesAny);
442-
assert(!Dependency("<1.0.0").matchesAny);
443-
}
444-
445439
/** Tests if the specification matches a specific version.
446440
*/
447441
bool matches(string vers, VersionMatchMode mode = VersionMatchMode.standard) const @safe
@@ -962,6 +956,13 @@ private struct VersionRange
962956
&& this.m_versB == Version.maxRelease;
963957
}
964958

959+
unittest {
960+
assert(VersionRange.fromString("*").matchesAny);
961+
assert(!VersionRange.fromString(">0.0.0").matchesAny);
962+
assert(!VersionRange.fromString(">=1.0.0").matchesAny);
963+
assert(!VersionRange.fromString("<1.0.0").matchesAny);
964+
}
965+
965966
public static VersionRange fromString (string ves) @safe
966967
{
967968
static import std.string;

0 commit comments

Comments
 (0)