Skip to content

Commit 6f6c90f

Browse files
committed
docs(test): framework-agnostic wording (drop 'gtest style'), new flags, naming exemption note (zh+en)
1 parent 6455716 commit 6f6c90f

7 files changed

Lines changed: 14 additions & 7 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ import mcpplibs.cmdline;
221221

222222
- `mcpp new` — create a modular project; `--template <pkg>[@ver][:<tmpl>]` uses a **library-provided template** (e.g. `--template imgui`); `--list-templates <pkg>` lists them
223223
- `mcpp run [-- args]` — build and run
224-
- `mcpp test [pattern] [-- args]` — auto-discover and run tests (optionally filtered by name; `--message-format json` for tooling)
224+
- `mcpp test [pattern] [-- args]` — auto-discover and run tests (filter by name; `--list`, `--timeout <s>`, `--message-format json`)
225225
- `mcpp search` — search package indices
226226
- `mcpp add / remove / update` — dependency management
227227
- `mcpp explain E0001` — detailed error-code explanations

‎README.zh-CN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ import mcpplibs.cmdline;
221221

222222
- `mcpp new` — 创建模块化项目;`--template <pkg>[@ver][:<tmpl>]` 使用**库自带模板**(如 `--template imgui`),`--list-templates <pkg>` 列举
223223
- `mcpp run [-- args]` — 构建并运行
224-
- `mcpp test [pattern] [-- args]` — 自动发现并运行测试(可按名字过滤;`--message-format json` 供工具消费)
224+
- `mcpp test [pattern] [-- args]` — 自动发现并运行测试(按名字过滤;`--list`、`--timeout <s>`、`--message-format json`)
225225
- `mcpp search` — 搜索包索引
226226
- `mcpp add / remove / update` — 依赖管理
227227
- `mcpp explain E0001` — 错误码详细解释

‎docs/00-getting-started.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,11 @@ showing progress and speed along the way. Once downloaded, all mcpp projects sha
8282
```bash
8383
mcpp build # incremental build
8484
mcpp clean # clean target/
85-
mcpp test # compile and run tests/**/*.cpp (gtest style)
85+
mcpp test # compile and run tests/**/*.cpp — one binary per file,
86+
# framework-agnostic (bare main, or gtest via [dev-dependencies])
8687
mcpp test <pattern> # only tests whose name contains <pattern>
88+
mcpp test --list # enumerate tests without building
89+
mcpp test --timeout 30 # kill a test still running after 30s
8790
```
8891

8992
## Adding Dependencies

‎docs/05-mcpp-toml.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ qux = ">=1.0, <2.0" # Range combination
328328
gtest = "1.15.2"
329329
```
330330

331-
`mcpp build` ignores these; `mcpp test` resolves and uses them. `mcpp test` automatically discovers `tests/**/*.cpp` and compiles them into test binaries. Tests are named by their `tests/`-relative path (`tests/00-a/0.cpp` → `00-a/0`), each test compiles in isolation (a broken test fails alone; package/dep breakage is reported as a build error instead), and `mcpp test <pattern>` / `--message-format json` filter and machine-format the run.
331+
`mcpp build` ignores these; `mcpp test` resolves and uses them. `mcpp test` automatically discovers `tests/**/*.cpp` and compiles them into test binaries. The runner is framework-agnostic: each file is an independent binary judged by exit code — a bare `main`, gtest (via `[dev-dependencies]` + `gtest_main`), or any other framework all work identically, and `-- args` are forwarded to every test binary (e.g. `-- --gtest_filter=...`). Note: synthesized test target names may contain `/` (`tests/00-a/0.cpp` → `00-a/0`), unlike `[targets.*]` names — the two namespaces are intentionally separate (test targets never enter the manifest or publishing). Tests are named by their `tests/`-relative path (`tests/00-a/0.cpp` → `00-a/0`), each test compiles in isolation (a broken test fails alone; package/dep breakage is reported as a build error instead), and `mcpp test <pattern>` / `--message-format json` filter and machine-format the run.
332332

333333
### 2.7 `[toolchain]` — Toolchain Configuration
334334

‎docs/zh/00-getting-started.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ mcpp run
8383
```bash
8484
mcpp build # 增量构建
8585
mcpp clean # 清理 target/
86-
mcpp test # 编译并运行 tests/**/*.cpp(gtest 风格)
86+
mcpp test # 编译并运行 tests/**/*.cpp —— 每文件一个独立二进制,
87+
# 框架无关(裸 main,或经 [dev-dependencies] 使用 gtest)
88+
mcpp test <pattern> # 只运行名字包含 <pattern> 的测试
89+
mcpp test --list # 只枚举测试,不构建
90+
mcpp test --timeout 30 # 运行超过 30s 的测试将被终止并计为失败
8791
```
8892

8993
## 添加依赖

‎docs/zh/05-mcpp-toml.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ qux = ">=1.0, <2.0" # 范围组合
300300
gtest = "1.15.2"
301301
```
302302

303-
`mcpp build` 忽略这些;`mcpp test` 解析并使用。`mcpp test` 会自动发现 `tests/**/*.cpp` 并编译为测试二进制。
303+
`mcpp build` 忽略这些;`mcpp test` 解析并使用。`mcpp test` 会自动发现 `tests/**/*.cpp` 并编译为测试二进制。运行器与断言框架无关:每个文件是一个以退出码判定的独立二进制——裸 `main`、gtest(经 `[dev-dependencies]` + `gtest_main`)或其他框架均等价,`-- args` 会透传给每个测试二进制(例如 `-- --gtest_filter=...`)。注意:合成的测试 target 名可含 `/`(`tests/00-a/0.cpp` → `00-a/0`),与 `[targets.*]` 的命名文法不同——两套命名空间刻意分离(测试 target 不进清单、不参与发布)。
304304

305305
### 2.7 `[toolchain]` — 工具链配置
306306

‎src/cli.cppm‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void print_usage() {
5353
std::println(" mcpp new <name> Create a new package skeleton");
5454
std::println(" mcpp build [options] Build the current package");
5555
std::println(" mcpp run [target] [-- args...] Build + run a binary target");
56-
std::println(" mcpp test [-- args...] Build + run all tests/**/*.cpp");
56+
std::println(" mcpp test [pattern] [-- args...] Build + run tests/**/*.cpp (--list, --timeout, --message-format json)");
5757
std::println(" mcpp clean [--bmi-cache] Remove target/ (and optionally BMI cache)");
5858
std::println(" mcpp add <pkg>[@<ver>] Add a dependency to mcpp.toml");
5959
std::println(" mcpp remove <pkg> Remove a dependency from mcpp.toml");

0 commit comments

Comments
 (0)