-
Notifications
You must be signed in to change notification settings - Fork 531
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
I don't like having to manually verify that second+later tests are ignored. Can it be automated? #352
Comments
I had a think. Here is a shell script that will return whether the given file name is valid. #Argument 0
file_name="$1"
#Number of tests
test_num=$(cat $file_name | grep "\#\[test\]" | wc -l)
#Number of ignores
ignore_num=$(cat $file_name | grep "\#\[ignore\]" | wc -l)
#Number of tests minus 1 should be the number of ignores
compare=$(($test_num - 1))
#Print logic
if [ "$compare" -eq "$ignore_num" ]
then
echo true
else
echo false
fi |
Current: ./exercises/bob/tests/bob.rs: Has 25 tests and 23 ignores (should be 24) |
Updated issue description: The script exists, and current exercises have been fixed. Next step, if the script receives approval and gets merged, is to add it to Travis CI. |
As noted in #279, we ignore all tests except the first.
I don't like having to check by hand whether every new exercise submission has done this.
Maybe we can automate itWe are automating it in #361 by counting the number of#[ignore]
lines and ensuring that it is exactly one smaller than the number of#[test]
lines.By suggestion of a contributor (not myself) another possible way to do it is to runcargo test
and make sure it says1 passed; 0 failed
. One disadvantage is it involves having to actually compile and run, whereas countingignore
andtest
does not.All current exercises have been fixed so they have exactly one fewer
ignore
line thantest
line.The remaining task is to add it to Travis CI so that future exercises also receive its benefit.
The text was updated successfully, but these errors were encountered: