From 720fd172004c9f29045eb2ad19f35eba47ae31c7 Mon Sep 17 00:00:00 2001 From: Edwin Kofler Date: Tue, 24 Jan 2023 05:15:23 -0800 Subject: [PATCH] chore: Fix ShellCheck errors in tests (#1451) --- test/asdf_elvish.bats | 85 ++++++++++++++++++++++--------------------- test/asdf_fish.bats | 57 +++++++++++++++-------------- test/asdf_nu.bats | 69 ++++++++++++++++++----------------- test/asdf_sh.bats | 40 +++++++++----------- 4 files changed, 127 insertions(+), 124 deletions(-) diff --git a/test/asdf_elvish.bats b/test/asdf_elvish.bats index 25a386ae..bb0f4d2c 100644 --- a/test/asdf_elvish.bats +++ b/test/asdf_elvish.bats @@ -22,96 +22,97 @@ cleaned_path() { } @test "exports ASDF_DIR" { - output=$(elvish -norc -c " + run elvish -norc -c " unset-env ASDF_DIR set paths = [$(cleaned_path)] use ./asdf _asdf; var asdf~ = \$_asdf:asdf~ - echo \$E:ASDF_DIR - ") - [ "$?" -eq 0 ] + echo \$E:ASDF_DIR" + + [ "$status" -eq 0 ] [ "$output" = "$HOME/.asdf" ] } @test "retains ASDF_DIR" { - output=$(elvish -norc -c " - set-env ASDF_DIR "/path/to/asdf" + run elvish -norc -c " + set-env ASDF_DIR \"/path/to/asdf\" set paths = [$(cleaned_path)] use ./asdf _asdf; var asdf~ = \$_asdf:asdf~ - echo \$E:ASDF_DIR - ") - [ "$?" -eq 0 ] + echo \$E:ASDF_DIR" + + [ "$status" -eq 0 ] [ "$output" = "/path/to/asdf" ] } @test "retains ASDF_DATA_DIR" { - output=$(elvish -norc -c " - set-env ASDF_DATA_DIR "/path/to/asdf-data" + run elvish -norc -c " + set-env ASDF_DATA_DIR \"/path/to/asdf-data\" set paths = [$(cleaned_path)] use ./asdf _asdf; var asdf~ = \$_asdf:asdf~ - echo \$E:ASDF_DATA_DIR - ") - [ "$?" -eq 0 ] + echo \$E:ASDF_DATA_DIR" + + [ "$status" -eq 0 ] [ "$output" = "/path/to/asdf-data" ] } @test "adds asdf dirs to PATH" { - result=$(elvish -norc -c " + run elvish -norc -c " unset-env ASDF_DIR set paths = [$(cleaned_path)] use ./asdf _asdf; var asdf~ = \$_asdf:asdf~ - echo \$E:PATH - ") - [ "$?" -eq 0 ] - echo "$result" - output=$(echo "$result" | grep "asdf") - [ "$output" != "" ] + echo \$E:PATH" + + [ "$status" -eq 0 ] + + result=$(echo "$output" | grep "asdf") + [ "$result" != "" ] } @test "defines the _asdf namespace" { - output=$(elvish -norc -c " + run elvish -norc -c " unset-env ASDF_DIR set paths = [$(cleaned_path)] use ./asdf _asdf; var asdf~ = \$_asdf:asdf~ - pprint \$_asdf: - ") - [ "$?" -eq 0 ] + pprint \$_asdf:" + + [ "$status" -eq 0 ] [[ "$output" =~ "