blob: 69d5a90034c1c8e38a7400e6dde6a5bb9701f059 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#!/bin/sh
# shellcheck source=/dev/null
#
# Tests for the Pure sh Bible.
main() {
trap 'rm -f readme_code test_file' EXIT INT
# Extract code blocks from the README.
while read -r line; do
[ "$code" ] && [ "$line" != \`\`\` ] &&
printf '%s\n' "$line"
case $line in
\`\`\`sh) code=1 ;;
\`\`\`) code=
esac
done < README.md > readme_code
# Run shellcheck on the extracted code blocks
# and this test script itself.
shellcheck -s sh readme_code test.sh || exit 1
}
main "$@"
|