test (706B)
1 #!/usr/bin/env bash 2 3 gcc src/*.c -o site 4 5 if [ $? -eq 0 ]; then 6 chmod +x site 7 8 ./site test 9 fi 10 11 assert() { 12 if [[ "$3" != $(cat $1 | htmlq $2 --text) ]]; then 13 echo "Failed to assert '$2'" 14 exit 1 15 fi 16 } 17 18 assert build/index.html '#static-site-generator' 'Static Site Generator' 19 assert build/index.html '#static-site-generator + p' 'A static site generator written in C.' 20 assert build/index.html 'h2' 'Usage' 21 assert build/index.html 'code' 'scripts/generate' 22 assert build/index.html 'h3' 'Strong Test' 23 assert build/index.html 'strong' 'This is strong content' 24 assert build/nested/test1.html 'h1' 'Neseted Test' 25 assert build/nested/test1.html 'p' 'This is a test file for nested content creation.'