forked from rust-phf/rust-phf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add compile-fail test for equivalent UniCase keys
- Loading branch information
Showing
3 changed files
with
39 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#![feature(plugin)] | ||
#![plugin(phf_macros)] | ||
|
||
extern crate phf; | ||
extern crate unicase; | ||
|
||
static MAP: phf::Map<UniCase<&'static str>, isize> = phf_map!( //~ ERROR duplicate key UniCase("FOO") | ||
UniCase("FOO") => 42, //~ NOTE one occurrence here | ||
UniCase("foo") => 42, //~ NOTE one occurrence here | ||
); |
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,26 @@ | ||
extern crate compiletest_rs as compiletest; | ||
|
||
use std::path::PathBuf; | ||
|
||
#[allow(dead_code)] | ||
fn run_mode(directory: &'static str, mode: &'static str) { | ||
let mut config = compiletest::default_config(); | ||
let cfg_mode = mode.parse().ok().expect("Invalid mode"); | ||
|
||
config.mode = cfg_mode; | ||
config.target_rustcflags = Some("-L target/debug/".to_owned()); | ||
config.src_base = PathBuf::from(format!("tests/{}", directory)); | ||
|
||
compiletest::run_tests(&config); | ||
} | ||
|
||
// #[test] | ||
// fn compile_test() { | ||
// run_mode("compile-fail", "compile-fail"); | ||
// } | ||
|
||
#[cfg(feature = "unicase_support")] | ||
#[test] | ||
fn compile_test_unicase() { | ||
run_mode("compile-fail-unicase", "compile-fail"); | ||
} |