Commit Graph

622 Commits

Author SHA1 Message Date
Victor Zverovich
9dbb60c4c8 Move fmt::fprintf to printf.h 2016-08-03 08:52:05 -07:00
Victor Zverovich
6ee9f2ed09 Make printf argument formatters public (#335, #360) 2016-07-21 06:59:28 -07:00
Victor Zverovich
ab054532ce Move writer to PrintfFormatter object for consistency with BasicFormatter 2016-07-20 08:21:13 -07:00
Victor Zverovich
d4ddaaf2b1 Make PrintfFormatter public (#335, #360) 2016-07-20 08:09:14 -07:00
Victor Zverovich
65cd664195 Fix handling of wide strings in StringWriter 2016-07-18 08:47:11 -07:00
Victor Zverovich
1acfd07f1e Workaround broken MinGW installation on AppVeyor (#355) 2016-07-16 08:00:53 -07:00
Victor Zverovich
d4885cea62 Document BasicStringWriter 2016-07-16 08:00:53 -07:00
Victor Zverovich
8631694021 check -> const_check to avoid a conflict with AssertMacros.h (#350) 2016-07-12 06:40:23 -07:00
Victor Zverovich
0e6df7e511 Fix handling of thousands separator (#353) 2016-07-11 06:31:23 -07:00
Victor Zverovich
4569b4dbd6 Fix -Wpessimizing-move 2016-06-14 15:53:40 -07:00
Victor Zverovich
c9bb5468b6 Fix clang warning 2016-06-14 15:42:32 -07:00
Glen Stark
72d51e0b1e Implemented #335: custom printf support 2016-06-09 08:41:56 -07:00
Victor Zverovich
96c28f748d Detect if lconv contains thousands_sep 2016-05-23 07:41:22 -07:00
Victor Zverovich
e160c2b79a Add fmt prefix to includes (#332)
Technically it is not necessary, but prevents errors when people add the
fmt directory itself rather than its parent to includes.
2016-05-22 16:42:44 -07:00
Victor Zverovich
e2a332e5df Use a mock to test locale support 2016-05-19 17:38:44 -07:00
Victor Zverovich
5b106083e7 Check if setlocale succeeded 2016-05-19 06:48:35 -07:00
Victor Zverovich
b6c0cf9683 Add fmt::to_string (#326) 2016-05-18 19:54:52 -07:00
Victor Zverovich
d00b43c592 Workaround an issue with "delete this" in GMock and gcc 6.1.1 2016-05-14 17:58:14 -07:00
Victor Zverovich
cc9b051d12 Move format_system_error to the public API (#323) 2016-05-13 07:19:39 -06:00
Victor Zverovich
90730e706b Move ostream support to ostream.{h,cc} 2016-05-06 07:37:20 -07:00
Dean Moldovan
f3d6d3a8f2 Fix find-package-test failure with non-default compiler
The failure would happen when the main project was configured with
a compiler which is not the system default. The new configuration
was not forwarded to "ctest --build-and-test". This fixes it.
2016-05-04 00:51:28 +02:00
Dean Moldovan
8eaad79de7 Fix FMT_STATIC_ASSERT compile test
FMT_STATIC_ASSERT is defined in posix.h so expect_compile_error was
actually failing on a missing macro instead of the static assert.
2016-05-04 00:36:48 +02:00
Dean Moldovan
131d446183 Fix compile tests not clearing the cache after an error
The cache bug meant that a failed test would appear forever broken,
even if the proper fix was applied.
2016-05-04 00:36:11 +02:00
Dean Moldovan
3a04ebf14f Fix user-defined literal detection for Intel C++ compiler 2016-05-03 13:43:51 +02:00
Victor Zverovich
fa5ebd27d4 Implement time formatting 2016-04-25 08:07:27 -07:00
Victor Zverovich
afd67497de cppformat -> fmt 2016-04-24 09:06:12 -07:00
Victor Zverovich
5e1576f79f cppformat -> fmt 2016-04-24 08:17:47 -07:00
vitaut
bfdca8b576 Make ArgVisitor public and document it
Also remove unnecessary namespace qualification.
2016-04-20 09:11:33 -07:00
vitaut
b69e6dcead Make BasicArgFormatter public and add ArgFormatter
This allows providing custom argument formatters without relying on
internal APIs (#235).
2016-04-19 08:56:31 -07:00
vitaut
f68771abe4 Implement locale-specific integer formatting 2016-04-17 19:06:03 -07:00
vitaut
581afee039 Enable wstring in gtest (#304) 2016-04-13 08:26:42 -04:00
vitaut
a99891e7a5 Use a mock to test custom argument formatter 2016-03-19 07:36:28 -07:00
vitaut
52f89065e1 Make argument formatter customizable 2016-03-19 07:20:31 -07:00
vitaut
9ffe98c00e Fix/suppress MSVC warnings 2016-03-19 06:39:33 -07:00
vitaut
63d7f3d116 Don't check for C++11 features if C++11 support is disabled 2016-03-18 08:10:06 -07:00
vitaut
c052cf11b9 Improve coding style consistency 2016-03-18 07:59:04 -07:00
vitaut
0c901efb16 Use less strict pedantic flags for tests because of GMock (#291) 2016-03-18 07:52:24 -07:00
vitaut
59607f5e99 Fix warnings on GCC 4.6.3 2016-03-09 07:47:08 -08:00
vitaut
763d1fe6a3 Suppress warnings in Google Mock 2016-03-08 07:36:22 -08:00
vitaut
7d6622942c Break a long line 2016-03-08 06:55:41 -08:00
vitaut
0867c1b447 Test writing to ostream 2016-03-08 06:47:53 -08:00
Michael Winterberg
8f4b8edb8b Added test of error code that forces the insufficient buffer code path. 2016-03-04 17:47:37 -08:00
vitaut
3ecad55910 Fix sign conversion warnings 2016-03-02 07:53:14 -08:00
vitaut
9d577cae6f Fix handling of negative error codes in format_error_code 2016-03-02 07:01:21 -08:00
vitaut
6500f161f7 Fix a warning in freelocale mock (#274) 2016-02-11 06:55:53 -08:00
vitaut
abd93d824a Move gmock into test/ 2016-02-10 07:16:49 -08:00
vitaut
2b2aa8926f add_subdirectory-test -> add-subdirectory-test for consistency 2016-02-10 07:01:40 -08:00
vitaut
70e44a8e7f Simplify locale mock 2016-02-09 11:31:04 -08:00
vitaut
b8c6192a61 Simplify build config and enable C++11 by default 2016-02-09 08:43:39 -08:00
Mario Werner
6a79a3279b build and test in c++11 and in c++98 mode 2016-02-07 18:23:02 +01:00
vitaut
1adee75e1c Check if -fno-delete-null-pointer-checks flag is supported 2016-02-04 08:36:41 -08:00
vitaut
a4b611a3d3 Workaround GTest bug 705 (#268) 2016-02-04 08:15:19 -08:00
vitaut
220bb764e5 Use quotes for local includes 2016-02-04 08:08:33 -08:00
Mario Werner
b09c83504e test for gnu++98 instead for c++98 because of mingw ... 2016-02-03 14:11:30 +01:00
Mario Werner
3133925ab2 Merge branch 'master' into update-project-layout
Conflicts:
	posix.h
2016-02-03 13:15:26 +01:00
Mario Werner
03b9485cb3 perform the slower tests only in PEDANTIC mode 2016-02-03 13:05:18 +01:00
Mario Werner
ded46cc1b6 build test-main library again to improve build time 2016-02-03 12:59:03 +01:00
Mario Werner
c1a4cd0fa7 check if cppformat is the master project or just used as dependency
Based on that information less intrusive option defaults are choosen.
Additionally, packaging support is omitted.
2016-02-03 11:20:19 +01:00
Mario Werner
797d72133e restored smoke test for syntax compatibility with the 98 c++ standard 2016-02-03 10:01:53 +01:00
Mario Werner
e0e8f717a0 FMT_USE_FILE_DESCRIPTORS is apparently only needed for the tests 2016-02-03 09:14:32 +01:00
vitaut
cfb25b0e80 Use typedefs instead of macros 2016-02-02 22:06:54 -08:00
vitaut
e489f879c3 Add locale tests 2016-02-02 17:21:09 -08:00
Mario Werner
c0e926109e use the same warning options like before the PR
Additional notes on how to improve the current state have been added.
2016-02-02 17:14:51 +01:00
Mario Werner
b05a02b91c remove comment which is now superfluous since the code has been moved 2016-02-02 17:04:12 +01:00
Mario Werner
d411aa165e use quotes for including cppformat headers from the tests 2016-02-02 16:58:41 +01:00
Mario Werner
0a4acc9656 use the cmake and ctest to drive the appveyor build 2016-02-01 10:22:47 +01:00
Mario Werner
d3fe82c55b propagate the build type into the find test 2016-01-31 20:17:39 +01:00
Mario Werner
a659d8079e Merge branch 'master' into update-project-layout 2016-01-31 17:00:05 +01:00
Mario Werner
00fda9b25a add a test for the find script on the build directory 2016-01-31 00:02:49 +01:00
Mario Werner
4aeeb49d23 updated compile-test and include a working test
This makes sure that the test does not break due to other reasons.
2016-01-30 23:49:39 +01:00
Mario Werner
fee52f79b8 update the includes in the tests to get rid of the deprecated warnings 2016-01-30 22:33:37 +01:00
vitaut
95c0fb5075 Add a "C" numeric locale 2016-01-29 16:29:46 -08:00
Mario Werner
5e7ab2f4ea major cleanup of the test folders CMakeLists.txt
The new code does not rely on globally defined include directories
anymore. Additionally a lot of conditional code and has been removed
which improves readability a lot.
2016-01-29 16:21:17 +01:00
Mario Werner
b52d0bd9d4 define cppformat cmake targets with proper interface definitions 2016-01-29 13:23:08 +01:00
Mario Werner
0fb474be3a outlined the compiler feature tests to improve script readability 2016-01-29 13:03:47 +01:00
Mario Werner
3019a8c1fd moved code into cppformat subdirectory
Proxy headers have been placed into the project root to emit
deprecation warnings.
2016-01-29 12:49:35 +01:00
vitaut
7ee287d3d9 Sign extend arguments of smaller types passed to %ll? (#265) 2016-01-27 07:03:19 -08:00
vitaut
8474a6232d Don't perform narrowing conversion for integers in printf (#255) 2016-01-24 00:43:42 +01:00
Mario Werner
ef7bbfff87 removed workaround for cmake versions prior to 2.8.10 2016-01-13 09:54:02 +01:00
vitaut
97e9ed11bc Set interface include dir for gmock 2016-01-09 08:07:31 -08:00
vitaut
f55bf55d43 Correct comment 2016-01-09 08:06:59 -08:00
Nicholas Hutchinson
1a5a1708b7 Add fprintf overload that writes to a std::ostream
For completeness, add an overload for printf that takes a std::ostream.
2015-12-23 15:59:13 +13:00
vitaut
1cba0aea27 Simplify CMake config and do minor adjustments
for consistency with used coding conventions.
2015-12-10 07:24:23 -08:00
Maciej Dems
c47318afa8 Declarations for shared library in Windows.
Added __declspec(dllimport) and __declspec(dllexport) declarations
when compiled in Windows.
2015-12-10 13:36:18 +01:00
vitaut
e7f4566dd4 Replace <algorithm> with <memory>
~20% faster compile time on bloat-test
2015-12-04 22:57:36 -08:00
vitaut
0ea73df717 Merge branch 'custom-formatter' 2015-12-04 07:24:09 -08:00
vitaut
aa7bb101ed Undefine fileno if defined in posix-test 2015-12-03 20:17:04 -08:00
vitaut
6ced4230f4 Initial support for custom formatters 2015-12-02 08:41:05 -08:00
vitaut
b8bd80ff28 Fix handling of empty non-null-terminated strings 2015-11-25 09:49:01 -08:00
vitaut
6cff6d8137 Use overloaded operator<< for enums if available (#232) 2015-11-24 08:18:19 -08:00
vitaut
1a2a333a1a Use format specifiers when formatting null pointers & strings 2015-11-23 21:01:28 -08:00
vitaut
8beadace37 Improve detection of isinf, isnan and getsign 2015-11-21 07:20:18 -08:00
vitaut
9c03176e6b Fix util-test 2015-11-13 15:16:10 -08:00
vitaut
2157375d5c Use textual formatting for bool with %s specifier in printf (#224) 2015-11-13 07:18:44 -08:00
vitaut
57ba9436a0 Format null string as (nil) with p specifier 2015-11-12 06:09:08 -08:00
vitaut
b5fda1c90d Format null pointer as (nil) and null string as (null) in printf (#226) 2015-11-11 07:57:19 -08:00
vitaut
d6d019aa12 Don't assume that StringRef::compare returns +/-1 2015-11-11 06:44:57 -08:00
vitaut
aa741bafe6 Don't assume that char_traits::compare returns +/-1 (#225) 2015-11-10 06:40:20 -08:00
vitaut
8b86a74ad5 Allow formatting C strings as pointers (#223) 2015-11-09 07:17:36 -08:00
vitaut
7c24973637 Format (un)signed char as integer by default (#217) 2015-11-05 20:46:22 -05:00
vitaut
2d727e7d0e Suppress bogus coverity warnings 2015-10-28 07:01:28 -07:00
vitaut
ae48a4c6f9 Add missing include 2015-10-22 08:56:52 -07:00
vitaut
f080b62047 Implement StringRef comparison operators
and use lexicographical comparison (#183)
2015-10-22 08:41:42 -07:00
vitaut
fb27723a9f Try fixing bogus coverity warnings, take n 2015-10-22 07:33:01 -07:00
vitaut
b64913b00b Suppress bogus coverity warnings 2015-10-22 05:58:37 -07:00
vitaut
ecbfdb46d3 Fix sanitize 2015-10-21 10:39:58 -07:00
vitaut
23e84472b2 Hook Coverity model file 2015-10-21 08:45:48 -07:00
vitaut
ab25cd2c8b Suppress a bogus coverity warning 2015-10-21 08:30:10 -07:00
vitaut
13e0e38d99 Workaround a bogus coverity warning 2015-10-21 07:17:48 -07:00
vitaut
cd097d334e Workaround bogus coverity warnings 2015-10-21 06:16:55 -07:00
vitaut
c684886dfc Make coverity happy 2015-10-20 08:29:41 -07:00
vitaut
221dd0cb66 Try workaround for a bogus Coverity warning 2015-10-20 07:22:38 -07:00
vitaut
d25d775ae6 Suppress bogus coverity warnings 2015-10-20 06:26:31 -07:00
vitaut
5a648b300f Suppress another bogus warning in Coverity 2015-10-19 08:39:31 -07:00
vitaut
85a93a8078 Suppress another bogus warning in Coverity 2015-10-19 08:25:30 -07:00
vitaut
56d3b9135f Try a workaround for a bogus Coverity warning 2015-10-19 08:17:05 -07:00
vitaut
e81c0aef39 Fix bogus coverity warnings. 2015-10-18 09:16:10 -07:00
vitaut
b2714f83cc FMT_NO_STREAM_LIBRARIES -> FMT_USE_IOSTREAMS
for consistency with similar macros and removed unnecessary
checks.
2015-10-18 08:50:35 -07:00
Richard Maxwell
2cca51c744 Issue 205: Make iostream support optional. 2015-10-16 08:04:53 +13:00
Dean Moldovan
c0813c59f3 Work around UDL macro stringification bug on some versions of GCC
See bug report: https://gcc.gnu.org/ml/gcc-bugs/2015-04/msg02027.html
2015-10-09 11:55:36 +02:00
Dean Moldovan
bc6010cc21 Add _a literal for named arguments 2015-09-27 04:09:37 +02:00
Dean Moldovan
a63a24f2d7 Add _format literal 2015-09-27 04:00:24 +02:00
vitaut
ef710dee6c Add sprintf overload for wide strings
and fix an issue in formatting user-defined objects.
Thanks to @ScottLangham
2015-09-18 16:26:41 -07:00
vitaut
79d8f59906 Implement formatting of objects with (s)printf. 2015-09-08 08:36:20 -07:00
vitaut
b3714625c0 Fix compilation with FMT_PEDANTIC=ON 2015-08-19 08:03:17 -07:00
vitaut
1bba22667e Fix build on CMake 2.6 2015-08-19 07:32:48 -07:00
vitaut
4274f15f0d Move test-specific stuff to test/CMakeLists.txt 2015-08-19 07:27:08 -07:00
vitaut
b247d81046 Fix warnings 2015-08-07 07:39:04 -07:00
vitaut
c3ba615c65 Fix warnings 2015-08-07 07:34:58 -07:00
vitaut
a8a2982b9a Fix test 2015-08-07 07:13:43 -07:00
vitaut
ca7478144d Fix warnings 2015-08-07 07:08:46 -07:00
vitaut
5b8d0a7aa9 Make Coverity happy 2015-08-04 07:22:03 -07:00
vitaut
7e12c5c9df Use scoped_ptr instead of raw pointers in tests 2015-07-31 08:54:54 -07:00
vitaut
d15e0d3e06 Use scoped_ptr instead of raw pointers in tests 2015-07-31 08:23:39 -07:00
vitaut
d02a5031f0 Use scoped_ptr instead of deprecated auto_ptr 2015-07-29 07:03:15 -07:00
vitaut
200037683e Initialize next_arg_index_ in ctor (#187) 2015-07-28 08:10:46 -07:00
vitaut
c4d0bc1ac9 Fix Coverity warnings 2015-07-28 07:18:14 -07:00
vitaut
6cf24c7f92 Fix MSVC warnings 2015-07-08 08:04:32 -07:00
vitaut
f3bef7ac92 Fix open_buffered_file 2015-07-08 07:48:54 -07:00
vitaut
b6c1c9233a Workaround an issue with VC2010 2015-07-08 07:36:36 -07:00
vitaut
c669cbedf8 Rename None to Null because of conflict with an xlib.h macro 2015-07-07 07:05:17 -07:00
vitaut
438bd9b0e6 Add BasicCStringRef to represent a null-termated string (#100)
and use it instead of BasicStringRef in cases that assume that the
string is null-terminated such as POSIX function and format string
parser.
2015-06-26 07:43:54 -07:00
vitaut
88c7c20102 Fix posix-test on FreeBSD (#179) 2015-06-25 07:06:30 -07:00
vitaut
5b9b485f57 Workaround a bug in MinGW 2015-06-24 11:36:28 -07:00
vitaut
0a7e5141c1 Move posix tests from gtest-extra-test to a separate test 2015-06-24 09:16:03 -07:00
vitaut
9769f4b9ed Refactor posix tests 2015-06-24 08:43:30 -07:00
vitaut
e5b16e80cc Include sys/types.h for ssize_t 2015-06-24 07:59:19 -07:00
vitaut
948317b6dd Fix FormatLongDouble test on PowerPC (#180) 2015-06-23 07:39:49 -07:00
vitaut
b88a17ad9e libformat.{a.so} -> libcppformat.{a.so}
as suggested by Eugene V. Lyubimkin to make the name less generic
2015-06-23 06:40:22 -07:00
vitaut
abcc2d96f0 Fix assertion tests 2015-06-22 09:24:54 -07:00