Skip to content

Commit

Permalink
added tests for visit()
Browse files Browse the repository at this point in the history
Also some minor refactors.
  • Loading branch information
marzer committed Apr 23, 2022
1 parent af637f7 commit db04ac8
Show file tree
Hide file tree
Showing 44 changed files with 244 additions and 15 deletions.
48 changes: 48 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ template:
- Meson: Use system dependencies where available when building tests (@Tachi107)


<br><br>


## [v3.0.1](https://github.com/marzer/tomlplusplus/releases/tag/v3.0.1) - 2022-01-13

Expand All @@ -47,6 +49,8 @@ this release holds nothing of value over v3.0.0.
- fixed erroneous use of `TOML_API` causing ODR issue (#136) (@Azarael)


<br><br>


## [v3.0.0](https://github.com/marzer/tomlplusplus/releases/tag/v3.0.0) - 2022-01-11

Expand Down Expand Up @@ -137,6 +141,8 @@ Any changes that are likely to cause migration issues (API changes, build system
- used `override_dependency` where supported (#116) (@Tachi107)


<br><br>


## [v2.5.0](https://github.com/marzer/tomlplusplus/releases/tag/v2.5.0) - 2021-07-11

Expand All @@ -158,6 +164,8 @@ Any changes that are likely to cause migration issues (API changes, build system
- updated conformance tests


<br><br>


## [v2.4.0](https://github.com/marzer/tomlplusplus/releases/tag/v2.4.0) - 2021-05-19

Expand Down Expand Up @@ -186,6 +194,8 @@ Any changes that are likely to cause migration issues (API changes, build system
- removed explicit `#include <fstream>` requirement for `parse_file()`


<br><br>


## [v2.3.0](https://github.com/marzer/tomlplusplus/releases/tag/v2.3.0) - 2020-12-29

Expand All @@ -202,6 +212,8 @@ Any changes that are likely to cause migration issues (API changes, build system
- fixed some parser crashes when given pathologically-malformed UTF-8 (#65) (@sneves)


<br><br>


## [v2.2.0](https://github.com/marzer/tomlplusplus/releases/tag/v2.2.0) - 2020-08-09

Expand Down Expand Up @@ -230,6 +242,8 @@ Any changes that are likely to cause migration issues (API changes, build system
- bumped minimum meson version to 0.53


<br><br>


## [v2.1.0](https://github.com/marzer/tomlplusplus/releases/tag/v2.1.0) - 2020-07-11

Expand Down Expand Up @@ -257,6 +271,8 @@ Any changes that are likely to cause migration issues (API changes, build system
- general cleanup


<br><br>


## [v2.0.0](https://github.com/marzer/tomlplusplus/releases/tag/v2.0.0) - 2020-07-20

Expand Down Expand Up @@ -300,6 +316,8 @@ break (hence the version number bump). Changes that might block a migration are
-&#xFE0F; removed `TOML_CHAR_8_STRINGS` since it no longer makes sense


<br><br>


## [v1.3.3](https://github.com/marzer/tomlplusplus/releases/tag/v1.3.3) - 2020-06-29

Expand All @@ -320,6 +338,8 @@ break (hence the version number bump). Changes that might block a migration are
- refactored the parser to reduce binary size


<br><br>


## [v1.3.2](https://github.com/marzer/tomlplusplus/releases/tag/v1.3.2) - 2020-06-19

Expand All @@ -334,6 +354,8 @@ break (hence the version number bump). Changes that might block a migration are
- improved the performance of printing to streams for deepy-nested TOML data


<br><br>


## [v1.3.0](https://github.com/marzer/tomlplusplus/releases/tag/v1.3.0) - 2020-06-02

Expand All @@ -353,6 +375,8 @@ break (hence the version number bump). Changes that might block a migration are
- renamed table iterator proxy pair members to `first` and `second` to match STL


<br><br>


## [v1.2.5](https://github.com/marzer/tomlplusplus/releases/tag/v1.2.5) - 2020-04-24

Expand All @@ -372,6 +396,8 @@ break (hence the version number bump). Changes that might block a migration are
- improved unicode-related codegen


<br><br>


## [v1.2.3](https://github.com/marzer/tomlplusplus/releases/tag/v1.2.3) - 2020-04-11

Expand All @@ -393,6 +419,8 @@ break (hence the version number bump). Changes that might block a migration are
- refactored and greatly simplified parser


<br><br>


## [v1.2.0](https://github.com/marzer/tomlplusplus/releases/tag/v1.2.0) - 2020-04-07

Expand All @@ -410,6 +438,8 @@ break (hence the version number bump). Changes that might block a migration are
- added many new tests


<br><br>


## [v1.1.0](https://github.com/marzer/tomlplusplus/releases/tag/v1.1.0) - 2020-04-03

Expand All @@ -427,6 +457,8 @@ break (hence the version number bump). Changes that might block a migration are
- added the array and table iterators to the `toml` namespace


<br><br>


## [v1.0.0](https://github.com/marzer/tomlplusplus/releases/tag/1.0.0) - 2020-03-28

Expand All @@ -437,6 +469,8 @@ break (hence the version number bump). Changes that might block a migration are
- refactoring of ABI-based inline namespaces


<br><br>


## [v0.6.0](https://github.com/marzer/tomlplusplus/releases/tag/v0.6.0) - 2020-03-24

Expand All @@ -449,6 +483,8 @@ break (hence the version number bump). Changes that might block a migration are
- added Clang's `[[trivial_abi]]` attribute to `date`, `time`, `time_offset`


<br><br>


## [v0.5.0](https://github.com/marzer/tomlplusplus/releases/tag/v0.5.0) - 2020-03-18

Expand All @@ -467,6 +503,8 @@ break (hence the version number bump). Changes that might block a migration are
- added build configuration option for compiling examples


<br><br>


## [v0.4.3](https://github.com/marzer/tomlplusplus/releases/tag/v0.4.3) - 2020-03-10

Expand All @@ -480,6 +518,8 @@ break (hence the version number bump). Changes that might block a migration are
- parsing performance improvements


<br><br>


## [v0.4.0](https://github.com/marzer/tomlplusplus/releases/tag/v0.4.0) - 2020-03-05

Expand All @@ -494,6 +534,8 @@ break (hence the version number bump). Changes that might block a migration are
- added `node::ref()` and `node_view::ref()`


<br><br>


## [v0.3.0](https://github.com/marzer/tomlplusplus/releases/tag/v0.3.0) - 2020-03-01

Expand All @@ -512,6 +554,8 @@ break (hence the version number bump). Changes that might block a migration are
- removed `<cmath>` dependency


<br><br>


## [v0.2.1](https://github.com/marzer/tomlplusplus/releases/tag/v0.2.1) - 2020-02-26

Expand All @@ -526,6 +570,8 @@ break (hence the version number bump). Changes that might block a migration are
- improved quality of error messages for boolean and inf/nan parsing


<br><br>


## [v0.2.0](https://github.com/marzer/tomlplusplus/releases/tag/v0.2.0) - 2020-02-23

Expand All @@ -543,6 +589,8 @@ break (hence the version number bump). Changes that might block a migration are
- added hexfloat parsing support for all implementations (not just `<charconv>` ones)


<br><br>


## [v0.1.0](https://github.com/marzer/tomlplusplus/releases/tag/v0.1.0) - 2020-02-20

Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ cd build-gcc-debug && ninja && ninja test \
&& cd ..
```

> &#xFE0F; Note: To ensure parity between single-header and regular versions of the library, 50% of the tests
will be compiled using one, and 50% with the other. Ensure you've regenerated toml.hpp before running tests.

<br>

## Testing with the [toml-test] suite
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![C++20](docs/images/badge-C++20.svg)][cpp_compilers]
[![TOML](docs/images/badge-TOML.svg)][v1.0.0]
[![MIT license](docs/images/badge-license-MIT.svg)](./LICENSE)
[![ci](https://github.com/marzer/tomlplusplus/actions/workflows/ci.yaml/badge.svg)](https://github.com/marzer/tomlplusplus/actions/workflows/ci.yaml)
[![ci](https://github.com/marzer/tomlplusplus/actions/workflows/ci.yaml/badge.svg?branch=master)](https://github.com/marzer/tomlplusplus/actions/workflows/ci.yaml)
[![Mentioned in Awesome C++](docs/images/badge-awesome.svg)](https://github.com/fffaraz/awesome-cpp)
====

Expand Down
6 changes: 3 additions & 3 deletions docs/poxy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ string_literals = [ '_toml' ]
'badge-TOML.svg',
'https://toml.io/en/v1.0.0'
]
'3. CircleCI' = [
'https://img.shields.io/circleci/build/github/marzer/tomlplusplus?label=circle%20ci&logo=circleci&logoColor=white&style=flat-square',
'https://circleci.com/gh/marzer/tomlplusplus'
'3. CI' = [
'https://github.com/marzer/tomlplusplus/actions/workflows/ci.yaml/badge.svg?branch=master',
'https://github.com/marzer/tomlplusplus/actions/workflows/ci.yaml'
]
'4. Mentioned in Awesome C++' = [
'badge-awesome.svg',
Expand Down
4 changes: 0 additions & 4 deletions include/toml++/impl/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -797,10 +797,6 @@ TOML_NAMESPACE_START
template <typename A, typename B>
using nonvoid = std::conditional_t<std::is_void_v<A>, B, A>;

//# these functions are static helpers to preserve const and ref categories
//# (otherwise I'd have to implement them thrice)
//# ((propagation in C++: a modern horror story))

template <typename N, typename Func>
static decltype(auto) do_visit(N&& n, Func&& visitor) noexcept(visit_is_nothrow<Func&&, N&&>)
{
Expand Down
10 changes: 7 additions & 3 deletions include/toml++/impl/node_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ TOML_NAMESPACE_START

mutable viewed_type* node_ = nullptr;

template <typename Func>
static constexpr bool visit_is_nothrow = noexcept(std::declval<viewed_type*>()->visit(std::declval<Func&&>()));

public:
/// \brief Constructs an empty node view.
TOML_NODISCARD_CTOR
Expand Down Expand Up @@ -567,6 +564,13 @@ TOML_NAMESPACE_START
/// \name Visitation
/// @{

private:
/// \cond
template <typename Func>
static constexpr bool visit_is_nothrow = noexcept(std::declval<viewed_type*>()->visit(std::declval<Func&&>()));
/// \endcond

public:
/// \brief Invokes a visitor on the viewed node based on its concrete type.
///
/// \remarks Has no effect if the view does not reference a node.
Expand Down
1 change: 1 addition & 0 deletions include/toml++/impl/preprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@
_Pragma("GCC diagnostic ignored \"-Wsubobject-linkage\"") \
_Pragma("GCC diagnostic ignored \"-Wmissing-field-initializers\"") \
_Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") \
_Pragma("GCC diagnostic ignored \"-Wnoexcept\"") \
static_assert(true)

#define TOML_POP_WARNINGS \
Expand Down
1 change: 0 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ if is_gcc
'-Wmissing-format-attribute',
'-Wmissing-include-dirs',
'-Wmissing-noreturn',
'-Wnoexcept',
'-Wold-style-cast',
'-Woverloaded-virtual',
'-Wpacked',
Expand Down
1 change: 1 addition & 0 deletions tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ test_sources = [
'manipulating_arrays.cpp',
'manipulating_tables.cpp',
'manipulating_values.cpp',
'visit.cpp',
'user_feedback.cpp',
'using_iterators.cpp',
'windows_compat.cpp'
Expand Down
Loading

0 comments on commit db04ac8

Please sign in to comment.