mirror of https://github.com/sunface/rust-course
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
314 B
19 lines
314 B
Cargo looks for integration tests in `tests` directory next to `src`.
|
|
|
|
File `src/lib.rs`:
|
|
|
|
```rust
|
|
// Define this in a crate called `adder`.
|
|
pub fn add(a: i32, b: i32) -> i32 {
|
|
a + b
|
|
}
|
|
```
|
|
|
|
File with `test: tests/integration_test.rs`:
|
|
|
|
```rust
|
|
#[test]
|
|
fn test_add() {
|
|
assert_eq!(adder::add(3, 2), 5);
|
|
}
|
|
``` |