diff --git a/maud/Cargo.toml b/maud/Cargo.toml index 2664158..af8f9ef 100644 --- a/maud/Cargo.toml +++ b/maud/Cargo.toml @@ -29,7 +29,7 @@ futures = { version = "0.3.0", optional = true } actix-web-dep = { version = "2.0.0", optional = true, default-features = false, package = "actix-web" } [dev-dependencies] -compiletest_rs = { version = "0.3.19", features = ["stable"] } +trybuild = { version = "1.0.33", features = ["diff"] } [badges] travis-ci = { repository = "lambda-fairy/maud" } diff --git a/maud/tests/errors.rs b/maud/tests/errors.rs new file mode 100644 index 0000000..9d9ed93 --- /dev/null +++ b/maud/tests/errors.rs @@ -0,0 +1,9 @@ +use trybuild::TestCases; + +use std::path::PathBuf; + +#[test] +fn run_warnings() { + let config = TestCases::new(); + config.compile_fail("tests/warnings/*.rs"); +} diff --git a/maud/tests/warnings.rs b/maud/tests/warnings.rs deleted file mode 100644 index d836a29..0000000 --- a/maud/tests/warnings.rs +++ /dev/null @@ -1,15 +0,0 @@ -use 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); -} diff --git a/maud/tests/warnings/warn_on_keyword_names.rs b/maud/tests/warnings/keyword_names_without_@.rs similarity index 100% rename from maud/tests/warnings/warn_on_keyword_names.rs rename to maud/tests/warnings/keyword_names_without_@.rs diff --git a/maud/tests/warnings/keyword_names_without_@.stderr b/maud/tests/warnings/keyword_names_without_@.stderr new file mode 100644 index 0000000..743a3cb --- /dev/null +++ b/maud/tests/warnings/keyword_names_without_@.stderr @@ -0,0 +1,7 @@ +error: found keyword `if` + --> $DIR/keyword_names_without_@.rs:9:9 + | +9 | if {} + | ^^ + | + = help: should this be a `@if`? diff --git a/maud/tests/warnings/warn_on_keyword_names.stderr b/maud/tests/warnings/warn_on_keyword_names.stderr deleted file mode 100644 index 7ef4f25..0000000 --- a/maud/tests/warnings/warn_on_keyword_names.stderr +++ /dev/null @@ -1,8 +0,0 @@ -warning: found keyword `if` - should this be a `@if`? - --> $DIR/warn_on_keyword_names.rs:9:9 - | -9 | if {} - | ^^ - -warning: 1 warning emitted - diff --git a/maud_macros/src/parse.rs b/maud_macros/src/parse.rs index be043e4..e0b35ff 100644 --- a/maud_macros/src/parse.rs +++ b/maud_macros/src/parse.rs @@ -144,7 +144,7 @@ impl Parser { }, // Element TokenTree::Ident(ident) => { - let _ident_string = ident.to_string(); + let ident_string = ident.to_string(); // Is this a keyword that's missing a '@'? match ident_string.as_str() { "if" | "while" | "for" | "match" | "let" => {