vendored-meson/meson/test cases/rust/9 unit tests/test.rs
raw| 1 | pub fn add(a: i32, b: i32) -> i32 { |
| 2 | return a + b; |
| 3 | } |
| 4 | |
| 5 | #[cfg(test)] |
| 6 | mod tests { |
| 7 | use super::*; |
| 8 | |
| 9 | #[test] |
| 10 | fn test_add() { |
| 11 | assert_eq!(add(1, 2), 3); |
| 12 | } |
| 13 | |
| 14 | #[test] |
| 15 | fn test_add_intentional_fail() { |
| 16 | assert_eq!(add(1, 2), 5); |
| 17 | } |
| 18 | |
| 19 | #[test] |
| 20 | #[ignore] |
| 21 | fn test_add_intentional_fail2() { |
| 22 | assert_eq!(add(1, 7), 5); |
| 23 | } |
| 24 | } |