-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
Currently, every file in the tests directory is treated as a zunit test file, and an error is thrown if the file does not start with the zunit shebang:
Lines 396 to 425 in 8048638
if [[ -d $argument ]]; then | |
# Loop through each of the files in the directory | |
for file in $(find $argument -mindepth 1 -maxdepth 1); do | |
# Run it through the parser again | |
_zunit_parse_argument $file | |
done | |
return | |
fi | |
# If it is a valid file | |
if [[ -f $argument ]]; then | |
# Grab the first line of the file | |
line=$(cat $argument | head -n 1) | |
# Check for the zunit shebang | |
if [[ $line =~ "#! ?/usr/bin/env zunit" ]]; then | |
# Add it to the array | |
testfiles[(( ${#testfiles} + 1 ))]=("$argument${test_name+"@$test_name"}") | |
return | |
fi | |
# The test file does not contain the zunit shebang, therefore | |
# we can't trust that running it will not be harmful, and throw | |
# a fatal error | |
echo $(color red "File '$argument' is not a valid zunit test file") >&2 | |
echo "Test files must contain the following shebang on the first line" >&2 | |
echo " #!/usr/bin/env zunit" >&2 | |
exit 126 | |
fi |
Is there a reason for not filtering out files that lack the .zunit extension? I have experienced a number of situations where zunit fails due to trying to read a macOS .DS_Store or vim .swp file as a test file.
Metadata
Metadata
Assignees
Labels
No labels