From 6d5e0a81c215c5a0246239d0002a3cec5b40c909 Mon Sep 17 00:00:00 2001 From: Florin Iucha Date: Sat, 8 Dec 2018 10:24:20 -0500 Subject: [PATCH] Add a simple test for strict compiler warnings --- test/CMakeLists.txt | 4 ++++ test/hello_fmt.cc | 10 ++++++++++ 2 files changed, 14 insertions(+) create mode 100644 test/hello_fmt.cc diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8eba73b7..20a2bfa5 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -200,4 +200,8 @@ if (FMT_PEDANTIC AND NOT WIN32) "-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}" "-DPEDANTIC_COMPILE_FLAGS=${PEDANTIC_COMPILE_FLAGS}" "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}") + + add_executable (hello_fmt hello_fmt.cc ../src/format.cc) + target_compile_options (hello_fmt PRIVATE -Wall -Wextra -Werror -pedantic -Wconversion -Wsign-conversion -Wunused -Wshadow -Wdouble-promotion -Wcast-align -Wnull-dereference) + target_include_directories( hello_fmt PRIVATE ${PROJECT_SOURCE_DIR}/include) endif () diff --git a/test/hello_fmt.cc b/test/hello_fmt.cc new file mode 100644 index 00000000..f1e90f84 --- /dev/null +++ b/test/hello_fmt.cc @@ -0,0 +1,10 @@ +#include + +int main() +{ + fmt::print("Hello, {}!", "world"); // uses Python-like format string syntax + + fmt::print("The answer is {}\n", 42); + + return 0; +}