From baf281eddd39838e1566a106738d9d3095d66921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20P=C3=A9rex?= Date: Tue, 27 May 2025 01:10:59 +0100 Subject: [PATCH] chore: add testcapture and comments about test in parallel --- README.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index affcd8a..45739a8 100644 --- a/README.md +++ b/README.md @@ -184,6 +184,7 @@ Available recipes: run # [alias: ru] runtest # [alias: rt] test # [alias: t] + testcapture # [alias: tc] ``` The following have different **recipes** for **macos** and **linux** @@ -217,7 +218,6 @@ BIN_APP_PATH := "/usr/local/bin" > [Command-line-options](#options) can be added > RUST_LOG environment variable controls env_logger output - | Recipe | alias | Descripción | parameters | |--------|-------|--------------|--------------------| | **build** | b | run cargo | cargo arguments | @@ -228,9 +228,30 @@ BIN_APP_PATH := "/usr/local/bin" | **clean** | cl | run cargo clean | cargo arguments | | **doc** | d | run cargo doc --open --no-deps | cargo arguments | | **benchmark** | be | run cargo bench | cargo arguments | -| **test*** | be | run cargo t | cargo arguments | +| **test*** | t | run cargo t | cargo arguments | +| **testcapure*** | tc | run cargo t -- --nocapture | cargo arguments | | **runtest** | rt | run [run.sh](run.sh) script using [test](test) directories for **SOURCE** and **DEST** parametets
add [Command-line-options](#options) | | +--- + +### For tests + +> [!NOTE] +> The logger can only be initialized once per process
+> Test by default runs in parallel + +Use **--nocapture** to see the output even when tests pass + +The **RUST_LOG** environment variable controls what gets logged + +Log files are automatically cleaned up when the **TempDir** is dropped + +The recommended way to test logging functionality: +- create a temporary log file +- write some messages +- verify their presence in the log + + ## To work on app | Recipe | alias | Descripción | parameters |