2
# shellcheck disable=SC2164
7
cd "$(dirname "$BATS_TEST_DIRNAME")"
9
if ! command -v pwsh &>/dev/null && [ -z "$GITHUB_ACTIONS" ]; then
10
skip "Powershell Core is not installed"
15
echo "$PATH" | tr ':' '\n' | grep -v "asdf" | tr '\n' ':'
18
@test "exports ASDF_DIR" {
20
function asdf() {} # checkstyle-ignore
21
Remove-item Function:asdf
23
\$Env:ASDF_DATA_DIR = ''
24
\$Env:PATH = \"$(cleaned_path)\"
27
Write-Output \"\$env:ASDF_DIR\""
33
@test "adds asdf dirs to PATH" {
35
function asdf() {} # checkstyle-ignore
36
Remove-item Function:asdf
38
\$Env:ASDF_DATA_DIR = ''
39
\$Env:PATH = \"$(cleaned_path)\"
42
Write-Output \$Env:PATH"
45
result=$(echo "$output" | grep "asdf")
49
@test "does not add paths to PATH more than once" {
51
function asdf() {} # checkstyle-ignore
52
Remove-item Function:asdf
54
\$Env:ASDF_DATA_DIR = ''
55
\$Env:PATH = \"$(cleaned_path)\"
59
Write-Output \$Env:PATH"
63
result=$(echo "$output" | tr ' ' '\n' | grep "asdf" | sort | uniq -d)
67
@test "defines the asdf function" {
69
function asdf() {} # checkstyle-ignore
70
Remove-item Function:asdf
72
\$Env:ASDF_DATA_DIR = ''
73
\$Env:PATH = \"$(cleaned_path)\"
76
\$(Get-Command -CommandType asdf).Name"
79
[[ "$output" =~ "asdf" ]]
82
@test "function calls asdf command" {
84
function asdf() {} # checkstyle-ignore
85
Remove-item Function:asdf
87
\$Env:ASDF_DATA_DIR = ''
88
\$Env:PATH = \"$(cleaned_path)\"
94
result=$(echo "$output" | grep "ASDF INSTALLED PLUGINS:")