-
Notifications
You must be signed in to change notification settings - Fork 544
Added ignore/tests counter #363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
current_dir=$(pwd) | ||
|
||
cd exercises | ||
|
||
for exercise_name in * | ||
do | ||
|
||
#Get filename | ||
file_name="$exercise_name/tests/*.rs" | ||
|
||
#Commented tests | ||
comment_test_num=$(cat $file_name | grep "// \#\[test\]" | wc -l) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is probably preferable to |
||
|
||
#Number of tests | ||
test_num=$(cat $file_name | grep "\#\[test\]" | wc -l) | ||
test_num=$(($test_num - $comment_test_num)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could consider counting those number of lines for which |
||
|
||
#Commented ignores | ||
comment_ignore_num=$(cat $file_name | grep "// \#\[ignore\]" | wc -l) | ||
|
||
#Number of ignores | ||
ignore_num=$(cat $file_name | grep "\#\[ignore\]" | wc -l) | ||
ignore_num=$(($ignore_num - $comment_ignore_num)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could consider counting those number of lines for which |
||
|
||
#Number of tests minus 1 should be the number of ignores | ||
compare=$(($test_num - 1)) | ||
|
||
#Print logic | ||
if [ "$compare" -eq "$ignore_num" ] | ||
then | ||
#Valid | ||
echo -n | ||
else | ||
echo "$file_name : " | ||
echo "Tests: $test_num" | ||
echo "Ignores: $ignore_num" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it would be good if the script would exit nonzero if any file were found to have an unexpected number of |
||
fi | ||
done | ||
|
||
cd $current_dir |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because this always does
cd exercises
, the caller of this script must be at the root of https://github.com/exercism/rust when running it, which is more disadvantageous compared to being able to run it anywhere