Move to trybuild

This commit is contained in:
CreepySkeleton 2020-08-31 10:43:24 +03:00
parent 3e23e0d784
commit 4d3d057cc2
7 changed files with 18 additions and 25 deletions

View file

@ -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" }

9
maud/tests/errors.rs Normal file
View file

@ -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");
}

View file

@ -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);
}

View file

@ -0,0 +1,7 @@
error: found keyword `if`
--> $DIR/keyword_names_without_@.rs:9:9
|
9 | if {}
| ^^
|
= help: should this be a `@if`?

View file

@ -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

View file

@ -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" => {