#!/usr/bin/env bash

export MISE_LOCKFILE=1

# Create base config
cat >mise.toml <<'EOF'
[tools]
tiny = "1"
EOF

touch mise.lock
assert "mise install tiny@1.0.0"
assert "mise use tiny@1"

# Base tool should be in mise.lock
assert_contains "cat mise.lock" "[[tools.tiny]]"
assert_contains "cat mise.lock" 'version = "1.0.0"'

# Now let's empty out our tools, uninstall everything and confirm we just end up with an empty lockfile
assert "mise uninstall --all"
assert "mise unuse tiny"
assert "mise lock"

# empty lockfile should just have header and tools section
assert "cat mise.lock" "$LOCKFILE_HEADER

[tools]"
