#!/usr/bin/env bash
# A config with templated versions and no snapshot keeps every installation of those
# tools and prunes everything else, rather than failing.
export MISE_EXPERIMENTAL=1
export MISE_INSTALL_LAYOUT=identity

mkdir -p project/child elsewhere
echo '[vars]
v = "1.0.0"' >project/mise.toml
echo '[tools]
dummy = "{{vars.v}}"
tiny = "2.0.0"' >project/child/mise.toml
assert "mise -C project/child install"
assert "mise install dummy@3.0.0 tiny@3.0.0"
rm -rf "$MISE_DATA_DIR/installs/.mise/snapshots"

assert "mise -C elsewhere ls --prunable --json >prunable.json"
assert "jq -e 'has(\"dummy\") | not' prunable.json"
assert "jq -e '[.tiny[].version] == [\"3.0.0\"]' prunable.json"
