mirror of
https://github.com/kvz/bash3boilerplate.git
synced 2024-12-18 22:27:51 +00:00
Add test for longopt parsing
This commit is contained in:
parent
df3d535ab1
commit
56721e9cd5
5
main.sh
5
main.sh
@ -217,6 +217,11 @@ else
|
||||
info "You are on Linux"
|
||||
fi
|
||||
|
||||
info "arg_f: ${arg_f}"
|
||||
info "arg_d: ${arg_d}"
|
||||
info "arg_v: ${arg_v}"
|
||||
info "arg_h: ${arg_h}"
|
||||
|
||||
debug "Info useful to developers for debugging the application, not useful during operations."
|
||||
info "Normal operational messages - may be harvested for reporting, measuring throughput, etc. - no action required."
|
||||
notice "Events that are unusual but not error conditions - might be summarized in an email to developers or admins to spot potential problems - no immediate action required."
|
||||
|
1
test/fixture/longopt.exitcode
Normal file
1
test/fixture/longopt.exitcode
Normal file
@ -0,0 +1 @@
|
||||
0
|
4
test/fixture/longopt.stdio
Normal file
4
test/fixture/longopt.stdio
Normal file
@ -0,0 +1,4 @@
|
||||
B3BP:STDIO_REPLACE_DATETIMES
|
||||
{datetime} UTC [32m[ info][0m arg_f: {tmpdir}/x
|
||||
{datetime} UTC [32m[ info][0m arg_f: {tmpdir}/x
|
||||
{datetime} UTC [32m[ info][0m arg_f: {tmpdir}/x
|
17
test/scenario/longopt/run.sh
Normal file
17
test/scenario/longopt/run.sh
Normal file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# set -o pipefail
|
||||
# set -o errexit
|
||||
set -o nounset
|
||||
# set -o xtrace
|
||||
|
||||
# Set magic variables for current FILE & DIR
|
||||
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
|
||||
__base="$(basename ${__file} .sh)"
|
||||
__root="$(cd "$(dirname $(dirname $(dirname "${__dir}")))" && pwd)"
|
||||
|
||||
echo "B3BP:STDIO_REPLACE_DATETIMES"
|
||||
|
||||
(env LOG_LEVEL=6 bash "${__root}/main.sh" --file /tmp/x;
|
||||
env LOG_LEVEL=6 bash "${__root}/main.sh" --file=/tmp/x;
|
||||
env LOG_LEVEL=6 bash "${__root}/main.sh" -f /tmp/x) 2>&1 |grep arg_f
|
Loading…
Reference in New Issue
Block a user