#4998
Test the C API with the maximum 16 arguments
What changed
Add a C API test that formats exactly 16 arguments, the maximum exposed by FMT_MAP_16 and accepted by fmt_vformat. It checks both the returned length and the formatted output.
Why
The existing C API tests format at most two arguments. Reducing max_c_format_args from 16 to 15 in src/fmt-c.cc leaves the existing c-test green, although the public fmt_format macro still accepts 16 arguments and now returns fmt_error_invalid_arg for that valid call.
I verified the test with the same regression in an isolated worktree:
| State | c-test result |
|---|---|
| Existing test + 15-argument limit | Passes |
| New test + 15-argument limit | Fails by assertion: expected 16, got -2 |
| New test + correct 16-argument limit | Passes |
Verification
- CMake Debug build: passed
ctest --test-dir build --output-on-failure: 22/22 passedclang-format --dry-run --Werror --lines=86:94 test/c-test.c: passed for the added linesgit diff --check: passed
This test-only gap was found with Supertest.