Fixes #4 : Make cmdarg understand '--option=value|-o=value' syntax.
This commit is contained in:
23
tests/test_equals.sh
Normal file
23
tests/test_equals.sh
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source $(dirname ${BASH_SOURCE[0]})/../cmdarg.sh
|
||||||
|
|
||||||
|
function shunittest_test_equals_parsing_shortopt
|
||||||
|
{
|
||||||
|
cmdarg_purge
|
||||||
|
cmdarg 'x:' 'example' 'just an example'
|
||||||
|
set -x
|
||||||
|
cmdarg_parse -x=3
|
||||||
|
set +x
|
||||||
|
[[ ${cmdarg_cfg['example']} -eq 3 ]] || return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function shunittest_test_equals_parsing_longopt
|
||||||
|
{
|
||||||
|
cmdarg_purge
|
||||||
|
cmdarg 'x:' 'example' 'just an example'
|
||||||
|
set -x
|
||||||
|
cmdarg_parse --example=3
|
||||||
|
set +x
|
||||||
|
[[ ${cmdarg_cfg['example']} -eq 3 ]] || return 1
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user