done with ch11

This commit is contained in:
Rowan Torbitzky-Lane 2025-03-29 14:12:00 -05:00
parent 5015699e0d
commit a288b75401
3 changed files with 30 additions and 0 deletions

View File

@ -3,4 +3,8 @@ name = "adder"
version = "0.1.0"
edition = "2021"
# [lib]
# name="lib"
# path="src/lib.rs"
[dependencies]

View File

@ -0,0 +1,11 @@
// Having common appear in the test results with `running 0 tests`
// is suboptimal. To avoid this, make a file `tests/common/mod.rs`
// Files in the subdirectories of the tests directory don't get compiled
// as separate crates or have sections in the test output.
//
// Can use this file from any of the integration test files as a module.
pub fn setup() {
// setup code for specific library's tests would go here
}

View File

@ -0,0 +1,15 @@
// can run with just `cargo test` or
// $ cargo test --test integration_test
// for this file specifically
use adder::add_two;
mod common;
#[test]
fn it_adds_two() {
common::setup();
let result = add_two(2);
assert_eq!(result, 4);
}