Skip to content

Commit

Permalink
test: * and ? semantics
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Jerphanion <[email protected]>
  • Loading branch information
jjerphan committed Jan 9, 2025
1 parent 14dd594 commit b8104d2
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions libmamba/tests/src/specs/test_regex_spec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,32 @@ namespace
auto spec = RegexSpec::parse("^py3.10_cuda11.8*$").value();
REQUIRE(spec.contains("py3.10_cuda11.8_cudnn8.7.0_0"));
}

TEST_CASE("RegexSpec * semantic")
{
auto spec = RegexSpec::parse("py3.*").value();

REQUIRE(spec.contains("py3."));
REQUIRE(spec.contains("py3.10"));
REQUIRE(spec.contains("py3.10_cuda11.8_cudnn8.7.0_0"));

REQUIRE_FALSE(spec.contains("py3"));
REQUIRE_FALSE(spec.contains("py310"));
}

TEST_CASE("RegexSpec ? semantic")
{
auto spec = RegexSpec::parse("py3.?").value();

REQUIRE(spec.contains("py3."));
REQUIRE(spec.contains("py3.1"));
REQUIRE(spec.contains("py3.0"));
REQUIRE(spec.contains("py3.?"));
REQUIRE(spec.contains("py3.."));

REQUIRE_FALSE(spec.contains("py3.10"));
REQUIRE_FALSE(spec.contains("py3"));
REQUIRE_FALSE(spec.contains("py310"));
}

}

0 comments on commit b8104d2

Please sign in to comment.