#4998

Test the C API with the maximum 16 arguments

Openrenanmpimentelwants to merge intofrom

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:

Statec-test result
Existing test + 15-argument limitPasses
New test + 15-argument limitFails by assertion: expected 16, got -2
New test + correct 16-argument limitPasses

Verification

  • CMake Debug build: passed
  • ctest --test-dir build --output-on-failure: 22/22 passed
  • clang-format --dry-run --Werror --lines=86:94 test/c-test.c: passed for the added lines
  • git diff --check: passed

This test-only gap was found with Supertest.