Skip to content

Commit 953059b

Browse files
committed
remove shift in exitIfVariablesNotDeclared, most likely copy&paste error
1 parent 785219b commit 953059b

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

spec/utility/parse-args_spec.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Describe 'parse-arg.sh'
7575
The output should equal "Version: v0.1.0"
7676
End
7777
End
78-
Describe 'errors'
78+
Describe 'errors:'
7979
It 'not enough arguments passed'
8080
declare version
8181
declare params=(version -v '')
@@ -115,7 +115,17 @@ Describe 'parse-arg.sh'
115115
The stderr should include "$(printf "array \033[0;36massociativeParams\033[0m is broken")"
116116
The stderr should include 'The first argument to parse_args_exitIfParameterDefinitionIsNotTriple needs to be a non-associative array containing parameter definitions'
117117
End
118-
It 'fails if variable not defined in scope'
118+
It 'first variable not defined in scope'
119+
declare version
120+
declare params=(
121+
asdf -a ''
122+
version -v ''
123+
)
124+
When run parseArguments params 'example' 'v1.0.0' -v v0.1.0
125+
The status should be failure
126+
The stderr should include "$(printf "you need to \`declare\` (\`local\`) the variable \033[0;36masdf\033[0m")"
127+
End
128+
It 'second variable not defined in scope'
119129
declare version
120130
declare params=(
121131
version -v ''

src/utility/checks.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,6 @@ function exitIfVarsNotAlreadySetBySource() {
306306
}
307307

308308
function exitIfVariablesNotDeclared() {
309-
shift 1 || traceAndDie "could not shift by 1"
310309
for variableName in "$@"; do
311310
if ! declare -p "$variableName" 2>/dev/null | grep -q 'declare --'; then
312311
logError "you need to \`declare\` (\`local\`) the variable \033[0;36m%s\033[0m otherwise we write to the global scope (you can also \`declare\` it in the global scope)" "$variableName"

0 commit comments

Comments
 (0)