Merge branch 'keyword_warn_compiletest'
This commit is contained in:
commit
b1dd7b729f
5 changed files with 48 additions and 7 deletions
20
.travis.yml
20
.travis.yml
|
@ -3,17 +3,23 @@ rust: nightly
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- rustup component add clippy-preview --toolchain=nightly
|
- |
|
||||||
|
RUN_CLIPPY=true
|
||||||
|
rustup component add clippy-preview --toolchain=nightly || RUN_CLIPPY=false
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- (cd maud && cargo build --features="iron")
|
- (cd maud && cargo build --features="iron")
|
||||||
|
# The compiletest tests require a single version of the crate to be built
|
||||||
|
# or else there will be errors in picking the right version - so we test now
|
||||||
|
- cargo test --all
|
||||||
- (cd maud && cargo build --features="rocket")
|
- (cd maud && cargo build --features="rocket")
|
||||||
- (cd maud && cargo build --features="actix-web")
|
- (cd maud && cargo build --features="actix-web")
|
||||||
- cargo test --all
|
|
||||||
- (cd benchmarks && cargo bench --no-run)
|
- (cd benchmarks && cargo bench --no-run)
|
||||||
- |
|
- |
|
||||||
CLIPPY_STATUS=0
|
if $RUN_CLIPPY; then
|
||||||
for package in maud_htmlescape maud_macros maud maud_extras; do
|
CLIPPY_STATUS=0
|
||||||
(cd $package && cargo clippy -- -D warnings) || CLIPPY_STATUS=$?
|
for package in maud_htmlescape maud_macros maud maud_extras; do
|
||||||
done
|
(cd $package && cargo clippy -- -D warnings) || CLIPPY_STATUS=$?
|
||||||
(exit $CLIPPY_STATUS)
|
done
|
||||||
|
(exit $CLIPPY_STATUS)
|
||||||
|
fi
|
||||||
|
|
|
@ -19,6 +19,9 @@ iron = { version = ">= 0.5.1, < 0.7.0", optional = true }
|
||||||
rocket = { version = "0.3", optional = true }
|
rocket = { version = "0.3", optional = true }
|
||||||
actix-web = { version = ">= 0.6.12, < 0.8.0", optional = true }
|
actix-web = { version = ">= 0.6.12, < 0.8.0", optional = true }
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
compiletest_rs = "0.3.15"
|
||||||
|
|
||||||
[badges]
|
[badges]
|
||||||
travis-ci = { repository = "lfairy/maud" }
|
travis-ci = { repository = "lfairy/maud" }
|
||||||
|
|
||||||
|
|
15
maud/tests/warnings.rs
Normal file
15
maud/tests/warnings.rs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
extern crate compiletest_rs;
|
||||||
|
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn run_warnings() {
|
||||||
|
let mut config = compiletest_rs::Config::default();
|
||||||
|
|
||||||
|
config.mode = compiletest_rs::common::Mode::Ui;
|
||||||
|
config.src_base = PathBuf::from("tests/warnings");
|
||||||
|
config.link_deps(); // Populate config.target_rustcflags with dependencies on the path
|
||||||
|
config.clean_rmeta(); // If your tests import the parent crate, this helps with E0464
|
||||||
|
|
||||||
|
compiletest_rs::run_tests(&config);
|
||||||
|
}
|
11
maud/tests/warnings/warn_on_keyword_names.rs
Normal file
11
maud/tests/warnings/warn_on_keyword_names.rs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#![feature(proc_macro_hygiene)]
|
||||||
|
|
||||||
|
extern crate maud_macros;
|
||||||
|
|
||||||
|
use maud_macros::html;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
html! {
|
||||||
|
if {}
|
||||||
|
};
|
||||||
|
}
|
6
maud/tests/warnings/warn_on_keyword_names.stderr
Normal file
6
maud/tests/warnings/warn_on_keyword_names.stderr
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
warning: found keyword `if` - should this be a `@if`?
|
||||||
|
--> $DIR/warn_on_keyword_names.rs:9:9
|
||||||
|
|
|
||||||
|
9 | if {}
|
||||||
|
| ^^
|
||||||
|
|
Loading…
Add table
Reference in a new issue