| 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | test_description="Test sharness tests are correctly written" |
| 4 | |
| 5 | . lib/test-lib.sh |
| 6 | |
| 7 | for file in $(find .. -maxdepth 1 -name 't*.sh' -type f); do |
| 8 | test_expect_success "test in $file finishes" ' |
| 9 | grep -q "^test_done\b" "$file" |
| 10 | ' |
| 11 | |
| 12 | test_expect_success "test in $file has a description" ' |
| 13 | grep -q "^test_description=" "$file" |
| 14 | ' |
| 15 | |
| 16 | # We have some tests that manually kill. |
| 17 | case "$(basename "$file")" in |
| 18 | t0060-daemon.sh|t0023-shutdown.sh) continue ;; |
| 19 | esac |
| 20 | |
| 21 | test_expect_success "test in $file has matching ipfs start/stop" ' |
| 22 | awk "/^ *[^#]*test_launch_ipfs_daemon/ { if (count != 0) { exit(1) }; count++ } /^ *[^#]*test_kill_ipfs_daemon/ { if (count != 1) { exit(1) }; count-- } END { exit(count) }" "$file" |
| 23 | ' |
| 24 | done |
| 25 | |
| 26 | test_done |