Skip to content

Commit

Permalink
Add non-regression tests
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Jerphanion <[email protected]>
  • Loading branch information
jjerphan committed Jan 22, 2025
1 parent 242adcd commit 0e93a05
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
16 changes: 16 additions & 0 deletions libmamba/tests/src/util/test_url.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,22 @@ namespace
REQUIRE(url.host(URL::Decode::no) != "mamba%f0%9f%86%92%f0%9f%94%ac.org");
}

SECTION("https://conda.anaconda.org/conda-forge/linux-64/x264-1!164.3095-h166bdaf_2.tar.bz2")
{
// Non-regression test for: https://github.com/mamba-org/mamba/issues/3737
// Check that the `!` character is not encoded
const URL url = URL::parse(
"https://conda.anaconda.org/conda-forge/linux-64/x264-1!164.3095-h166bdaf_2.tar.bz2"
)
.value();
REQUIRE(
url.path(URL::Decode::no) == "/conda-forge/linux-64/x264-1!164.3095-h166bdaf_2.tar.bz2"
);
REQUIRE(
url.path(URL::Decode::yes) == "/conda-forge/linux-64/x264-1!164.3095-h166bdaf_2.tar.bz2"
);
}

SECTION("file://C:/Users/wolfv/test/document.json")
{
if (on_win)
Expand Down
13 changes: 13 additions & 0 deletions micromamba/tests/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -1575,3 +1575,16 @@ def test_update_spec_list(tmp_path):
out = helpers.create("-p", env_prefix, "-f", env_spec_file, "--dry-run")

assert update_specs_list in out.replace("\r", "")


def test_non_url_encoding(tmp_path):
# Non-regression test for https://github.com/mamba-org/mamba/issues/3737
env_prefix = tmp_path / "env-non_url_encoding"

out = helpers.create("--dry-run", "--json", "x264>=1!0", "-p", env_prefix)

# Check that the URL of the build of x264 is not encoded.
non_encoded_url_start = "https://conda.anaconda.org/conda-forge/linux-64/x264-1!"

x264_package = next(pkg for pkg in out["actions"]["LINK"] if pkg["name"] == "x264")
assert x264_package["url"].startswith(non_encoded_url_start)

0 comments on commit 0e93a05

Please sign in to comment.