]> git.lizzy.rs Git - rust.git/blob - src/test/ui/custom_test_frameworks/full.rs
Rollup merge of #95534 - jyn514:std-mem-copy, r=joshtriplett
[rust.git] / src / test / ui / custom_test_frameworks / full.rs
1 // run-pass
2 // aux-build:example_runner.rs
3 // compile-flags:--test
4
5 #![feature(custom_test_frameworks)]
6 #![test_runner(example_runner::runner)]
7 extern crate example_runner;
8
9 pub struct IsFoo(&'static str);
10
11 impl example_runner::Testable for IsFoo {
12     fn name(&self) -> String {
13         self.0.to_string()
14     }
15
16     fn run(&self) -> Option<String> {
17         if self.0 != "foo" {
18             return Some(format!("{} != foo", self.0));
19         }
20         None
21     }
22 }
23
24 #[test_case]
25 const TEST_1: IsFoo = IsFoo("hello");
26
27 #[test_case]
28 const TEST_2: IsFoo = IsFoo("foo");