Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #166 from abonander/158-trybuild
port compile-fail tests to trybuild
- Loading branch information
Showing
7 changed files
with
40 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
phf_macros/tests/compile-fail-unicase/equivalent-keys.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error: unsupported key expression | ||
--> $DIR/equivalent-keys.rs:5:5 | ||
| | ||
5 | UniCase("FOO") => 42, //~ NOTE one occurrence here | ||
| ^^^^^^^^^^^^^^ | ||
|
||
error[E0601]: `main` function not found in crate `$CRATE` | ||
| | ||
= note: consider adding a `main` function to `$DIR/tests/compile-fail-unicase/equivalent-keys.rs` | ||
|
||
For more information about this error, try `rustc --explain E0601`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
#![feature(proc_macro_hygiene)] | ||
|
||
extern crate phf; | ||
|
||
use phf::phf_map; | ||
|
||
static MAP: phf::Map<u32, u32> = phf_map! { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error: expected identifier | ||
--> $DIR/bad-syntax.rs:5:5 | ||
| | ||
5 | => //~ ERROR expected identifier | ||
| ^^ | ||
|
||
error[E0601]: `main` function not found in crate `$CRATE` | ||
| | ||
= note: consider adding a `main` function to `$DIR/tests/compile-fail/bad-syntax.rs` | ||
|
||
For more information about this error, try `rustc --explain E0601`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,13 @@ | ||
#![cfg(compiletest)] | ||
|
||
extern crate compiletest_rs as compiletest; | ||
|
||
use compiletest::Config; | ||
use std::path::Path; | ||
|
||
#[allow(dead_code)] | ||
fn run_mode(directory: &'static str, mode: &'static str) { | ||
let mut config = Config::default(); | ||
let cfg_mode = mode.parse().ok().expect("Invalid mode"); | ||
|
||
config.mode = cfg_mode; | ||
let dir = Path::new(env!("CARGO_MANIFEST_DIR")); | ||
config.target_rustcflags = Some(format!("-L {}", dir.join("../target/debug/deps").display())); | ||
config.src_base = dir.join("tests").join(directory); | ||
|
||
compiletest::run_tests(&config); | ||
} | ||
|
||
#[cfg(feature = "unicase_support")] | ||
#[test] | ||
#[ignore] | ||
#[ignore] // compiler error message format is different between 1.32.0 and nightly | ||
fn compile_test_unicase() { | ||
run_mode("compile-fail-unicase", "compile-fail"); | ||
let t = trybuild::TestCases::new(); | ||
t.compile_fail("tests/compile-fail-unicase/*.rs"); | ||
} | ||
|
||
#[test] | ||
#[ignore] | ||
fn compile_fail() { | ||
run_mode("compile-fail", "compile-fail"); | ||
let t = trybuild::TestCases::new(); | ||
t.compile_fail("tests/compile-fail/*.rs"); | ||
} |