Expand description
SPDX-License-Identifier: Apache-2.0 Copyright 2025 canardleteer
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
This crate generally provides out of the box proptest implementations for
doing Property Testing of Semantic Version values with the semver crate.
The Regex from the spec is available here: https://semver.org/, and where most of these come from.
Enums§
- Comparator
Op ComparatorOpis just a re-implementation of semver::Op.- Comparator
Vec - ComparatorVec captures the odd case that your semver::VersionReq, can basically only be one of two things.
- Full
Comparator - Describes various types of semver::Comparator as String.
Constants§
- ALWAYS_
BUILD_ METADATA_ REGEX - Regex to build a Build Metadata string, always, without the prefix
+. - ALWAYS_
PRERELEASE_ REGEX - Regex to build a Pre-Release string, always, without the
-. - ANY_
MAJOR_ MINOR_ PATH_ COMPONENT - Regex for any single Major, Minor, Patch component.
- MAJOR_
MINOR_ PATCH_ REGEX - Regex for the “Major.Minor.Patch” component of SemVer.
- MAX_
COMPARATORS_ IN_ VERSION_ REQ_ STRING - Describes the a hard limit set in semver::VersionReq (
32). This limit isn’t exposed, so we re-encode it here, and then we test that it’s the right version. - SEMVER_
REGEX - Regex for Semantic Version 2.0.0, directly from the spec, with 2 changes:
- SOMETIMES_
BUILD_ METADATA_ REGEX - Regex to build a Build Metadata string, sometimes, with the prefix
+. - SOMETIMES_
PRERELEASE_ REGEX - Regex to build a Pre-Release string, sometimes, with the prefix
-.
Functions§
- arb_
build_ metadata_ string - Arbitrary Build Metadata String (no
+prefix) - arb_
comparator_ list - Provides a valid Vec<semver::Comparator> that can be fed to
[semver:VersionReq::parse] after being run through
.join(',') - arb_
comparator_ string - Creates a
Stringthat can be parsed as a valid semver::Comparator when building a semver::VersionReq. - arb_
full_ comparator - Provides some kind of semver::Comparator “thing”, sidestepping the FullComparator::Wildcard case.
- arb_
full_ comparator_ vec - Provides a weighted list of ComparatorVec, for use in arb_version_req, but you may want to use it for your own means.
- arb_
option_ build_ metadata_ string - Arbitrary Optional Build Metadata String (no
+prefix) - arb_
option_ pre_ release_ string - Arbitrary Optional Pre-Release String (no
-prefix) - arb_
option_ semver_ build_ metadata - arb_
option_ semver_ prerelease - arb_
optional_ semver_ version_ req - arb_
optional_ version_ req - Creates an Option<semver::VersionReq> of some maximum number of
Comparators. - arb_
pre_ release_ string - Arbitrary Pre-Release String (no
-prefix) - arb_
semver - Arbitrary Semantic Versioning 2.0.0 String.
- arb_
semver_ build_ metadata - arb_
semver_ comparator - arb_
semver_ op - Implement a generic strategy around
semver:Op. - arb_
semver_ prerelease - arb_
semver_ version - Creates a valid semver::Version via the struct itself.
- arb_
semver_ version_ req - arb_
semver_ version_ weighted - Creates a valid semver::Version via the struct itself.
- arb_
vec_ comparator_ string - Creates a
Vec<String>that can be parsed as a valid semver::Comparator’s when building a semver::VersionReq. - arb_
vec_ semver_ comparator - arb_
vec_ semver_ versions - Creates a list of semver::Version, with some specified length.
- arb_
vec_ versions - Creates a list of semver::Version, with some specified length.
- arb_
version - Creates a valid semver::Version via
String. - arb_
version_ req - Creates a semver::VersionReq of some maximum number of
Comparators. - arb_
version_ weighted - Creates a semver::Version from a String based on explicit weighting of Pre-Release & Build Metadata probability.