Skip to content

Instantly share code, notes, and snippets.

@m4rw3r
Last active September 5, 2015 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m4rw3r/d988e8d7ef8282ab1ec1 to your computer and use it in GitHub Desktop.
Save m4rw3r/d988e8d7ef8282ab1ec1 to your computer and use it in GitHub Desktop.
#![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