llvm/clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-format-fmt.cpp

// RUN: %check_clang_tidy %s modernize-use-std-format %t -- \
// RUN:   -config="{CheckOptions: { \
// RUN:              StrictMode: true, \
// RUN:              modernize-use-std-format.StrFormatLikeFunctions: 'fmt::sprintf', \
// RUN:              modernize-use-std-format.ReplacementFormatFunction: 'fmt::format', \
// RUN:              modernize-use-std-format.FormatHeader: '<fmt/core.h>' \
// RUN:            }}" \
// RUN:   -- -isystem %clang_tidy_headers

// CHECK-FIXES: #include <fmt/core.h>
#include <string>

namespace fmt
{
template <typename S, typename... T,
          typename Char = char>
std::basic_string<Char> sprintf(const S& fmt, const T&... args);
} // namespace fmt

std::string fmt_sprintf_simple() {
  return fmt::sprintf("Hello %s %d", "world", 42);
  // CHECK-MESSAGES: [[@LINE-1]]:10: warning: use 'fmt::format' instead of 'sprintf' [modernize-use-std-format]
  // CHECK-FIXES: fmt::format("Hello {} {}", "world", 42);
}