Skip to content

Commit

Permalink
Unit tests mock of LIB_FUNC_STRINGCONTAIN - SC2295 Expansions inside …
Browse files Browse the repository at this point in the history
…${..} need to be quoted separately (#156)
  • Loading branch information
PeterPitterling authored May 25, 2024
1 parent b7c703f commit 279d43f
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 8 deletions.
4 changes: 1 addition & 3 deletions scripts/tests/check/1260_cpu_smthreading_ibmpower_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ readonly PROGRAM_DIR
#mock PREREQUISITE functions
LIB_FUNC_IS_IBMPOWER() { return 0 ; }

LIB_FUNC_STRINGCONTAIN() {
[[ -z "${1##*"$2"*}" ]] && [[ -z "$2" || -n "$1" ]];
}
LIB_FUNC_STRINGCONTAIN() { [[ -z "${1##*"$2"*}" ]] && [[ -z "$2" || -n "$1" ]]; }

# still to mock for tests
# LIB_PLATF_CPU_SOCKETS=
Expand Down
2 changes: 1 addition & 1 deletion scripts/tests/check/4150_pmem_xfs_mountoption_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PROGRAM_DIR="$( cd "${BASH_SOURCE[0]%/*}" && pwd )"
readonly PROGRAM_DIR

#mock PREREQUISITE functions
LIB_FUNC_STRINGCONTAIN() { [[ -z "${1##*$2*}" ]] && [[ -z "$2" || -n "$1" ]]; }
LIB_FUNC_STRINGCONTAIN() { [[ -z "${1##*"$2"*}" ]] && [[ -z "$2" || -n "$1" ]]; }

grep() {

Expand Down
2 changes: 1 addition & 1 deletion scripts/tests/check/5010_io_scheduler_blockdevices_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ LIB_FUNC_IS_VIRT_XEN() { return 1 ; }
LIB_FUNC_IS_SLES() { return 0 ; }
LIB_FUNC_IS_RHEL() { return 1 ; }

LIB_FUNC_STRINGCONTAIN() { [[ -z "${1##*$2*}" ]] && [[ -z "$2" || -n "$1" ]]; }
LIB_FUNC_STRINGCONTAIN() { [[ -z "${1##*"$2"*}" ]] && [[ -z "$2" || -n "$1" ]]; }

# still to mock for tests
# grep '/sys/block/sd*/queue/scheduler'
Expand Down
2 changes: 1 addition & 1 deletion scripts/tests/check/5521_nfs_mount_rwsize_azure_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ readonly PROGRAM_DIR

#mock PREREQUISITE functions
LIB_FUNC_IS_CLOUD_MICROSOFT() { return 0 ; }
LIB_FUNC_STRINGCONTAIN() { [[ -z "${1##*$2*}" ]] && [[ -z "$2" || -n "$1" ]]; }
LIB_FUNC_STRINGCONTAIN() { [[ -z "${1##*"$2"*}" ]] && [[ -z "$2" || -n "$1" ]]; }

grep() {

Expand Down
2 changes: 1 addition & 1 deletion scripts/tests/check/5522_nfs_mount_rwsize_amazon_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ readonly PROGRAM_DIR

#mock PREREQUISITE functions
LIB_FUNC_IS_CLOUD_AMAZON() { return 0 ; }
LIB_FUNC_STRINGCONTAIN() { [[ -z "${1##*$2*}" ]] && [[ -z "$2" || -n "$1" ]]; }
LIB_FUNC_STRINGCONTAIN() { [[ -z "${1##*"$2"*}" ]] && [[ -z "$2" || -n "$1" ]]; }

grep() {

Expand Down
2 changes: 1 addition & 1 deletion scripts/tests/check/5530_nfs_mount_nconnect_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PROGRAM_DIR="$( cd "${BASH_SOURCE[0]%/*}" && pwd )"
readonly PROGRAM_DIR

#mock PREREQUISITE functions
LIB_FUNC_STRINGCONTAIN() { [[ -z "${1##*$2*}" ]] && [[ -z "$2" || -n "$1" ]]; }
LIB_FUNC_STRINGCONTAIN() { [[ -z "${1##*"$2"*}" ]] && [[ -z "$2" || -n "$1" ]]; }

LIB_FUNC_IS_SLES() { return 1 ; }
LIB_FUNC_IS_RHEL() { return 1 ; }
Expand Down

0 comments on commit 279d43f

Please sign in to comment.