]>
Commit | Line | Data |
---|---|---|
b7449926 XL |
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"); |