mirror of
https://github.com/fmtlib/fmt.git
synced 2026-02-05 17:30:06 +08:00
Create compilation error tests for FMT_COMPILE missing named argument cases
This commit is contained in:
parent
7ad8004d57
commit
41634ec35e
@ -7,6 +7,7 @@ set(fmt_headers "
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/xchar.h>
|
||||
#include <fmt/ostream.h>
|
||||
#include <fmt/compile.h>
|
||||
#include <iostream>
|
||||
")
|
||||
|
||||
@ -209,6 +210,43 @@ if (CMAKE_CXX_STANDARD GREATER_EQUAL 20)
|
||||
#error
|
||||
#endif
|
||||
" ERROR)
|
||||
|
||||
# Format string compilation tests
|
||||
expect_compile(compiled-format-string-missing-argument-error "
|
||||
#if defined(FMT_HAS_CONSTEVAL) && FMT_USE_NONTYPE_TEMPLATE_ARGS
|
||||
using namespace fmt::literals;
|
||||
fmt::format(FMT_COMPILE(\"{x}\"));
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
" ERROR)
|
||||
|
||||
expect_compile(compiled-format-string-argument-unassigned-error "
|
||||
#if defined(FMT_HAS_CONSTEVAL) && FMT_USE_NONTYPE_TEMPLATE_ARGS
|
||||
using namespace fmt::literals;
|
||||
fmt::format(FMT_COMPILE(\"{x}\"), \"x\"_a);
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
" ERROR)
|
||||
|
||||
expect_compile(compiled-format-string-argument-duplicate-error "
|
||||
#if defined(FMT_HAS_CONSTEVAL) && FMT_USE_NONTYPE_TEMPLATE_ARGS
|
||||
using namespace fmt::literals;
|
||||
fmt::format(FMT_COMPILE(\"{x}\"), \"x\"_a=42, \"x\"_a=43);
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
" ERROR)
|
||||
|
||||
expect_compile(compiled-format-string-missing-other-argument-error "
|
||||
#if defined(FMT_HAS_CONSTEVAL) && FMT_USE_NONTYPE_TEMPLATE_ARGS
|
||||
using namespace fmt::literals;
|
||||
fmt::format(FMT_COMPILE(\"{a} {b}\"), \"b\"_a=42);
|
||||
#else
|
||||
#error
|
||||
#endif
|
||||
" ERROR)
|
||||
endif ()
|
||||
|
||||
# Run all tests
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user