github.com/dolthub/dolt/go@v0.40.5-0.20240520175717-68db7794bea6/utils/repofmt/check_bats_fmt.sh (about) 1 #!/bin/bash 2 3 script_dir=$(dirname "$0") 4 cd $script_dir/../../../integration-tests/bats 5 6 ERRORS_FOUND=0 7 for FILENAME_WITH_EXT in *.bats; do 8 FILENAME=${FILENAME_WITH_EXT%".bats"} 9 while read -r LINE; do 10 if [[ ! "$LINE" =~ "@test \"$FILENAME:" ]]; then 11 TESTNAME=$(echo "$LINE" | cut -d'"' -f 2) 12 echo -e "ERROR: test \"$TESTNAME\" in \"$FILENAME_WITH_EXT\" must start with \"$FILENAME:\" in the title" 13 ERRORS_FOUND=1 14 fi 15 done <<< $(grep '@test "' "$FILENAME_WITH_EXT") 16 done 17 if [[ $ERRORS_FOUND -eq 1 ]]; then 18 exit 1 19 fi 20 exit 0