| 1 |
#! /usr/bin/atf-sh |
| 2 |
|
| 3 |
atf_test_case atf_check |
| 4 |
atf_check_head() { |
| 5 |
atf_set "descr" "Test atf_check in atf-sh works" |
| 6 |
} |
| 7 |
atf_check_body() { |
| 8 |
# Check for silent output |
| 9 |
atf_check -s exit:0 -o empty -e empty true |
| 10 |
|
| 11 |
# Check for silent output and failure |
| 12 |
atf_check -s exit:1 -o empty -e empty false |
| 13 |
|
| 14 |
# Check for known stdout and silent stderr |
| 15 |
echo foo >expout |
| 16 |
atf_check -s exit:0 -o file:expout -e empty echo foo |
| 17 |
|
| 18 |
# Generate a file for later inspection |
| 19 |
atf_check -s exit:0 -o save:stdout -e empty ls |
| 20 |
|
| 21 |
# Or just do the match along the way |
| 22 |
atf_check -s exit:0 -o match:"^stdout$" -e empty ls |
| 23 |
} |
| 24 |
|
| 25 |
atf_init_test_cases() { |
| 26 |
atf_add_test_case atf_check |
| 27 |
} |
| 28 |
|
| 29 |
# vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4 |