358 Commits

Author SHA1 Message Date
Franz Pöschel
1c3ee2857b Fix tests 2025-05-16 15:57:17 +02:00
Evan
924a6c5d50 Update test_get.cpp 2025-03-30 09:50:30 -07:00
ToruNiina
0d1a52c3db test: add toml::find for optinal<user-defined> 2025-03-26 23:55:34 +09:00
ToruNiina
5d78fc832d test: rm init_list ctor of char_either from test 2025-02-04 23:58:00 +09:00
ToruNiina
942eadef5c fix: guard access check funcs by macro 2025-01-30 00:35:36 +09:00
ToruNiina
46f009d25e feat: add test_accessed 2025-01-30 00:27:13 +09:00
Ken Matsui
4ceba3a8ce Implement find_or_default 2025-01-18 01:16:54 -05:00
ToruNiina
844e8fd4e0 fix(#279): fix compilation with older msvc
by avoiding known SFINAE problem in msvc 2017
2025-01-13 00:47:58 +09:00
ToruNiina
d13ca04041 test: add test_find<optional<T>> 2025-01-05 14:27:26 +09:00
ToruNiina
3498af032f test: add deeply nested example to find_or 2024-08-10 14:17:05 +09:00
Ken Matsui
6d4d953304 Support std::optional members for TOML11_DEFINE_CONVERSION_NON_INTRUSIVE 2024-07-23 10:03:58 -07:00
ToruNiina
098569a96d Merge branch 'main' into v4_1_0 2024-07-20 17:57:05 +09:00
xep
ce42e78e3c add test for template into_toml 2024-07-20 11:15:30 +08:00
ToruNiina
8434a6b18b Merge branch 'u8string' into v4_1_0 2024-07-18 01:03:58 +09:00
ToruNiina
5e05b75473 test: add u8string constructor 2024-07-17 01:04:10 +09:00
ToruNiina
b68f1fd57f test: add case of get/find<u8string> 2024-07-16 01:03:19 +09:00
ToruNiina
d99f260c1a Merge branch 'origin/output-operator' into v4_1_0 2024-07-16 00:31:20 +09:00
ToruNiina
93503e9c59 fix: remove operator<<(basic_value) from test 2024-07-14 17:08:44 +09:00
ToruNiina
a69877005d test: check if uppercase is parsed 2024-07-14 15:14:01 +09:00
ToruNiina
452f1702c2 test: enable to output int_fmt.uppercase 2024-07-14 15:13:34 +09:00
ToruNiina
b63668c0dc chore: raise msvc warning level 2024-07-06 02:14:24 +09:00
ToruNiina
9e194ea8b6 chore: add -Werror and while compilation 2024-07-06 01:13:32 +09:00
ToruNiina
edbea2f483 Merge branch 'add-test-case' 2024-07-03 01:58:17 +09:00
ToruNiina
973ecee32d fix: add missing include file 2024-07-03 00:24:45 +09:00
ToruNiina
65e722da43 test: add minimum cases of serializer 2024-07-03 00:00:50 +09:00
ToruNiina
37d0391b9d test: add test to make error_info
check if it compiles
2024-07-02 23:35:16 +09:00
ToruNiina
3c09d3046c refactor: remove detail::(local|gm)time_s from fwd 2024-06-23 23:25:57 +09:00
ToruNiina
aa76604585 test: add (void) to not to discard v.value()
even if v is empty so value() never returns anything
2024-06-16 22:13:59 +09:00
ToruNiina
5638ea90b1 test: stop using std::gmtime in tests 2024-06-16 21:49:57 +09:00
ToruNiina
29f8517cf4 test: set precision if non-toml float is given
in toml-test encoder test, it passes a large integer with float type.
in that case, we used a std::stringstream, so no prec information is
stored.
2024-06-16 20:43:17 +09:00
ToruNiina
c5851db533 fix: do not use std::gmtime in tests 2024-06-16 19:30:35 +09:00
ToruNiina
3443f86a4a chore: use warning level 3 in msvc 2024-06-16 19:29:16 +09:00
ToruNiina
bb2542f2bf chore: remove debug flag fatal-errors from ci 2024-06-15 21:55:25 +09:00
ToruNiina
7789b4e8be feat: add json to tests/extlib 2024-06-15 19:19:12 +09:00
ToruNiina
e68e77320d feat: add doctest as a submodule 2024-06-15 19:15:09 +09:00
ToruNiina
3f9e3ce5d2 feat: update build system to v4 2024-06-15 19:14:44 +09:00
ToruNiina
c47ff10a64 test: update test codes to v4 2024-06-15 19:14:06 +09:00
ToruNiina
5e4eb52f84 fix: add cxx_std to check_cxx_source_compiles
in macos, default version is 98 and it fails to compile boost test.
ci fails in the test branch because of apt timeout, but osx jobs works.
2024-06-11 23:47:49 +09:00
ToruNiina
2466959cf9 chore: avoid false-positive ref life warning 2024-03-20 22:42:00 +09:00
ToruNiina
64cd90637b refactor: move cmake component to where it's used 2024-03-20 22:35:03 +09:00
ToruNiina
db72451bcf test: update test to add rec start val 2024-01-04 20:47:46 +09:00
ToruNiina
da3d5153d1 ci: install language pack to test locale 2023-05-28 23:37:53 +09:00
ToruNiina
af13c2867a test: add test case for serializer with locale 2023-05-28 18:47:06 +09:00
ToruNiina
fd969a679b test: check if a large bin ints are parsed 2023-02-12 19:03:59 +09:00
Moritz Klammler
3f197c3cab Fix use-after-move in test_parse_function_compiles and refactor
My recent patch had introduced a conditional use-after-move bug into the
test_parse_function_compiles function.  This patch fixes that by
reworking the entire test case into a compile-time check.  In my
opinion, we're not loosing anything by not actually executing the code
(the result wasn't looked at anyway) and the code becomes much clearer
by omitting the argument-preparation fluff.
2022-09-29 19:22:25 +02:00
Moritz Klammler
e86d7c3cd3 Remove excess blank lines at end of file 2022-09-29 19:02:52 +02:00
Moritz Klammler
10fd14f8b9 Consistent unit test header inclusion order
This patch consistently changes the inclusion order for unit test files
to the following:

 1. The header of the unit under test (using <> includes).
 2. The unit_test.hpp header (using "" includes).
 3. Any additional auxiliary test headers (using "" includes and sorted alphabetically).
 4. Additional system headers needed for the test (using <> includes and sorted alphabetically).
 5. Conditionally included system headers (using <> includes).

Putting the unit under test's header at the very beginning has the
advantage of also testing that the header is self-contained.  It also
makes it very quick to tell what unit is tested in this file.
2022-09-29 19:02:52 +02:00
Moritz Klammler
81c5ba9082 Define BOOST_TEST_MODULE in CMake
This removes one #define from each unit test file and ensures
consistency between file and module names.  This consistency, was not
strictly maintained before.  I hope that any discrepancies were
unintentional and that a 1:1 mapping is actually what is desired.

Since the definition is now done at one single place, it would be easy
to apply transformations like removing the 'test_' prefix or replacing
'_' with '-' if this should be desired.
2022-09-29 19:02:52 +02:00
Moritz Klammler
d7c04ed5ee Factor redundant test boilerplate out into unit_test.hpp helper 2022-09-29 19:02:52 +02:00
Moritz Klammler
b10348c576 More flexible https://github.com/toml-lang/toml handling
Instead of unconditionally attempting to clone from a fixed location
(GitHub) during the build / test process, honor the following two
configuration variables:

  TOML11_LANGSPEC_GIT_REPOSITORY
    Can be set to override the URL from which the repository is cloned.
    This allows using a local mirror, including file:// URLs for working
    offline or reducing network traffic.

  TOML11_LANGSPEC_SOURCE_DIR
    Can be set to configure the location at which the repository is
    expected.  If it already exists no download will be attempted.  This
    allows avoiding the additional git-clone(1) altogether and use an
    existing directory as-is.  This offers two new possibilities:
    (1) The same checkout can be reused for building multiple
    configurations (e.g. Debug versus Release) saving a little bit of
    time and disk space.
    (2) Experimental changes can easily be applied to the local source
    tree without having them destroyed by the build process.

In order for this flexible location to work, the unit tests which
attempt to read files from the repository had to be adjusted.  They now
honor an environment variable TOMLDIR which can be set to point to an
alternate root directory.

All defaults are set such that the previous behavior is maintained.

Instead of introducing the TOMLDIR environment variable, an alternative
solution would have been to set the WORKING_DIRECTORY of the tests to
the TOML11_LANGSPEC_SOURCE_DIR and leave the relative paths in these
tests hard-coded.  Alas, some tests also expect that they can /write/
into the current working directory which isn't desirable if it is
potentially pointing outside the build tree.  I personally prefer to
mount the source directory read-only and build in a fast tempfs, so this
would e a problem.  To be perfectly honest, I don't quite understand why
these tests need to write to the file system in the first place, though.
It seems to me that refactoring them to serialize to a std::ostrstream
instead of a std::ofstream would not only simplify but also speed up the
unit tests and avoid file system problems.  But there might have been a
hidden reason why actually using the real file system was considered
necessary for these tests, so I didn't went ahead with that change yet.
2022-09-29 19:02:52 +02:00