-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added hook and list integration tests
- Loading branch information
Showing
4 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
source scripts/shArg.sh | ||
|
||
declare MESSAGE | ||
|
||
messageHook() { | ||
local message=$1 | ||
|
||
echo "message hooked invoked with $message" | ||
echo "Global variable is still available $MESSAGE" | ||
} | ||
|
||
# register arguments | ||
shArgs.arg "MESSAGE" -m --message PARAMETER true messageHook | ||
|
||
# parse inputs | ||
shArgs.parse $@ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
source scripts/shArg.sh | ||
|
||
declare IPS | ||
shArgs.arg "IPS" -i --ips PARAMETER true | ||
shArgs.parse $@ | ||
|
||
for ip in $IPS | ||
do | ||
echo "ip: $ip" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Describe 'shArg' | ||
Include spec/integration/harness/runner.sh | ||
|
||
Context "Simple Script Tests" | ||
It 'should parse a csv parameter' | ||
When call run_file "spec/integration/harness/hook.sh" "-m great123" | ||
The output should equal "message hooked invoked with great123 Global variable is still available great123" | ||
End | ||
|
||
End | ||
End |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Describe 'shArg' | ||
Include spec/integration/harness/runner.sh | ||
|
||
Context "Simple Script Tests" | ||
It 'should parse a csv parameter' | ||
When call run_file "spec/integration/harness/list.sh" "-i 123,456" | ||
The output should equal "ip: 123 ip: 456" | ||
End | ||
|
||
It 'should parse a space delimited parameter' | ||
When call run_file "spec/integration/harness/list.sh" "-i 888 777" | ||
The output should equal "ip: 888 ip: 777" | ||
End | ||
|
||
End | ||
End |