@@ -219,3 +219,64 @@ function test_coverage_is_executable_line_returns_false_for_standalone_paren() {
219219 result=$( bashunit::coverage::is_executable_line ' )' 2 && echo " yes" || echo " no" )
220220 assert_equals " no" " $result "
221221}
222+
223+ function test_coverage_is_executable_line_returns_false_for_case_pattern_with_comment() {
224+ local input=' *thing) # Looks for thing at end of text'
225+ local result
226+ result=$( bashunit::coverage::is_executable_line " $input " 2 && echo " yes" || echo " no" )
227+ assert_equals " no" " $result "
228+ }
229+
230+ function test_coverage_is_executable_line_returns_false_for_wildcard_case_with_comment() {
231+ local result
232+ result=$( bashunit::coverage::is_executable_line ' *) # fallback' 2 && echo " yes" || echo " no" )
233+ assert_equals " no" " $result "
234+ }
235+
236+ function test_coverage_is_executable_line_returns_false_for_done_with_file_redirect() {
237+ local result
238+ result=$( bashunit::coverage::is_executable_line ' done < /path/to/file' 2 && echo " yes" || echo " no" )
239+ assert_equals " no" " $result "
240+ }
241+
242+ function test_coverage_is_executable_line_returns_false_for_done_with_herestring() {
243+ local result
244+ result=$( bashunit::coverage::is_executable_line ' done <<<"$var"' 2 && echo " yes" || echo " no" )
245+ assert_equals " no" " $result "
246+ }
247+
248+ function test_coverage_is_executable_line_returns_false_for_done_with_process_sub() {
249+ local result
250+ result=$( bashunit::coverage::is_executable_line ' done < <(some_cmd)' 2 && echo " yes" || echo " no" )
251+ assert_equals " no" " $result "
252+ }
253+
254+ function test_coverage_is_executable_line_returns_false_for_done_with_redirect_and_comment() {
255+ local result
256+ result=$( bashunit::coverage::is_executable_line ' done < "$file" # read input' 2 && echo " yes" || echo " no" )
257+ assert_equals " no" " $result "
258+ }
259+
260+ function test_coverage_is_executable_line_returns_false_for_done_with_pipe() {
261+ local result
262+ result=$( bashunit::coverage::is_executable_line ' done | sort' 2 && echo " yes" || echo " no" )
263+ assert_equals " no" " $result "
264+ }
265+
266+ function test_coverage_is_executable_line_returns_false_for_done_with_fd_redirect() {
267+ local result
268+ result=$( bashunit::coverage::is_executable_line ' done 2>&1' 2 && echo " yes" || echo " no" )
269+ assert_equals " no" " $result "
270+ }
271+
272+ function test_coverage_is_executable_line_returns_false_for_done_with_background() {
273+ local result
274+ result=$( bashunit::coverage::is_executable_line ' done &' 2 && echo " yes" || echo " no" )
275+ assert_equals " no" " $result "
276+ }
277+
278+ function test_coverage_is_executable_line_returns_false_for_done_with_append_redirect() {
279+ local result
280+ result=$( bashunit::coverage::is_executable_line ' done >> /tmp/out.log' 2 && echo " yes" || echo " no" )
281+ assert_equals " no" " $result "
282+ }
0 commit comments