mirror of https://github.com/kdabir/has.git
fix regression created with #15. self verion had stopped working. now added a test for it
This commit is contained in:
parent
ef55e62fd0
commit
10c906e7f8
|
@ -73,3 +73,12 @@ teardown() {
|
|||
[[ "$(echo "${output}" | grep "✔" | grep "git")" ]]
|
||||
[[ "$(echo "${output}" | grep "✔" | grep "bc")" ]]
|
||||
}
|
||||
|
||||
@test "has prints help" {
|
||||
|
||||
run bash has
|
||||
|
||||
[[ "$(echo "${output}" | grep "has")" ]]
|
||||
[[ "$(echo "${output}" | grep "USAGE:")" ]]
|
||||
[[ "$(echo "${output}" | grep "EXAMPLE:")" ]]
|
||||
}
|
||||
|
|
9
has
9
has
|
@ -170,8 +170,8 @@ if [ -s "${RC_FILE}" ]; then
|
|||
HASRC="true"
|
||||
fi
|
||||
|
||||
# if no arguments passed to script
|
||||
if [[ "${HASRC}" -ne "true" ]] && [ "$#" -eq 0 ]; then
|
||||
# if HASRC is not set AND no arguments passed to script
|
||||
if [[ -z "${HASRC}" ]] && [ "$#" -eq 0 ]; then
|
||||
# print help
|
||||
BINARY_NAME="has"
|
||||
VERSION="v1.3.0"
|
||||
|
@ -188,9 +188,10 @@ else
|
|||
## display found / total
|
||||
# echo ${OK} / $(($OK+$KO))
|
||||
|
||||
if [[ "${HASRC}" == "true" ]]; then
|
||||
## if HASRC has been set
|
||||
if [[ -n "${HASRC}" ]]; then
|
||||
## for all
|
||||
for line in $(cat ".hasrc" | egrep -v "^\s*(#|$)" ); do
|
||||
for line in $(cat "${RC_FILE}" | egrep -v "^\s*(#|$)" ); do
|
||||
__detect "$line"
|
||||
done
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue