1macro_rules! test_normalize {
2 (
3 $(DIR=$dir:literal)?
4 $(WORKSPACE=$workspace:literal)?
5 $(INPUT=$input:literal)?
6 $(TARGET=$target:literal)?
7 $original:literal
8 $expected:literal
9 ) => {
10 #[test]
11 fn test() {
12 let context = crate::normalize::Context {
13 krate: "trybuild000",
14 input_file: std::path::Path::new({ "tests/ui/error.rs" $(; $input)? }),
15 source_dir: &crate::directory::Directory::new({ "/git/trybuild/test_suite" $(; $dir)? }),
16 workspace: &crate::directory::Directory::new({ "/git/trybuild" $(; $workspace)? }),
17 target_dir: &crate::directory::Directory::new({ "/git/trybuild/target" $(; $target)? }),
18 path_dependencies: &[crate::run::PathDependency {
19 name: String::from("diesel"),
20 normalized_path: crate::directory::Directory::new("/home/user/documents/rust/diesel/diesel"),
21 }],
22 };
23 let original = $original;
24 let variations = crate::normalize::diagnostics(original, context);
25 let preferred = variations.preferred();
26 let expected = $expected;
27 if preferred != expected {
28 panic!("\nACTUAL: \"{}\"\nEXPECTED: \"{}\"", preferred, expected);
29 }
30 }
31 };
32}
33
34mod tests {
35 automod::dir!("src/tests");
36}
37