From 3f146d1607284f0d9effa6fea8af53d98ccfb4e4 Mon Sep 17 00:00:00 2001 From: Peter Tseng Date: Mon, 19 Mar 2018 16:33:14 +0000 Subject: [PATCH] ensure-stubs-compile: Deny warnings in stubs --- _test/ensure-stubs-compile.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/_test/ensure-stubs-compile.sh b/_test/ensure-stubs-compile.sh index 618b3cdcd..fdcaf5f60 100644 --- a/_test/ensure-stubs-compile.sh +++ b/_test/ensure-stubs-compile.sh @@ -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 @@ -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