Skip to content

Instantly share code, notes, and snippets.

@m4rw3r m4rw3r/lib.rs
Last active Sep 5, 2015

Embed
What would you like to do?
#![crate_name = "parser"]
#![crate_type = "lib"]
use std::ops::Add;
/// ```
/// use parser::test;
///
/// assert_eq!(test::<i32>(1)(2), 3);
/// ```
pub fn test<'a, I: 'a + Add<I, Output=I>>(i: I) -> impl FnOnce(I) -> I + 'a {
|a| a + i
}
➜ src rustc lib.rs
➜ src rustdoc --test -L. lib.rs
running 1 test
test test_0 ... FAILED
failures:
---- test_0 stdout ----
thread 'test_0' panicked at 'lookup_item: id not found: 9', src/librustc/metadata/decoder.rs:99
failures:
test_0
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured
thread '<unnamed>' panicked at 'Some tests failed', src/libtest/lib.rs:253
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.