vendored-meson/meson/test cases/rust/9 unit tests/test3.rs
raw| 1 | pub fn add(a: i32, b: i32) -> i32 { |
| 2 | a + b |
| 3 | } |
| 4 | |
| 5 | #[cfg(test)] |
| 6 | mod tests { |
| 7 | extern crate helper; |
| 8 | |
| 9 | use super::*; |
| 10 | |
| 11 | // This is an intentionally broken test that should be turned off by extra rust arguments |
| 12 | #[cfg(not(broken = "false"))] |
| 13 | #[test] |
| 14 | fn test_broken() { |
| 15 | assert_eq!(0, 5); |
| 16 | } |
| 17 | |
| 18 | #[test] |
| 19 | fn test_add_sub() { |
| 20 | let x = helper::subtract(6, 5); |
| 21 | assert_eq!(add(x, 5), 6); |
| 22 | } |
| 23 | } |