Add default arg to info question type
This commit is contained in:
@@ -12,6 +12,17 @@ Describe 'convertQuestionArgsToAskUserArgs'
|
||||
The status should be success
|
||||
End
|
||||
|
||||
It 'converts info with default arg to info with default arg'
|
||||
args=()
|
||||
choices=()
|
||||
questionArgs='info;default:Mario Kart'
|
||||
When call convertQuestionArgsToAskUserArgs
|
||||
The output should eq ''
|
||||
The variable args should eq '-d Mario Kart info'
|
||||
The variable choices should eq ''
|
||||
The status should be success
|
||||
End
|
||||
|
||||
It 'converts password to -p info'
|
||||
args=() choices=() questionArgs='password'
|
||||
When call convertQuestionArgsToAskUserArgs
|
||||
|
||||
40
spec/findQuestionArgInInstruction_spec.sh
Normal file
40
spec/findQuestionArgInInstruction_spec.sh
Normal file
@@ -0,0 +1,40 @@
|
||||
Describe 'findQuestionArgInInstruction'
|
||||
Include ./install.sh
|
||||
instructions=('somearg:somevalue' 'default:one' 'choose from:blue,light green,red')
|
||||
|
||||
It 'finds nothing if no arg name given'
|
||||
argValue=''
|
||||
When call findQuestionArgInInstruction
|
||||
The variable argValue should eq ''
|
||||
The status should be success
|
||||
End
|
||||
|
||||
It 'finds nothing if arg name does not exist'
|
||||
argValue=''
|
||||
When call findQuestionArgInInstruction 'arg name that does not exist'
|
||||
The variable argValue should eq ''
|
||||
The status should be failure
|
||||
End
|
||||
|
||||
It 'finds nothing if instructions is empty'
|
||||
instructions=()
|
||||
argValue=''
|
||||
When call findQuestionArgInInstruction 'some arg name'
|
||||
The variable argValue should eq ''
|
||||
The status should be failure
|
||||
End
|
||||
|
||||
It 'finds arg value if instructions contains arg as first item'
|
||||
argValue=''
|
||||
When call findQuestionArgInInstruction 'somearg'
|
||||
The variable argValue should eq 'somevalue'
|
||||
The status should be success
|
||||
End
|
||||
|
||||
It 'finds arg value if instructions contains arg among other items'
|
||||
argValue=''
|
||||
When call findQuestionArgInInstruction 'choose from'
|
||||
The variable argValue should eq 'blue,light green,red'
|
||||
The status should be success
|
||||
End
|
||||
End
|
||||
Reference in New Issue
Block a user