Skip to content

ensure-stubs-compile: Deny warnings in stubs #478

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

Merged
merged 1 commit into from
Apr 8, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions _test/ensure-stubs-compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ for dir in $repo/exercises/*/; do
continue
fi

# In Travis CI, we may have already compiled using the example solution.
# Touch the src/lib.rs file so that we surely recompile using the stub.
touch $dir/src/lib.rs

# Backup tests; this script will modify them.
# Backup tests and stub; this script will modify them.
cp -r $dir/tests $dir/tests.orig
cp $dir/src/lib.rs $dir/lib.rs.orig

# This sed serves two purposes:
# First, in Travis CI, we may have already compiled using the example solution.
# Edit the src/lib.rs file so that we surely recompile using the stub.
# Second, ensures that the stub compiles without warnings.
sed -i -e '1i #![deny(warnings)]' "$dir/src/lib.rs"

# Deny warnings in the tests that may result from compiling the stubs.
# This helps avoid, for example, an overflowing literal warning
Expand All @@ -34,7 +37,8 @@ for dir in $repo/exercises/*/; do
broken="$broken\n$exercise"
fi

# Restore tests.
# Restore tests and stub.
mv $dir/lib.rs.orig $dir/src/lib.rs
rm -r $dir/tests
mv $dir/tests.orig $dir/tests
fi
Expand Down