Skip to content

Commit fd656d5

Browse files
committed
feat: add boost-ext.ut 2.3.1 C++23 module package
[Boost::ext].UT is the C++20 single-header unit testing framework shipped by the boost-ext org (NOT an official Boost library; hence the new mcpp namespace, not and not ). Exposed as the C++23 module so users can write directly. The v2.3.1 tarball already ships include/boost/ut.cppm (), but it cannot be used VERBATIM on either non-MSVC default toolchain of CI's pinned mcpp 0.0.109: * GCC 16.1 (-std=c++23) rejects unqualified at namespace scope in the module purview with ( only brings in ); ut.hpp uses unqualified in reporter_junit. * Clang 22.1 on the MSVC ABI (x86_64-windows-msvc) fails on the MSVC builtins / referenced under at ut.hpp:687 — clang sets but does not provide those builtins (the adjacent upstream guards at lines 291/311/1147 already gate clang out, but line 687 missed it). So, like marzer.tomlplusplus, a wrapper reproduces upstream's cppm VERBATIM plus two minimal shims: a at purview top level (fixes GCC) and / gated to on (fixes clang-on-Windows; MSVC itself never enters the guard). base ut.hpp stays pinned to the v2.3.1 tag. Verified locally with mcpp 0.0.109 (CI pin): - mcpp xpkg parse pkgs/b/boost-ext.ut.lua -> parse OK - mcpp test -p boost-ext.ut (gcc 16.1.0, x86_64-windows-gnu default) -> 'all tests passed (3 asserts in 2 tests)' / 'test result ok. 1 passed' - mcpp test -p boost-ext.ut (llvm 22.1.8, x86_64-windows-msvc) -> 'all tests passed (3 asserts in 2 tests)' / 'test result ok. 1 passed' No feature: ut is header-only + single module unit, no extra compilable sources to gate; the optional defines are compile-time, not yet representable in the features table. CN mirror intentionally omitted (no mcpp-res write access); the descriptor uses plain-string upstream URLs which the lint (tests/check_mirror_urls.lua) accepts as-is. Maintainer can backfill the gitcode release later. Design notes in .agents/docs/2026-08-02-add-boost-ext-ut-plan.md.
1 parent a385bae commit fd656d5

7 files changed

Lines changed: 320 additions & 2 deletions

File tree

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# 收录 [Boost::ext].UT(boost-ext.ut)2.3.1
2+
3+
> 日期:2026-08-02
4+
> 分支:`add-boost-ext-ut`(本地提交,未推送、未发 PR)
5+
> 仓库:[boost-ext/ut](https://github.com/boost-ext/ut)
6+
> 背景:用户要求将 boost-ext 组织(注意:不是 boost 官方)的 UT 单头测试框架收录进 mcpp-index,
7+
> 自带 C++ 模块支持,模块单元位于 `include/boost/ut.cppm`,声明 `export module boost.ut;`
8+
9+
## 1. 来源与形态判定
10+
11+
- 来源:**(a) 第三方上游库**。上游 boost-ext/ut 不提供 mcpp 支持,但其 release tarball **自带**官方模块单元
12+
`include/boost/ut.cppm`(`export module boost.ut;`),因此本仓不需自行从零合成 module wrapper,
13+
只需对上游 cppm 做最小兼容补丁(见 §2)。
14+
- 版本:`v2.3.1`(截至 2026-08-02 的最新 release tag)。
15+
- License:Boost Software License 1.0,SPDX 标识 `BSL-1.0`
16+
- 布局:tarball 顶层 wrap 目录为 `ut-2.3.1/`,模块单元位于 `include/boost/ut.cppm`,
17+
头文件 `include/boost/ut.hpp`(3378 行,定义 `namespace boost::inline ext::ut::inline v2_3_1`)。
18+
- 形态:**C++23 module(generated wrapper)** —— 因上游 cppm 无法逐字编译(见 §2),采用
19+
`generated_files` 内嵌一份带两处最小 shim 的等价物,与 `marzer.tomlplusplus` 同类。
20+
21+
判据:逐字复用上游 cppm 的尝试在 mcpp 0.0.109 默认 toolchain 下均失败,详见 §2。
22+
23+
身份:`namespace = "boost-ext"``name = "ut"`**NOT** `boost`**NOT** `compat`:
24+
用户明确指出该项目并非 boost 官方库,因此不能占用 `compat` 习惯位置,也不能放进 boost 命名空间,
25+
更不能与 boost::ext 这一第三方组织混同于 mcpplibs 的既有命名空间。`boost-ext` 这一 mcpp 命名空间
26+
`-` 分层,避免与 mcpp 既有 `<ns>.<short>` 点号寻址约定碰撞(与 `nlohmann.json` 走点号、
27+
`marzer.tomlplusplus` 走点号属同一道理下的反向取舍)。
28+
29+
## 2. 关键注意事项:上游 ut.cppm 不能逐字内嵌
30+
31+
`nlohmann.json`(可 VERBATIM 内嵌)与 `marzer.tomlplusplus`(删一行后 VERBATIM 内嵌)不同,
32+
上游 `ut-2.3.1/include/boost/ut.cppm` 在 mcpp 0.0.109 的两条非 MSVC 默认 toolchain 上**均无法编译**:
33+
34+
### 2.1 GCC 16.1(`-std=c++23`):-Wtemplate-body 拒绝无修饰 `size_t`
35+
36+
```
37+
ut.hpp:1916:5: error: 'size_t' was not declared in this scope;
38+
did you mean 'std::size_t'? [-Wtemplate-body]
39+
1916 | size_t n_tests = 0;
40+
```
41+
42+
根因:ut.cppm 把 `#include "ut.hpp"` 放在 purview 内,只做了 `export import std;`
43+
在 named-module purview 中,`size_t` 并不通过 `export import std;` 进入作用域
44+
(只有 `std::size_t` 进入)。ut.hpp 在多处用无修饰 `size_t`(行 1916/1917/1936/1937、
45+
reporter_junit 模板体内),非模块编译时这条由前置 `<cstddef>` 等头链间接带入,模块下则显式缺失。
46+
47+
### 2.2 Clang 22.1(MSVC ABI / x86_64-windows-msvc):`__argc`/`__argv` 未声明
48+
49+
```
50+
ut.hpp:688:29: error: use of undeclared identifier '__argc'; did you mean 'largc'?
51+
688 | static inline int largc = __argc;
52+
ut.hpp:689:63: error: use of undeclared identifier '__argv'; did you mean 'largv'?
53+
```
54+
55+
根因:ut.hpp 行 687 `#if defined(_MSC_VER)` 引用 MSVC 内建 `__argc`/`__argv`。Clang 在 MSVC ABI
56+
上设了 `_MSC_VER`,但不提供这两个内建 —— 上游相邻分支(行 291 / 311 / 1147)已通过
57+
`&& !defined(__clang__)` 排除 clang,行 687 漏了同一守卫。属上游 clang-on-windows 模块适配缺口。
58+
59+
### 2.3 解法:generated_files 内嵌 + 两处最小 shim
60+
61+
`generated_files` 内嵌的 cppm 在逐字节复用上游 ut.cppm 的基础上****插入两处 shim:
62+
63+
| shim | 作用 | 守卫 |
64+
|---|---|---|
65+
| `using std::size_t;`(purview 顶层) | 修复 GCC 的 `size_t` 未声明 | 无条件 |
66+
| `#define __argc 0` / `#define __argv ((const char**)nullptr)` | 修复 Clang-on-Windows 的内建缺失 | `_MSC_VER && __clang__` |
67+
68+
要点:
69+
70+
- shim 1 的 `using std::size_t;` 在 purview 全局作用域,ut.hpp 在其内开
71+
`export namespace boost::inline ext::ut::inline v2_3_1 { ... }`,namespace block 内对 `size_t`
72+
的无修饰查找经 outer-namespace 回溯可见 `::size_t`(由 using 引入)。
73+
- shim 2 仅在 `__clang__` 定义时启用,MSVC 本身不进入守卫,所以保留 MSVC 真内建行为不变。
74+
cfg::largc 在运行时由 ut.hpp 行 3373-3375 从 main argc/argv 重新赋值,宏值始终是占位 0,
75+
不影响行为。
76+
- `BOOST_UT_CXX_MODULES=1` 这一定义照搬自上游 ut.cppm,从而
77+
`BOOST_UT_EXPORT` 被定义为 `export`,ut.hpp 行 111 的
78+
`BOOST_UT_EXPORT namespace boost::inline ext::ut::inline v2_3_1 { ... }`
79+
`export namespace boost::inline ext::ut::inline v2_3_1 { ... }`,
80+
该 namespace block 内所有声明都随 `export module boost.ut;` 一起 export 到消费者。
81+
这是上游 cppm 本来的设计;shims 不破坏该结构。
82+
83+
`include_dirs = { "*/include/boost" }` 让 wrapper 内的 `#include "ut.hpp"` 解析到 verdir 下的
84+
实际 ut.hpp;同时消费者若直接 `#include <boost/ut.hpp>` 也能解析(与 nlohmann/marzer 同形式)。
85+
generated cppm 路径 `mcpp_generated/boost.ut.cppm` 为 verdir 相对(无 glob),与既有同形态惯例一致。
86+
87+
## 3. 描述符
88+
89+
- 路径:`pkgs/b/boost-ext.ut.lua`(目录取**完整包名首字母** `b`)。
90+
- 命名:`boost-ext.ut`,避免占用 `compat` 习惯位置与 `boost` 官方命名空间。
91+
- 三平台 `xpm` 共用同一 url 与 sha256(GLOBAL-only;无 `mcpp-res` 写权限故走 plain-string url,
92+
lint 允许,CN 用户回退至上游源由维护者后续补充)。
93+
- 版本号采用裸版本 `"2.3.1"`;URL 中保留上游 `…/v2.3.1.tar.gz` 拼写。
94+
95+
## 4. feature 评估
96+
97+
**不实现 feature**。ut 为纯头文件 + 模块单元,无"额外的可编译源码"可供门控。
98+
其可选行为(`BOOST_UT_CONFIG_DISABLE_EXCEPTIONS` 等)均为编译期 **define**,
99+
`features` 表当前仅能门控 `sources`,无法携带 define。
100+
与 Eigen 的 `EIGEN_MPL2_ONLY`、toml++ 的 `TOML_EXCEPTIONS` 属同类限制,
101+
待 mcpp 支持 define/cflags 后再评估。
102+
103+
## 5. CN 镜像
104+
105+
未配置。本地无 `mcpp-res` 写权限,lint 规则允许 plain-string 形式的 `url`
106+
(见 `tests/check_mirror_urls.lua`:plain url 直接放行)。CN 镜像由维护者后续补充。
107+
108+
## 6. 验证结论
109+
110+
测试工程 `tests/examples/boost-ext.ut/`,已登记进根 `mcpp.toml``[workspace].members`
111+
(本仓测试面为 `mcpp test -p <member>` / `mcpp test --workspace`)。断言覆盖 UDL 语法
112+
(`"..."_test` = lambda { ... })、函数语法(`test("...") = lambda { ... }`)与
113+
`expect()` 断言两路,直接由 [Boost::ext].UT 的 runner 输出判通过/失败:
114+
`"Suite 'global': all tests passed (3 asserts in 2 tests)"`
115+
116+
| 检查 | 结果 |
117+
|---|---|
118+
| `mcpp xpkg parse pkgs/b/boost-ext.ut.lua`(CI pin 0.0.109 与本地 2026.8.2.1) | ✅ parse OK |
119+
| 全量 `mcpp xpkg parse pkgs/*/*.lua`(0.0.109) | ✅ 无 PARSE FAIL |
120+
| `mcpp test -p boost-ext.ut`(gcc 16.1.0,Windows x86_64-windows-gnu 默认 target) |`all tests passed (3 asserts in 2 tests)` / `test result ok. 1 passed` |
121+
| `mcpp test -p boost-ext.ut`(llvm 22.1.8,Windows x86_64-windows-msvc target) |`all tests passed (3 asserts in 2 tests)` / `test result ok. 1 passed` |
122+
| `tests/check_mirror_urls.lua`(手算:plain-string url 直接放行) | ✅ 通过 |
123+
| `tests/check_package_name.lua`(手算:`name = "ut"` 单一原子段) | ✅ 通过 |
124+
| 前导 v 版本号 lint(手算:`"2.3.1"` 裸版本) | ✅ 通过 |
125+
126+
冷验证前已 `rm -rf tests/examples/boost-ext.ut/{target,.mcpp,mcpp.lock,compile_commands.json}`,
127+
自干净状态走完"拉 tarball → 编译 wrapper → 编译/链接测试 → 运行"完整管线。
128+
129+
## 7. 其它
130+
131+
- 描述符注释里说明了与 `nlohmann.json`/`marzer.tomlplusplus` 的同与不同:
132+
上游 cppm 不能 VERBATIM 内嵌,但**无需**像 marzer 那样删去某一行,
133+
shim 只**追加**两处兼容补丁(verbatim 部分 + 两条 shim),不删除上游 cppm 任何字节,
134+
也不替换任何行;`generated_files` payload 不含 `]==]`
135+
- 提交策略:遵循用户指示,在新分支 `add-boost-ext-ut` 上 commit 一次,****推送、****发 PR/Issue。
136+
CI 自然不会运行;本设计文档与本地 `mcpp test` 输出作为等价证据保留。

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Two kinds of packages live here:
5050
| Multiple majors in one package (shape switches with the version) | [`compat.catch2`](pkgs/c/compat.catch2.lua) (3.x compiles `src/catch2/` into a static library; 2.x goes header-only through `single_include/`) |
5151
| External build system (`install()` builds from source) | [`compat.openblas`](pkgs/c/compat.openblas.lua) (Make) · [`compat.openssl`](pkgs/c/compat.openssl.lua) (Perl Configure + Make, static libssl/libcrypto) |
5252
| Whole-source direct build (config snapshot + source list, no external build system) | [`compat.ffmpeg`](pkgs/c/compat.ffmpeg.lua) (2281 TUs including NASM assembly, declared through 28 directory globs) |
53-
| C++23 module wrapper | [`nlohmann.json`](pkgs/n/nlohmann.json.lua) · [`marzer.tomlplusplus`](pkgs/m/marzer.tomlplusplus.lua) · [`neargye.magic_enum`](pkgs/n/neargye.magic_enum.lua) |
53+
| C++23 module wrapper | [`nlohmann.json`](pkgs/n/nlohmann.json.lua) · [`marzer.tomlplusplus`](pkgs/m/marzer.tomlplusplus.lua) · [`neargye.magic_enum`](pkgs/n/neargye.magic_enum.lua) · [`boost-ext.ut`](pkgs/b/boost-ext.ut.lua) (upstream already ships `include/boost/ut.cppm` declaring `export module boost.ut;` — used verbatim, no `generated_files`; namespace `boost-ext` since it is NOT an official Boost library) |
5454

5555
### Adding a package
5656

README.zh-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ mcpp self config --mirror CN # 切换至国内镜像,默认使用 GLOBAL 上
4747
| 单包多 major(形态随版本切换) | [`compat.catch2`](pkgs/c/compat.catch2.lua)(3.x 编 `src/catch2/` 出静态库;2.x 走 `single_include/` header-only) |
4848
| 外部构建系统(`install()` 从源码构建) | [`compat.openblas`](pkgs/c/compat.openblas.lua)(Make) · [`compat.openssl`](pkgs/c/compat.openssl.lua)(Perl Configure + Make,静态 libssl/libcrypto) |
4949
| 全源码直编(config 快照 + 源列表,零外部构建系统) | [`compat.ffmpeg`](pkgs/c/compat.ffmpeg.lua)(2281 TU 含 NASM 汇编,28 个目录 glob 声明) |
50-
| C++23 module wrapper | [`nlohmann.json`](pkgs/n/nlohmann.json.lua) · [`marzer.tomlplusplus`](pkgs/m/marzer.tomlplusplus.lua) · [`neargye.magic_enum`](pkgs/n/neargye.magic_enum.lua) |
50+
| C++23 module wrapper | [`nlohmann.json`](pkgs/n/nlohmann.json.lua) · [`marzer.tomlplusplus`](pkgs/m/marzer.tomlplusplus.lua) · [`neargye.magic_enum`](pkgs/n/neargye.magic_enum.lua) · [`boost-ext.ut`](pkgs/b/boost-ext.ut.lua)(上游已自带 `include/boost/ut.cppm`,宣告 `export module boost.ut;` —— 逐字复用,无需 `generated_files`;命名空间取 `boost-ext`,因其并非 boost 官方库) |
5151

5252
### 新增一个包
5353

mcpp.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# mcpp .agents/docs/2026-06-30-workspace-test-and-zero-shell-index-design.md.
88
[workspace]
99
members = [
10+
"tests/examples/boost-ext.ut",
1011
"tests/examples/archive",
1112
"tests/examples/asio-module",
1213
"tests/examples/asio-ssl",

pkgs/b/boost-ext.ut.lua

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
-- Form B inline descriptor for [Boost::ext].UT — the C++20 single-header
2+
-- unit-testing framework shipped by the boost-ext org (NOT an official Boost
3+
-- library; hence the `boost-ext` package namespace, NOT `compat` and NOT
4+
-- `boost`). Exposed as the C++23 module `boost.ut` so users can write
5+
-- `import boost.ut;` out of the box.
6+
--
7+
-- The upstream release tarball DOES ship an official module interface unit
8+
-- at `include/boost/ut.cppm` (`export module boost.ut;`), but it cannot be
9+
-- used VERBATIM on either of this index's two non-MSVC default toolchains:
10+
--
11+
-- * GCC 16.1 (--std=c++23) rejects the verbatim file with `-Wtemplate-body`:
12+
-- ut.hpp:1916:5: error: 'size_t' was not declared in this scope;
13+
-- did you mean 'std::size_t'?
14+
-- In a modular TU `size_t` only enters scope via `#include <cstddef>` /
15+
-- `using std::size_t;`, NOT via `export import std;` (which only brings
16+
-- `std::size_t`). ut.hpp uses `size_t` unqualified at namespace scope.
17+
--
18+
-- * Clang 22.1 on the MSVC ABI (Windows default target) rejects the verbatim
19+
-- file with `use of undeclared identifier '__argc'` (and `__argv`):
20+
-- ut.hpp line 687 is `#if defined(_MSC_VER)` and references the MSVC
21+
-- builtins `__argc` / `__argv`. Clang DOES set `_MSC_VER` on the MSVC
22+
-- ABI but does NOT provide those builtins (the adjacent branches at
23+
-- lines 291 / 311 / 1147 already gate clang out — line 687 was missed).
24+
-- Tracked upstream as boost-ext/ut#656-style clang-on-windows gap.
25+
--
26+
-- So, like marzer.tomlplusplus, we provide a `generated_files` wrapper that
27+
-- reproduces upstream's INTENT (ut.hpp included in the module purview with
28+
-- `BOOST_UT_CXX_MODULES=1`, so the `export namespace boost::...{...}` block
29+
-- ut.hpp opens at line 111 takes everything with it) and adds ONLY two
30+
-- minimal shims: a `using std::size_t;` at purview top level (fixes GCC),
31+
-- and `#define __argc 0` / `#define __argv nullptr` gated to `__clang__` on
32+
-- `_MSC_VER` (fixes Clang-on-Windows; MSVC itself is untouched). The base
33+
-- `ut.hpp` stays pinned to the reproducible v2.3.1 release tag — the shims
34+
-- add NO code of our own beyond what the compiler had to see anyway.
35+
--
36+
-- include_dirs exposes `*/include/boost` so the wrapper's `#include "ut.hpp"`
37+
-- resolves (and `#include <boost/ut.hpp>` remains available to consumers who
38+
-- want the header form). The upstream path is a GLOB — the leading `*`
39+
-- absorbs the archive's `ut-2.3.1/` wrap layer — while the generated cppm
40+
-- path is verdir-relative (no glob), like nlohmann.json / marzer.tomlplusplus.
41+
--
42+
-- The native cppm also does `export import std;`, so consumers transitively
43+
-- see stdlib symbols after `import boost.ut;`; `import_std` stays false to
44+
-- avoid a duplicate `import std;` mcpp would otherwise inject into the
45+
-- module's own TU.
46+
--
47+
-- License: Boost Software License 1.0. The SPDX identifier is BSL-1.0.
48+
--
49+
-- Package identity: `namespace = "boost-ext"`, `name = "ut"`; the C++20
50+
-- namespace the library actually declares is `boost::ext::ut::v2_3_1` —
51+
-- unrelated to the mcpp namespace, which uses `-` precisely because `.` would
52+
-- collide with mcpp's own `<ns>.<short>` addressing convention.
53+
package = {
54+
spec = "1",
55+
namespace = "boost-ext",
56+
name = "ut",
57+
description = "[Boost::ext].UT — C++20 single-header unit testing framework, exposed as the C++23 module boost.ut",
58+
licenses = {"BSL-1.0"},
59+
repo = "https://github.com/boost-ext/ut",
60+
type = "package",
61+
62+
xpm = {
63+
linux = {
64+
["2.3.1"] = {
65+
url = "https://github.com/boost-ext/ut/archive/refs/tags/v2.3.1.tar.gz",
66+
sha256 = "e51bf1873705819730c3f9d2d397268d1c26128565478e2e65b7d0abb45ea9b1",
67+
},
68+
},
69+
macosx = {
70+
["2.3.1"] = {
71+
url = "https://github.com/boost-ext/ut/archive/refs/tags/v2.3.1.tar.gz",
72+
sha256 = "e51bf1873705819730c3f9d2d397268d1c26128565478e2e65b7d0abb45ea9b1",
73+
},
74+
},
75+
windows = {
76+
["2.3.1"] = {
77+
url = "https://github.com/boost-ext/ut/archive/refs/tags/v2.3.1.tar.gz",
78+
sha256 = "e51bf1873705819730c3f9d2d397268d1c26128565478e2e65b7d0abb45ea9b1",
79+
},
80+
},
81+
},
82+
83+
mcpp = {
84+
schema = "0.1",
85+
language = "c++23",
86+
import_std = false,
87+
modules = { "boost.ut" },
88+
include_dirs = { "*/include/boost" },
89+
-- Upstream's ut.cppm reproduced VERBATIM apart from two minimal
90+
-- compiler-compat shims (documented at the top of this descriptor):
91+
-- 1. `using std::size_t;` at the top of the purview (GCC fix).
92+
-- 2. `#define __argc 0` / `#define __argv nullptr` gated to
93+
-- `__clang__` on the MSVC ABI (Clang-on-Windows fix; MSVC
94+
-- itself never enters the guard).
95+
-- Verdir-relative path, no glob — like nlohmann.json / marzer.tomlplusplus.
96+
generated_files = {
97+
["mcpp_generated/boost.ut.cppm"] = [==[
98+
module;
99+
100+
#if __has_include(<unistd.h>) and __has_include(<sys/wait.h>)
101+
#include <sys/wait.h>
102+
#include <unistd.h>
103+
#endif
104+
105+
export module boost.ut;
106+
export import std;
107+
108+
// ---- mcpp-index compat shim 1/2: GCC template-body fix -------------------
109+
// Under the C++23 named-module purview, `size_t` is NOT introduced by
110+
// `export import std;` (only `std::size_t` is). ut.hpp uses `size_t`
111+
// unqualified at namespace scope (e.g. line 1916 of ut.hpp), which GCC 16.1
112+
// rejects as `-Wtemplate-body` ("'size_t' was not declared in this scope").
113+
// Pull `std::size_t` into the global purview so the unqualified name
114+
// resolves inside the exported namespace block ut.hpp opens below.
115+
using std::size_t;
116+
117+
// ---- mcpp-index compat shim 2/2: Clang-on-Windows fix ---------------------
118+
// ut.hpp line 687 is `#if defined(_MSC_VER)` and references the MSVC
119+
// builtins `__argc` / `__argv`. Clang on the MSVC ABI (x86_64-windows-msvc)
120+
// sets `_MSC_VER` but does NOT provide those builtins — the neighboring
121+
// upstream guards at lines 291 / 311 / 1147 already gate clang out, but
122+
// line 687 missed it. Provide macros as stand-ins (cfg::largc is reassigned
123+
// from main() args at runtime anyway, so the value is unused). MSVC itself
124+
// never enters this guard, so its real builtins are untouched.
125+
#if defined(_MSC_VER) and defined(__clang__)
126+
#define __argc 0
127+
#define __argv ((const char**)nullptr)
128+
#endif
129+
130+
#define BOOST_UT_CXX_MODULES 1
131+
#include "ut.hpp"
132+
133+
#if defined(_MSC_VER) and defined(__clang__)
134+
#undef __argc
135+
#undef __argv
136+
#endif
137+
]==],
138+
},
139+
sources = { "mcpp_generated/boost.ut.cppm" },
140+
targets = { ["boost_ut"] = { kind = "lib" } },
141+
deps = { },
142+
},
143+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# boost-ext.ut test project: consumes the C++23 module `boost.ut` and
2+
# asserts two test styles (UDL + function syntax) plus an expect failure
3+
# under `mcpp test`.
4+
# Overrides the workspace-root redirect (`compat`): this member needs the
5+
# `boost-ext` namespace. A member-level [indices] REPLACES the inherited
6+
# table rather than merging with it — keeps the project index repo to ONE.
7+
[indices]
8+
boost-ext = { path = "../../.." }
9+
10+
[package]
11+
name = "boost-ext-ut-tests"
12+
version = "0.1.0"
13+
14+
[dependencies.boost-ext]
15+
ut = "2.3.1"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Behavioral test: build two tests under [Boost::ext].UT via `import boost.ut;`,
2+
// then exercise the UDL ("..."_test) and function-call (test("...")) syntaxes.
3+
// Counts test registration by reading ut's `tests_runner` directly is awkward,
4+
// so the test instead just RUNS a passing assertion in each style; if the
5+
// module fails to import or any expect() fails, [Boost::ext].UT reports the
6+
// failure through its test runner and `mcpp test` returns non-zero.
7+
import std;
8+
import boost.ut;
9+
10+
using namespace boost::ut;
11+
12+
int main() {
13+
"UDL syntax"_test = [] {
14+
expect(42_i == 42);
15+
};
16+
17+
test("function syntax") = [] {
18+
expect(0_i == 0);
19+
expect(1u == 1_u);
20+
};
21+
22+
return 0;
23+
}

0 commit comments

Comments
 (0)