Move to trybuild
This commit is contained in:
parent
3e23e0d784
commit
4d3d057cc2
7 changed files with 18 additions and 25 deletions
|
@ -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" }
|
actix-web-dep = { version = "2.0.0", optional = true, default-features = false, package = "actix-web" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
compiletest_rs = { version = "0.3.19", features = ["stable"] }
|
trybuild = { version = "1.0.33", features = ["diff"] }
|
||||||
|
|
||||||
[badges]
|
[badges]
|
||||||
travis-ci = { repository = "lambda-fairy/maud" }
|
travis-ci = { repository = "lambda-fairy/maud" }
|
||||||
|
|
9
maud/tests/errors.rs
Normal file
9
maud/tests/errors.rs
Normal 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");
|
||||||
|
}
|
|
@ -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);
|
|
||||||
}
|
|
7
maud/tests/warnings/keyword_names_without_@.stderr
Normal file
7
maud/tests/warnings/keyword_names_without_@.stderr
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
error: found keyword `if`
|
||||||
|
--> $DIR/keyword_names_without_@.rs:9:9
|
||||||
|
|
|
||||||
|
9 | if {}
|
||||||
|
| ^^
|
||||||
|
|
|
||||||
|
= help: should this be a `@if`?
|
|
@ -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
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ impl Parser {
|
||||||
},
|
},
|
||||||
// Element
|
// Element
|
||||||
TokenTree::Ident(ident) => {
|
TokenTree::Ident(ident) => {
|
||||||
let _ident_string = ident.to_string();
|
let ident_string = ident.to_string();
|
||||||
// Is this a keyword that's missing a '@'?
|
// Is this a keyword that's missing a '@'?
|
||||||
match ident_string.as_str() {
|
match ident_string.as_str() {
|
||||||
"if" | "while" | "for" | "match" | "let" => {
|
"if" | "while" | "for" | "match" | "let" => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue