Add unit tests for VersionRange (#40114)

* Add unit tests for VersionRange

Make it easier to understand the intended semantics next time I have to
read this code.

* I miss prettier
This commit is contained in:
Nathan Shively-Sanders authored and GitHub committed 2020-08-18 13:06:17 -07:00
1 parent dbab46c363
commit 6fea7ff536
2 files changed
+26 -3

No files matched your search

+3 -3
View File
@@ -84,7 +84,7 @@ namespace ts {
return compareValues(this.major, other.major)
|| compareValues(this.minor, other.minor)
|| compareValues(this.patch, other.patch)
|| comparePrerelaseIdentifiers(this.prerelease, other.prerelease);
|| comparePrereleaseIdentifiers(this.prerelease, other.prerelease);
}
increment(field: "major" | "minor" | "patch") {
@@ -120,7 +120,7 @@ namespace ts {
};
}
function comparePrerelaseIdentifiers(left: readonly string[], right: readonly string[]) {
function comparePrereleaseIdentifiers(left: readonly string[], right: readonly string[]) {
// https://semver.org/#spec-item-11
// > When major, minor, and patch are equal, a pre-release version has lower precedence
// > than a normal version.
@@ -388,4 +388,4 @@ namespace ts {
function formatComparator(comparator: Comparator) {
return `${comparator.operator}${comparator.operand}`;
}
}
}