Add a trivial test
This commit is contained in:
parent
d3a4abe336
commit
0d232e69dc
11
src/lib.rs
11
src/lib.rs
|
@ -15,3 +15,14 @@ pub fn cast<T: 'static, R: 'static>(t: T) -> Result<R, T> {
|
|||
Err(t)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_cast() {
|
||||
assert_eq!(cast::<_, &'static str>("foo"), Ok("foo"));
|
||||
assert_eq!(cast::<_, &'static str>(4), Err(4));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue