Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.

Commit 9ed1f38

Browse files
committed
Create test for fix
1 parent 28e9a4f commit 9ed1f38

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

test_commands.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,26 @@ test_command_rise_error() {
180180
report "${msg}"
181181
}
182182

183+
test_of_command_output_contains_expected_str() {
184+
test_name="$1"
185+
command="$2"
186+
expected_str="$3"
187+
msg=""
188+
echo "Start: $test_name"
189+
output=$($command 2>&1)
190+
exit_code=$?
191+
if [[ $output =~ $expected_str ]]; then
192+
test_result=0
193+
msg="$test_name"
194+
else
195+
echo "$output"
196+
test_result=1
197+
overall_test_result=1
198+
msg="$test_name: $command"
199+
fi
200+
report "${msg}"
201+
}
202+
183203
clean() {
184204
file=$1
185205
if [ "$_arg_verbose" = "on" ]; then
@@ -222,6 +242,11 @@ hide_all_passing_tests_test() {
222242
test_command run-json-to-graph "json-to-graph -o ${tmp_dir_src} ${tmp_json_file_src} --hide-passing-tests -i fips"
223243
}
224244

245+
test_of_reference_to_right_binary_in_help() {
246+
test_of_command_output_contains_expected_str expect_right_reference_in_help "arf-to-graph -h" "arf-to-graph"
247+
test_of_command_output_contains_expected_str expect_right_reference_in_help "arf-to-json -h" "arf-to-json"
248+
test_of_command_output_contains_expected_str expect_right_reference_in_help "json-to-graph -h" "json-to-graph"
249+
}
225250

226251
# Backup descriptors stdout -> 3, stderr -> 4
227252
exec 3>&1 4>&2
@@ -241,6 +266,7 @@ basic_test
241266
regex_and_all_test
242267
regex_and_all_in_one_test
243268
hide_all_passing_tests_test
269+
test_of_reference_to_right_binary_in_help
244270

245271
if [ "$_arg_clean" = "on" ]; then
246272
clean "${tmp_dir_src}"

0 commit comments

Comments
 (0)