semver icon indicating copy to clipboard operation
semver copied to clipboard

feature request: from_string accepts incomplete version strings

Open daixtrose opened this issue 4 years ago • 1 comments

The test

TEST_CASE("semver::from_string", "[demo]")
{
    using namespace semver;
    // auto version = semver::from_string("1.0.0"); // SUCCEEDS
    auto version = semver::from_string("1.0"); // FAILS
    REQUIRE(version == "1.0.0"_version);
}

fails with an exception

semver::version::from_string invalid version.

It is quite common to omit the patch version. So the from_string/from_chars function pair should be robust against the omission and add .0.

daixtrose avatar May 30 '21 11:05 daixtrose

1.0 is not technically a valid semver for what it's worth

MHebes avatar Oct 26 '21 14:10 MHebes