Skip to content

Commit daf71e9

Browse files
authored
Merge pull request #478 from petertseng/warnstubs
ensure-stubs-compile: Deny warnings in stubs
2 parents f7d444a + 3f146d1 commit daf71e9

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

_test/ensure-stubs-compile.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@ for dir in $repo/exercises/*/; do
1717
continue
1818
fi
1919

20-
# In Travis CI, we may have already compiled using the example solution.
21-
# Touch the src/lib.rs file so that we surely recompile using the stub.
22-
touch $dir/src/lib.rs
23-
24-
# Backup tests; this script will modify them.
20+
# Backup tests and stub; this script will modify them.
2521
cp -r $dir/tests $dir/tests.orig
22+
cp $dir/src/lib.rs $dir/lib.rs.orig
23+
24+
# This sed serves two purposes:
25+
# First, in Travis CI, we may have already compiled using the example solution.
26+
# Edit the src/lib.rs file so that we surely recompile using the stub.
27+
# Second, ensures that the stub compiles without warnings.
28+
sed -i -e '1i #![deny(warnings)]' "$dir/src/lib.rs"
2629

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

37-
# Restore tests.
40+
# Restore tests and stub.
41+
mv $dir/lib.rs.orig $dir/src/lib.rs
3842
rm -r $dir/tests
3943
mv $dir/tests.orig $dir/tests
4044
fi

0 commit comments

Comments
 (0)