From 81309782f155512af53a3ded50a41fbe8138f84d Mon Sep 17 00:00:00 2001 From: Jamie Reece Wilson Date: Sun, 21 Jan 2024 01:25:26 +0000 Subject: [PATCH] [-] known botnet and malware --- .github/FUNDING.yml | 1 - .github/ISSUE_TEMPLATE/bug_report.md | 98 - .github/ISSUE_TEMPLATE/config.yml | 1 - .github/ISSUE_TEMPLATE/feature_request.md | 38 - .github/ISSUE_TEMPLATE/spec_bug_report.md | 55 - .github/pull_request_template.md | 38 - .github/workflows/ci.yaml | 191 - .github/workflows/cifuzz.yml | 39 - .github/workflows/gh-pages.yaml | 42 - .runsettings | 20 - .tipi/deps | 3 - Aurora.json | 11 + CMakeLists.txt | 44 - CODE_OF_CONDUCT.md | 76 - CONTRIBUTING.md | 80 - cmake/install-rules.cmake | 52 - cmake/project-is-top-level.cmake | 6 - cmake/tomlplusplusConfig.cmake | 1 - cmake/tomlplusplusConfig.cmake.meson.in | 29 - .../tomlplusplusConfigVersion.cmake.meson.in | 48 - cmake/variables.cmake | 18 - cpp.hint | 39 - fuzzing/CMakeLists.txt | 31 - fuzzing/build.sh | 8 - fuzzing/toml_fuzzer.cpp | 41 - include/meson.build | 52 - meson.build | 207 - meson_options.txt | 14 - src/meson.build | 88 - src/toml.cpp | 13 - tests/at_path.cpp | 119 - tests/conformance_burntsushi_invalid.cpp | 2022 -- tests/conformance_burntsushi_valid.cpp | 4734 ---- tests/conformance_iarna_invalid.cpp | 451 - tests/conformance_iarna_valid.cpp | 2210 -- tests/cpp.hint | 1 - tests/for_each.cpp | 380 - tests/formatters.cpp | 332 - tests/impl_toml.cpp | 407 - tests/leakproof.hpp | 19 - tests/lib_catch2.hpp | 44 - tests/main.cpp | 98 - tests/manipulating_arrays.cpp | 629 - tests/manipulating_parse_result.cpp | 115 - tests/manipulating_tables.cpp | 672 - tests/manipulating_values.cpp | 590 - tests/meson.build | 106 - tests/odr_test_1.cpp | 9 - tests/odr_test_2.cpp | 2 - tests/parsing_arrays.cpp | 181 - tests/parsing_booleans.cpp | 32 - tests/parsing_comments.cpp | 110 - tests/parsing_dates_and_times.cpp | 174 - tests/parsing_floats.cpp | 242 - tests/parsing_integers.cpp | 177 - tests/parsing_key_value_pairs.cpp | 399 - tests/parsing_spec_example.cpp | 92 - tests/parsing_strings.cpp | 211 - tests/parsing_tables.cpp | 595 - tests/path.cpp | 592 - tests/settings.hpp | 98 - tests/tests.cpp | 230 - tests/tests.hpp | 410 - tests/user_feedback.cpp | 447 - tests/using_iterators.cpp | 52 - tests/visit.cpp | 139 - tests/vs/odr_test.vcxproj | 82 - tests/vs/test_debug_x64.vcxproj | 127 - tests/vs/test_debug_x64_cpplatest.vcxproj | 127 - .../test_debug_x64_cpplatest_noexcept.vcxproj | 127 - ...debug_x64_cpplatest_noexcept_unrel.vcxproj | 127 - .../vs/test_debug_x64_cpplatest_unrel.vcxproj | 127 - tests/vs/test_debug_x64_noexcept.vcxproj | 127 - .../vs/test_debug_x64_noexcept_unrel.vcxproj | 127 - tests/vs/test_debug_x64_unrel.vcxproj | 127 - tests/vs/test_debug_x86.vcxproj | 127 - tests/vs/test_debug_x86_cpplatest.vcxproj | 127 - .../test_debug_x86_cpplatest_noexcept.vcxproj | 127 - ...debug_x86_cpplatest_noexcept_unrel.vcxproj | 127 - .../vs/test_debug_x86_cpplatest_unrel.vcxproj | 127 - tests/vs/test_debug_x86_noexcept.vcxproj | 127 - .../vs/test_debug_x86_noexcept_unrel.vcxproj | 127 - tests/vs/test_debug_x86_unrel.vcxproj | 127 - tests/vs/test_release_x64.vcxproj | 127 - tests/vs/test_release_x64_cpplatest.vcxproj | 127 - ...est_release_x64_cpplatest_noexcept.vcxproj | 127 - ...lease_x64_cpplatest_noexcept_unrel.vcxproj | 127 - .../test_release_x64_cpplatest_unrel.vcxproj | 127 - tests/vs/test_release_x64_noexcept.vcxproj | 127 - .../test_release_x64_noexcept_unrel.vcxproj | 127 - tests/vs/test_release_x64_unrel.vcxproj | 127 - tests/vs/test_release_x86.vcxproj | 127 - tests/vs/test_release_x86_cpplatest.vcxproj | 127 - ...est_release_x86_cpplatest_noexcept.vcxproj | 127 - ...lease_x86_cpplatest_noexcept_unrel.vcxproj | 127 - .../test_release_x86_cpplatest_unrel.vcxproj | 127 - tests/vs/test_release_x86_noexcept.vcxproj | 127 - .../test_release_x86_noexcept_unrel.vcxproj | 127 - tests/vs/test_release_x86_unrel.vcxproj | 127 - tests/windows_compat.cpp | 97 - toml++.code-workspace | 101 - toml++.natvis | 148 - toml++.props | 207 - toml++.sln | 318 - toml++.vcxproj | 143 - toml++.vcxproj.filters | 303 - toml-test/README.md | 52 - toml-test/meson.build | 34 - toml-test/tt.hpp | 43 - toml-test/tt_decoder.cpp | 113 - toml-test/tt_decoder.vcxproj | 59 - toml-test/tt_encoder.cpp | 214 - toml-test/tt_encoder.vcxproj | 59 - tools/ci_single_header_check.py | 31 - tools/clang_format.bat | 41 - tools/generate_conformance_tests.py | 635 - tools/generate_single_header.bat | 19 - tools/generate_single_header.py | 262 - tools/generate_windows_test_targets.py | 181 - tools/requirements.txt | 4 - tools/utils.py | 55 - tools/version.py | 68 - vendor/README.md | 7 - vendor/catch.hpp | 17976 ------------ vendor/json.hpp | 23352 ---------------- 125 files changed, 11 insertions(+), 67162 deletions(-) delete mode 100644 .github/FUNDING.yml delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/config.yml delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md delete mode 100644 .github/ISSUE_TEMPLATE/spec_bug_report.md delete mode 100644 .github/pull_request_template.md delete mode 100644 .github/workflows/ci.yaml delete mode 100644 .github/workflows/cifuzz.yml delete mode 100644 .github/workflows/gh-pages.yaml delete mode 100644 .runsettings delete mode 100644 .tipi/deps create mode 100644 Aurora.json delete mode 100644 CMakeLists.txt delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 cmake/install-rules.cmake delete mode 100644 cmake/project-is-top-level.cmake delete mode 100644 cmake/tomlplusplusConfig.cmake delete mode 100644 cmake/tomlplusplusConfig.cmake.meson.in delete mode 100644 cmake/tomlplusplusConfigVersion.cmake.meson.in delete mode 100644 cmake/variables.cmake delete mode 100644 cpp.hint delete mode 100644 fuzzing/CMakeLists.txt delete mode 100755 fuzzing/build.sh delete mode 100644 fuzzing/toml_fuzzer.cpp delete mode 100644 include/meson.build delete mode 100644 meson.build delete mode 100644 meson_options.txt delete mode 100644 src/meson.build delete mode 100644 src/toml.cpp delete mode 100644 tests/at_path.cpp delete mode 100644 tests/conformance_burntsushi_invalid.cpp delete mode 100644 tests/conformance_burntsushi_valid.cpp delete mode 100644 tests/conformance_iarna_invalid.cpp delete mode 100644 tests/conformance_iarna_valid.cpp delete mode 100644 tests/cpp.hint delete mode 100644 tests/for_each.cpp delete mode 100644 tests/formatters.cpp delete mode 100644 tests/impl_toml.cpp delete mode 100644 tests/leakproof.hpp delete mode 100644 tests/lib_catch2.hpp delete mode 100644 tests/main.cpp delete mode 100644 tests/manipulating_arrays.cpp delete mode 100644 tests/manipulating_parse_result.cpp delete mode 100644 tests/manipulating_tables.cpp delete mode 100644 tests/manipulating_values.cpp delete mode 100644 tests/meson.build delete mode 100644 tests/odr_test_1.cpp delete mode 100644 tests/odr_test_2.cpp delete mode 100644 tests/parsing_arrays.cpp delete mode 100644 tests/parsing_booleans.cpp delete mode 100644 tests/parsing_comments.cpp delete mode 100644 tests/parsing_dates_and_times.cpp delete mode 100644 tests/parsing_floats.cpp delete mode 100644 tests/parsing_integers.cpp delete mode 100644 tests/parsing_key_value_pairs.cpp delete mode 100644 tests/parsing_spec_example.cpp delete mode 100644 tests/parsing_strings.cpp delete mode 100644 tests/parsing_tables.cpp delete mode 100644 tests/path.cpp delete mode 100644 tests/settings.hpp delete mode 100644 tests/tests.cpp delete mode 100644 tests/tests.hpp delete mode 100644 tests/user_feedback.cpp delete mode 100644 tests/using_iterators.cpp delete mode 100644 tests/visit.cpp delete mode 100644 tests/vs/odr_test.vcxproj delete mode 100644 tests/vs/test_debug_x64.vcxproj delete mode 100644 tests/vs/test_debug_x64_cpplatest.vcxproj delete mode 100644 tests/vs/test_debug_x64_cpplatest_noexcept.vcxproj delete mode 100644 tests/vs/test_debug_x64_cpplatest_noexcept_unrel.vcxproj delete mode 100644 tests/vs/test_debug_x64_cpplatest_unrel.vcxproj delete mode 100644 tests/vs/test_debug_x64_noexcept.vcxproj delete mode 100644 tests/vs/test_debug_x64_noexcept_unrel.vcxproj delete mode 100644 tests/vs/test_debug_x64_unrel.vcxproj delete mode 100644 tests/vs/test_debug_x86.vcxproj delete mode 100644 tests/vs/test_debug_x86_cpplatest.vcxproj delete mode 100644 tests/vs/test_debug_x86_cpplatest_noexcept.vcxproj delete mode 100644 tests/vs/test_debug_x86_cpplatest_noexcept_unrel.vcxproj delete mode 100644 tests/vs/test_debug_x86_cpplatest_unrel.vcxproj delete mode 100644 tests/vs/test_debug_x86_noexcept.vcxproj delete mode 100644 tests/vs/test_debug_x86_noexcept_unrel.vcxproj delete mode 100644 tests/vs/test_debug_x86_unrel.vcxproj delete mode 100644 tests/vs/test_release_x64.vcxproj delete mode 100644 tests/vs/test_release_x64_cpplatest.vcxproj delete mode 100644 tests/vs/test_release_x64_cpplatest_noexcept.vcxproj delete mode 100644 tests/vs/test_release_x64_cpplatest_noexcept_unrel.vcxproj delete mode 100644 tests/vs/test_release_x64_cpplatest_unrel.vcxproj delete mode 100644 tests/vs/test_release_x64_noexcept.vcxproj delete mode 100644 tests/vs/test_release_x64_noexcept_unrel.vcxproj delete mode 100644 tests/vs/test_release_x64_unrel.vcxproj delete mode 100644 tests/vs/test_release_x86.vcxproj delete mode 100644 tests/vs/test_release_x86_cpplatest.vcxproj delete mode 100644 tests/vs/test_release_x86_cpplatest_noexcept.vcxproj delete mode 100644 tests/vs/test_release_x86_cpplatest_noexcept_unrel.vcxproj delete mode 100644 tests/vs/test_release_x86_cpplatest_unrel.vcxproj delete mode 100644 tests/vs/test_release_x86_noexcept.vcxproj delete mode 100644 tests/vs/test_release_x86_noexcept_unrel.vcxproj delete mode 100644 tests/vs/test_release_x86_unrel.vcxproj delete mode 100644 tests/windows_compat.cpp delete mode 100644 toml++.code-workspace delete mode 100644 toml++.natvis delete mode 100644 toml++.props delete mode 100644 toml++.sln delete mode 100644 toml++.vcxproj delete mode 100644 toml++.vcxproj.filters delete mode 100644 toml-test/README.md delete mode 100644 toml-test/meson.build delete mode 100644 toml-test/tt.hpp delete mode 100644 toml-test/tt_decoder.cpp delete mode 100644 toml-test/tt_decoder.vcxproj delete mode 100644 toml-test/tt_encoder.cpp delete mode 100644 toml-test/tt_encoder.vcxproj delete mode 100755 tools/ci_single_header_check.py delete mode 100644 tools/clang_format.bat delete mode 100755 tools/generate_conformance_tests.py delete mode 100644 tools/generate_single_header.bat delete mode 100755 tools/generate_single_header.py delete mode 100755 tools/generate_windows_test_targets.py delete mode 100644 tools/requirements.txt delete mode 100644 tools/utils.py delete mode 100644 tools/version.py delete mode 100644 vendor/README.md delete mode 100644 vendor/catch.hpp delete mode 100644 vendor/json.hpp diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index c1c954e..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -github: marzer diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 6b2709c..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -name: Bug report -about: Regular ol' bugs. -title: '' -labels: [ "bug" ] -assignees: marzer - ---- - - - - - -## Environment -**toml++ version and/or commit hash:** - - - -**Compiler:** - - - - -**C++ standard mode:** - - - - -**Target arch:** - - - - -**Library configuration overrides:** - - - - -**Relevant compilation flags:** - - - - -## Describe the bug - - - - -## Steps to reproduce (or a small repro code sample) - - - - -## Additional information - diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index 3ba13e0..0000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1 +0,0 @@ -blank_issues_enabled: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 76688cd..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -name: Feature request -about: Want to see something added or improved? Tell me all about it. -title: '' -labels: feature -assignees: marzer - ---- - - - - - -**Is your feature request related to a problem? Please describe.** - - - - -**Describe the solution you'd like** - - - - - -**Additional context** - diff --git a/.github/ISSUE_TEMPLATE/spec_bug_report.md b/.github/ISSUE_TEMPLATE/spec_bug_report.md deleted file mode 100644 index fbb3aea..0000000 --- a/.github/ISSUE_TEMPLATE/spec_bug_report.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -name: TOML spec conformance bug -about: Bugs relating to the library's TOML spec conformance (or lack thereof). -title: '' -labels: [ "bug", "TOML spec" ] -assignees: marzer - ---- - - - - -## The non-conforming TOML snippet -```toml - -# your TOML here - -``` - - -## What you expected - - - -## What you got - - - -## Environment -**toml++ version and/or commit hash:** - - -**Any other useful information:** - diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index 4632299..0000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,38 +0,0 @@ - - -**What does this change do?** - - - -**Is it related to an exisiting bug report or feature request?** - - - -**Pre-merge checklist** - - - -- [ ] I've read [CONTRIBUTING.md] -- [ ] I've rebased my changes against the current HEAD of `origin/master` (if necessary) -- [ ] I've added new test cases to verify my change -- [ ] I've regenerated toml.hpp ([how-to]) -- [ ] I've updated any affected documentation -- [ ] I've rebuilt and run the tests with at least one of: - - [ ] Clang 8 or higher - - [ ] GCC 8 or higher - - [ ] MSVC 19.20 (Visual Studio 2019) or higher -- [ ] I've added my name to the list of contributors in [README.md](https://github.com/marzer/tomlplusplus/blob/master/README.md) - -[CONTRIBUTING.md]: https://github.com/marzer/tomlplusplus/blob/master/CONTRIBUTING.md -[how-to]: https://github.com/marzer/tomlplusplus/blob/master/CONTRIBUTING.md#regenerating-tomlhpp -[README.md]: https://github.com/marzer/tomlplusplus/blob/master/README.md diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index 0469c07..0000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,191 +0,0 @@ -name: ci - -on: - push: - branches-ignore: - - "gh-pages" - paths: - - "**.h" - - "**.hpp" - - "**.cpp" - - "**.inl" - - "**.py" - - "**/meson.build" - - "**/workflows/**.yaml" - pull_request: - branches-ignore: - - "gh-pages" - paths: - - "**.h" - - "**.hpp" - - "**.cpp" - - "**.inl" - - "**.py" - - "**/meson.build" - - "**/workflows/**.yaml" - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -env: - clang_version: "14" - gcc_version: "11" - -jobs: - linux: - strategy: - fail-fast: false - matrix: - compiler: - - "clang" - - "gcc" - linker: - - "lld" - type: - - "debug" - - "release" - - runs-on: ubuntu-latest - - defaults: - run: - shell: bash - - steps: - - name: Install base dependencies - run: | - sudo apt -y update - sudo apt -y install --no-install-recommends git python3 python3-pip ninja-build libstdc++-${{ env.gcc_version }}-dev locales-all - - - uses: actions/checkout@v3 - - - name: Install python dependencies - run: | - sudo -H pip3 install --no-cache-dir --upgrade meson - sudo -H pip3 install --no-cache-dir --upgrade -r tools/requirements.txt - - - name: Check toml.hpp - run: | - cd tools - python3 ci_single_header_check.py - - - name: Install lld - if: ${{ startsWith(matrix.linker, 'lld') }} - run: | - sudo apt -y install --no-install-recommends lld-${{ env.clang_version }} - sudo update-alternatives --install /usr/bin/ld.lld ld.lld /usr/bin/ld.lld-${{ env.clang_version }} 1000 - - - name: Install clang - if: ${{ startsWith(matrix.compiler, 'clang') }} - run: | - sudo apt -y install --no-install-recommends clang-${{ env.clang_version }} - sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-${{ env.clang_version }} 1000 - sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-${{ env.clang_version }} 1000 - - - name: Install gcc - if: ${{ startsWith(matrix.compiler, 'gcc') }} - run: | - sudo apt -y install --no-install-recommends gcc-${{ env.gcc_version }} g++-${{ env.gcc_version }} - sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-${{ env.gcc_version }} 1000 - sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-${{ env.gcc_version }} 1000 - - - name: Configure locales - run: | - sudo locale-gen 'en_US.utf8' 'ja_JP.utf8' 'de_DE.utf8' 'it_IT.utf8' 'tr_TR.utf8' 'fi_FI.utf8' 'fr_FR.utf8' 'zh_CN.utf8' - - - name: Configure Meson - run: | - CXX=c++ CXX_LD=${{ matrix.linker }} meson setup build --buildtype=${{ matrix.type }} -Ddevel=true -Db_lto=false - - - name: Build - run: meson compile -C build - - - name: Test - run: meson test -C build --verbose - - windows: - strategy: - fail-fast: false - matrix: - type: - - "debug" - - "release" - - runs-on: windows-2022 - - defaults: - run: - shell: cmd - - steps: - - name: Install dependencies - run: | - python3 -m pip install -U pip - pip3 install meson ninja - - - uses: actions/checkout@v3 - - - uses: ilammy/msvc-dev-cmd@v1 - - - name: Configure Meson - run: meson setup build --vsenv --buildtype=${{ matrix.type }} -Ddevel=true -Db_lto=false - - - name: Build - run: meson compile -C build - - - name: Test - run: meson test -C build --verbose -# tipi-build-linux: -# name: tipi.build project build and dependency resolution -# runs-on: ubuntu-latest -# if: github.ref == 'refs/heads/master' -# container: tipibuild/tipi-ubuntu -# -# env: -# HOME: /root -# -# steps: -# - uses: actions/checkout@v3 -# - run: mkdir -p ~/.tipi -# -# # checking if the tomlplusplus project builds and passes tests -# - name: Build as project target linux-cxx17 (run tests 'odr_test_1' and 'main') -# run: tipi . --dont-upgrade --verbose -t linux-cxx17 --test "odr_test_1|main" -# -# - name: Build as project target linux-cxx20 (run tests 'odr_test_1' and 'main') -# run: tipi . --dont-upgrade --verbose -t linux-cxx20 --test "odr_test_1|main" -# -# - name: Cleanup project builds -# run: rm -r ./build -# -# - name: "Get branch name and save to env" -# env: -# IS_PR: ${{ github.EVENT_NAME == 'pull_request' }} -# run: | -# if ${IS_PR}; then -# BRANCH_NAME="${GITHUB_HEAD_REF}" -# else -# BRANCH_NAME="${GITHUB_REF##*/}" -# fi -# echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_ENV -# -# # trying if pulling the dependency with tipi works properly -# - name: Build as dependency -# run: | -# cd examples/ -# -# # create test directory and copy the simple_parser.cpp in there -# mkdir test-as-dep -# cp examples.h test-as-dep/. -# cp simple_parser.cpp test-as-dep/. -# cd test-as-dep/ -# -# # create a deps file referencing the commit that triggered this build as dependency -# mkdir .tipi -# echo '{ "requires": { "${{ github.event.repository.full_name }}": { "@": "${{ env.BRANCH_NAME }}" } } }' > .tipi/deps -# -# # build -# tipi . --dont-upgrade --verbose -t linux-cxx17 -# ./build/linux-cxx17/bin/simple_parser ../example.toml diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml deleted file mode 100644 index eea8fb7..0000000 --- a/.github/workflows/cifuzz.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: CIFuzz -on: - push: - branches: - - master - pull_request: -permissions: {} -jobs: - Fuzzing: - runs-on: ubuntu-latest - permissions: - security-events: write - steps: - - name: Build Fuzzers - id: build - uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master - with: - oss-fuzz-project-name: 'tomlplusplus' - language: c++ - - name: Run Fuzzers - uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master - with: - oss-fuzz-project-name: 'tomlplusplus' - language: c++ - fuzz-seconds: 800 - output-sarif: true - - name: Upload Crash - uses: actions/upload-artifact@v3 - if: failure() && steps.build.outcome == 'success' - with: - name: artifacts - path: ./out/artifacts - - name: Upload Sarif - if: always() && steps.build.outcome == 'success' - uses: github/codeql-action/upload-sarif@v2 - with: - # Path to SARIF file relative to the root of the repository - sarif_file: cifuzz-sarif/results.sarif - checkout_path: cifuzz-sarif diff --git a/.github/workflows/gh-pages.yaml b/.github/workflows/gh-pages.yaml deleted file mode 100644 index 8359133..0000000 --- a/.github/workflows/gh-pages.yaml +++ /dev/null @@ -1,42 +0,0 @@ -name: gh-pages - -on: - push: - branches: - - master - paths: - - "**.h" - - "**.hpp" - - "**.dox" - - "**.md" - - "docs/**" - - "**/gh-pages.yaml" - workflow_dispatch: - -jobs: - gh-pages: - runs-on: ubuntu-latest - - defaults: - run: - shell: bash - - steps: - - uses: actions/checkout@v3 - - - name: Install dependencies - run: | - sudo apt -y update - sudo apt -y install --no-install-recommends git python3 python3-pip doxygen - sudo -H pip3 install --upgrade poxy - - - name: Generate docs - run: | - cd docs - poxy --verbose - - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./docs/html diff --git a/.runsettings b/.runsettings deleted file mode 100644 index aa59652..0000000 --- a/.runsettings +++ /dev/null @@ -1,20 +0,0 @@ - - - - - 0 - build\TestResults - 60000 - - - - - --verbosity high --list-tests * - 500 - (?i:test) - Solution - tests\ - AdditionalInfo - - - diff --git a/.tipi/deps b/.tipi/deps deleted file mode 100644 index 3944afa..0000000 --- a/.tipi/deps +++ /dev/null @@ -1,3 +0,0 @@ -{ - "requires": {} -} diff --git a/Aurora.json b/Aurora.json new file mode 100644 index 0000000..c04fa3a --- /dev/null +++ b/Aurora.json @@ -0,0 +1,11 @@ +{ + "name": "tomlplusplus", + "type": "generic", + "sourcePaths": "src", + "include": "include", + "noLink": true, + "defines": [ + "TOML_HEADER_ONLY=1", + "TOML_OPTIONAL_TYPE=AuOptional" + ] +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index a913cdc..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,44 +0,0 @@ -cmake_minimum_required(VERSION 3.14) - -project( - tomlplusplus - VERSION 3.4.0 - DESCRIPTION "Header-only TOML config file parser and serializer for C++17" - HOMEPAGE_URL "https://marzer.github.io/tomlplusplus/" - LANGUAGES CXX -) - -include(cmake/project-is-top-level.cmake) -include(cmake/variables.cmake) - -# ---- Declare library ---- - -add_library(tomlplusplus_tomlplusplus INTERFACE) -add_library(tomlplusplus::tomlplusplus ALIAS tomlplusplus_tomlplusplus) - -set_property( - TARGET tomlplusplus_tomlplusplus PROPERTY - EXPORT_NAME tomlplusplus -) - -target_include_directories( - tomlplusplus_tomlplusplus - ${tomlplusplus_warning_guard} # unquoted for list expansion - INTERFACE - "$" -) - -target_compile_features(tomlplusplus_tomlplusplus INTERFACE cxx_std_17) - -# ---- Install rules, examples, and fuzzing ---- -if(PROJECT_IS_TOP_LEVEL) - include(cmake/install-rules.cmake) - option(BUILD_EXAMPLES "Build examples tree." OFF) - option(BUILD_FUZZER "Build fuzzer." OFF) - if(BUILD_EXAMPLES) - add_subdirectory(examples) - endif() - if(BUILD_FUZZER AND DEFINED ENV{LIB_FUZZING_ENGINE}) - add_subdirectory(fuzzing) - endif() -endif() diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index 8f30d26..0000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,76 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, sex characteristics, gender identity and expression, -level of experience, education, socio-economic status, nationality, personal -appearance, race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or - advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at mark.gillard@outlook.com.au. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html - -[homepage]: https://www.contributor-covenant.org - -For answers to common questions about this code of conduct, see -https://www.contributor-covenant.org/faq diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 552880b..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,80 +0,0 @@ -# Contributing to toml++ - -Contributions are very welcome! Either by [reporting issues] or submitting pull requests. -If you wish to submit a PR, please be aware that: - -- The single-header `toml.hpp` at the repository root is generated by a script, so don't change it directly; make your - changes in the files in `include`. -- Your changes should compile warning-free on at least one of: - - GCC 8 or higher - - Clang 8 or higher - - MSVC 19.2X (Visual Studio 2019) or higher -- You should regenerate the single-header version of `toml.hpp` as part of your PR (a CI check will fail if you don't). - -
- -## Regenerating the single-header toml.hpp - -1. Make your changes as necessary - - If you've added a new header file that isn't going to be transitively included by one of the - others, add an include directive to `include/toml++/toml.hpp` -2. Install the prerequisite python packages: `pip3 install -r tools/requirements.txt` -3. Run `tools/generate_single_header.py` - -
- -## Building and running the tests - -Testing is done using [Catch2]. - -### Testing on Windows with Visual Studio - -Install [Visual Studio] and [Test Adapter for Catch2], then open `toml++.sln` and build the -projects in the `tests` solution folder. Visual Studio's Test Explorer should pick these up and -allow you to run the tests directly. - -If test discovery fails you can usually fix it by enabling -`Auto Detect runsettings Files` (settings gear icon > `Configure Run Settings`). - -### Testing on Linux (and WSL) - -```bash -# install ninja, meson, locales (first time only) -sudo apt update && sudo apt install -y locales python3 python3-pip ninja-build -sudo pip3 install meson -sudo locale-gen 'en_US.utf8' \ - 'ja_JP.utf8' \ - 'de_DE.utf8' \ - 'it_IT.utf8' \ - 'tr_TR.utf8' \ - 'fi_FI.utf8' \ - 'fr_FR.utf8' \ - 'zh_CN.utf8' - -# create the build configs (first time only) -meson setup build-debug --buildtype=debug -Ddevel=true -meson setup build-release --buildtype=release -Ddevel=true - -# run the tests -cd build-debug && ninja && ninja test \ - && cd ../build-release && ninja && ninja test \ - && cd .. -``` - -> ℹ️ Pass `-Duse_vendored_libs=false` to Meson if you wish to use the system-installed version -> of Catch2 rather than the vendored one. - -
- -## Testing with the [toml-test] suite - -As an optional extra you may wish to test against the official test TOML test suite, [toml-test]. See the -instructions at [toml-test/README](./toml-test/README.md). Note that the toml++ tests already consume tests from the -offical suite via a C++ code-generation script so you are not expected to take this extra step as part of contributing -to the library. - -[visual studio]: https://visualstudio.microsoft.com/vs/ -[test adapter for catch2]: https://marketplace.visualstudio.com/items?itemName=JohnnyHendriks.ext01 -[reporting issues]: https://github.com/marzer/tomlplusplus/issues -[catch2]: https://github.com/catchorg/Catch2 -[toml-test]: https://github.com/toml-lang/toml-test diff --git a/cmake/install-rules.cmake b/cmake/install-rules.cmake deleted file mode 100644 index 2218025..0000000 --- a/cmake/install-rules.cmake +++ /dev/null @@ -1,52 +0,0 @@ -include(CMakePackageConfigHelpers) -include(GNUInstallDirs) - -install( - FILES "${PROJECT_SOURCE_DIR}/toml++.natvis" "${PROJECT_SOURCE_DIR}/cpp.hint" - DESTINATION "${CMAKE_INSTALL_DATADIR}/tomlplusplus" - COMPONENT tomlplusplus_Development -) - -install( - DIRECTORY "${PROJECT_SOURCE_DIR}/include/" - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" - COMPONENT tomlplusplus_Development -) - -install( - TARGETS tomlplusplus_tomlplusplus - EXPORT tomlplusplusTargets - INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" -) - -write_basic_package_version_file( - tomlplusplusConfigVersion.cmake - COMPATIBILITY SameMajorVersion - ARCH_INDEPENDENT -) - -set( - tomlplusplus_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/tomlplusplus" - CACHE STRING "CMake package config location relative to the install prefix" -) - -mark_as_advanced(tomlplusplus_INSTALL_CMAKEDIR) - -install( - FILES - "${PROJECT_SOURCE_DIR}/cmake/tomlplusplusConfig.cmake" - "${PROJECT_BINARY_DIR}/tomlplusplusConfigVersion.cmake" - DESTINATION "${tomlplusplus_INSTALL_CMAKEDIR}" - COMPONENT tomlplusplus_Development -) - -install( - EXPORT tomlplusplusTargets - NAMESPACE tomlplusplus:: - DESTINATION "${tomlplusplus_INSTALL_CMAKEDIR}" - COMPONENT tomlplusplus_Development -) - -if(PROJECT_IS_TOP_LEVEL) - include(CPack) -endif() diff --git a/cmake/project-is-top-level.cmake b/cmake/project-is-top-level.cmake deleted file mode 100644 index 3435fc0..0000000 --- a/cmake/project-is-top-level.cmake +++ /dev/null @@ -1,6 +0,0 @@ -# This variable is set by project() in CMake 3.21+ -string( - COMPARE EQUAL - "${CMAKE_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}" - PROJECT_IS_TOP_LEVEL -) diff --git a/cmake/tomlplusplusConfig.cmake b/cmake/tomlplusplusConfig.cmake deleted file mode 100644 index ec9f7a0..0000000 --- a/cmake/tomlplusplusConfig.cmake +++ /dev/null @@ -1 +0,0 @@ -include(${CMAKE_CURRENT_LIST_DIR}/tomlplusplusTargets.cmake) diff --git a/cmake/tomlplusplusConfig.cmake.meson.in b/cmake/tomlplusplusConfig.cmake.meson.in deleted file mode 100644 index b007b68..0000000 --- a/cmake/tomlplusplusConfig.cmake.meson.in +++ /dev/null @@ -1,29 +0,0 @@ -@PACKAGE_INIT@ - -# If tomlplusplus::tomlplusplus target is not defined it will be included -if(NOT TARGET tomlplusplus::tomlplusplus) - - if (@compile_library@) - set(imported_type UNKNOWN) - else() - set(imported_type INTERFACE) - endif() - - # Import tomlplusplus interface library - add_library(tomlplusplus::tomlplusplus ${imported_type} IMPORTED) - set_target_properties(tomlplusplus::tomlplusplus PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${PACKAGE_PREFIX_DIR}/@includedir@") - - # Require C++17 - target_compile_features(tomlplusplus::tomlplusplus INTERFACE cxx_std_17) - - # Set the path to the installed library so that users can link to it - if (@compile_library@) - set_target_properties(tomlplusplus::tomlplusplus PROPERTIES - IMPORTED_LOCATION "${PACKAGE_PREFIX_DIR}/@libdir@/@lib_name@" - ) - # compile_options not quoted on purpose - target_compile_options(tomlplusplus::tomlplusplus INTERFACE @compile_options@) - endif() - -endif() diff --git a/cmake/tomlplusplusConfigVersion.cmake.meson.in b/cmake/tomlplusplusConfigVersion.cmake.meson.in deleted file mode 100644 index 16b9749..0000000 --- a/cmake/tomlplusplusConfigVersion.cmake.meson.in +++ /dev/null @@ -1,48 +0,0 @@ -# This is a basic version file for the Config-mode of find_package(). -# It is used by write_basic_package_version_file() as input file for configure_file() -# to create a version-file which can be installed along a config.cmake file. -# -# The created file sets PACKAGE_VERSION_EXACT if the current version string and -# the requested version string are exactly the same and it sets -# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version. -# The variable CVF_VERSION must be set before calling configure_file(). - -set(PACKAGE_VERSION "@version@") - -if (PACKAGE_FIND_VERSION_RANGE) - # Package version must be in the requested version range - if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN) - OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX) - OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX))) - set(PACKAGE_VERSION_COMPATIBLE FALSE) - else() - set(PACKAGE_VERSION_COMPATIBLE TRUE) - endif() -else() - if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) - set(PACKAGE_VERSION_COMPATIBLE FALSE) - else() - set(PACKAGE_VERSION_COMPATIBLE TRUE) - if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) - set(PACKAGE_VERSION_EXACT TRUE) - endif() - endif() -endif() - - -# if the installed project requested no architecture check, don't perform the check -if("True") - return() -endif() - -# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: -if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "") - return() -endif() - -# check that the installed version has the same 32/64bit-ness as the one which is currently searching: -if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8") - math(EXPR installedBits "8 * 8") - set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") - set(PACKAGE_VERSION_UNSUITABLE TRUE) -endif() diff --git a/cmake/variables.cmake b/cmake/variables.cmake deleted file mode 100644 index 3660bfb..0000000 --- a/cmake/variables.cmake +++ /dev/null @@ -1,18 +0,0 @@ -# ---- Warning guard ---- - -# target_include_directories with the SYSTEM modifier will request the compiler -# to omit warnings from the provided paths, if the compiler supports that -# This is to provide a user experience similar to find_package when -# add_subdirectory or FetchContent is used to consume this project -set(tomlplusplus_warning_guard "") -if(NOT PROJECT_IS_TOP_LEVEL) - option( - tomlplusplus_INCLUDES_WITH_SYSTEM - "Use SYSTEM modifier for tomlplusplus's includes, disabling warnings" - ON - ) - mark_as_advanced(tomlplusplus_INCLUDES_WITH_SYSTEM) - if(tomlplusplus_INCLUDES_WITH_SYSTEM) - set(tomlplusplus_warning_guard SYSTEM) - endif() -endif() diff --git a/cpp.hint b/cpp.hint deleted file mode 100644 index 7dcca90..0000000 --- a/cpp.hint +++ /dev/null @@ -1,39 +0,0 @@ -#define TOML_ABI_NAMESPACE_BOOL(...) static_assert(true) -#define TOML_ABI_NAMESPACE_END static_assert(true) -#define TOML_ABSTRACT_INTERFACE -#define TOML_ALWAYS_INLINE inline -#define TOML_ANON_NAMESPACE_END static_assert(true) -#define TOML_ANON_NAMESPACE_START namespace -#define TOML_API -#define TOML_ATTR(...) -#define TOML_CLOSED_ENUM -#define TOML_CLOSED_FLAGS_ENUM -#define TOML_CONST_GETTER -#define TOML_CONST_INLINE_GETTER inline -#define TOML_CONSTRAINED_TEMPLATE(cond, ...) template <__VA_ARGS__> -#define TOML_EMPTY_BASES -#define TOML_EXPORTED_CLASS -#define TOML_EXPORTED_FREE_FUNCTION -#define TOML_EXPORTED_MEMBER_FUNCTION -#define TOML_EXPORTED_STATIC_FUNCTION -#define TOML_EXTERNAL_LINKAGE -#define TOML_FLAGS_ENUM -#define TOML_HIDDEN_CONSTRAINT(cond, ...) template <__VA_ARGS__> -#define TOML_IMPL_NAMESPACE_END static_assert(true) -#define TOML_IMPL_NAMESPACE_START namespace toml::impl -#define TOML_INTERNAL_LINKAGE static -#define TOML_LIKELY(...) (__VA_ARGS__) -#define TOML_LIKELY_CASE -#define TOML_NAMESPACE_END static_assert(true) -#define TOML_NAMESPACE_START namespace toml -#define TOML_NEVER_INLINE -#define TOML_NODISCARD -#define TOML_NODISCARD_CTOR -#define TOML_OPEN_ENUM -#define TOML_OPEN_FLAGS_ENUM -#define TOML_PURE_GETTER -#define TOML_PURE_INLINE_GETTER inline -#define TOML_RETURNS_BY_THROWING -#define TOML_TRIVIAL_ABI -#define TOML_UNLIKELY(...) (__VA_ARGS__) -#define TOML_UNLIKELY_CASE diff --git a/fuzzing/CMakeLists.txt b/fuzzing/CMakeLists.txt deleted file mode 100644 index 1e62a54..0000000 --- a/fuzzing/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -# Utilized by OSSFuzz to build the harness(es) for continuous fuzz-testing -# OSSFuzz defines the following environment variables, that this target relies upon: -# CXX, CFLAGS, LIB_FUZZING_ENGINE, OUT -cmake_minimum_required(VERSION 3.14) - -project(Fuzzer LANGUAGES CXX) - -include(../cmake/project-is-top-level.cmake) - -add_definitions(-DNDEBUG) # Do not want assertions - -if (DEFINED ENV{CFLAGS}) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} $ENV{CFLAGS}") -endif () -if (DEFINED ENV{CXXFLAGS}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{CXXFLAGS}") -endif () - -if(PROJECT_IS_TOP_LEVEL) - find_package(tomlplusplus REQUIRED) -endif() - -add_executable(toml_fuzzer toml_fuzzer.cpp) -target_link_libraries(toml_fuzzer PRIVATE tomlplusplus::tomlplusplus $ENV{LIB_FUZZING_ENGINE}) -target_compile_features(toml_fuzzer PRIVATE cxx_std_17) - -if (DEFINED ENV{OUT}) - install(TARGETS toml_fuzzer DESTINATION $ENV{OUT}) -else () - message(WARNING "Cannot install if $OUT is not defined!") -endif () \ No newline at end of file diff --git a/fuzzing/build.sh b/fuzzing/build.sh deleted file mode 100755 index cec2086..0000000 --- a/fuzzing/build.sh +++ /dev/null @@ -1,8 +0,0 @@ -cd $SRC/tomlplusplus -mkdir -p build -cmake -S . -B build -DBUILD_FUZZER=ON && cmake --build build --target install - -# Build the corpus using the existing toml files in the source -mkdir -p corpus -find $SRC/tomlplusplus -name "*.toml" -exec cp {} corpus \; -zip -q $OUT/toml_fuzzer_seed_corpus.zip corpus/* diff --git a/fuzzing/toml_fuzzer.cpp b/fuzzing/toml_fuzzer.cpp deleted file mode 100644 index 2b657f0..0000000 --- a/fuzzing/toml_fuzzer.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include - -#include - -enum class SerializationTest -{ - NONE = 0, - JSON, - YAML, - TOML, - kMaxValue = TOML -}; - -extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t* data, const std::size_t size) -{ - FuzzedDataProvider fdp{data, size}; - try - { - const toml::table tbl = toml::parse(fdp.ConsumeRandomLengthString()); - - switch (fdp.ConsumeEnum()) - { - case SerializationTest::JSON: - static_cast(toml::json_formatter{tbl}); - break; - case SerializationTest::YAML: - static_cast(toml::yaml_formatter{tbl}); - break; - case SerializationTest::TOML: - static_cast(toml::toml_formatter{tbl}); - default: - break; - } - } - catch (const toml::parse_error&) - { - return -1; - } - return 0; -} diff --git a/include/meson.build b/include/meson.build deleted file mode 100644 index 206dc6f..0000000 --- a/include/meson.build +++ /dev/null @@ -1,52 +0,0 @@ -# This file is a part of toml++ and is subject to the the terms of the MIT license. -# Copyright (c) Mark Gillard -# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text. -# SPDX-License-Identifier: MIT - -include_dir = include_directories('.') - -if not is_subproject - install_subdir('toml++', install_dir: get_option('includedir')) -endif - -if not build_lib # header-only mode - - tomlplusplus_dep = declare_dependency(include_directories: include_dir) - - if not is_subproject - import('pkgconfig').generate( - name: meson.project_name(), - description: 'Header-only TOML config file parser and serializer for C++', - install_dir: get_option('datadir')/'pkgconfig', - url: 'https://marzer.github.io/tomlplusplus' - ) - endif - - # cmake - if get_option('generate_cmake_config') and not is_subproject and not is_devel - cmake = import('cmake') - # Can't use until Meson 0.62.0, see https://github.com/mesonbuild/meson/pull/9916 - # and https://github.com/marzer/tomlplusplus/issues/140 - #cmake.write_basic_package_version_file( - # name: meson.project_name(), - # version: meson.project_version(), - # install_dir: get_option('datadir')/'cmake'/meson.project_name(), - # arch_independent: true - #) - # In the meantime, install a pre-generated Package Version file - configure_file( - configuration: {'version': meson.project_version()}, - input: '..'/'cmake'/'tomlplusplusConfigVersion.cmake.meson.in', - output: 'tomlplusplusConfigVersion.cmake', - install_dir: get_option('datadir')/'cmake'/meson.project_name() - ) - - cmake.configure_package_config_file( - name: meson.project_name(), - input: '..'/'cmake'/'tomlplusplusConfig.cmake.meson.in', - configuration: configuration_data({'includedir': get_option('includedir')}), - install_dir: get_option('datadir')/'cmake'/meson.project_name(), - ) - endif - -endif diff --git a/meson.build b/meson.build deleted file mode 100644 index 46e46c6..0000000 --- a/meson.build +++ /dev/null @@ -1,207 +0,0 @@ -# This file is a part of toml++ and is subject to the the terms of the MIT license. -# Copyright (c) Mark Gillard -# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text. -# SPDX-License-Identifier: MIT - -project( - 'tomlplusplus', - 'cpp', - license: 'MIT', - version: '3.4.0', - meson_version: '>=0.61.0', - default_options: [ - # https://mesonbuild.com/Builtin-options.html - # core options - 'buildtype=release', - 'default_library=shared', - # base options - 'b_lto=false', - 'b_ndebug=if-release', - # compiler options - 'cpp_std=c++17' - ] -) - -#----------------------------------------------------------------------------------------------------------------------- -# global vars + imports -#----------------------------------------------------------------------------------------------------------------------- - -compiler = meson.get_compiler('cpp') -message('target cpu_family: @0@'.format(host_machine.cpu_family())) -message('target cpu: @0@'.format(host_machine.cpu())) -message('target system: @0@'.format(host_machine.system())) -message('target endian: @0@'.format(host_machine.endian())) - -is_devel = get_option('devel') -is_debug = get_option('debug') -is_release = not is_debug -is_pedantic = get_option('pedantic') or is_devel -is_windows = host_machine.system() == 'windows' -is_x64 = host_machine.cpu_family() == 'x86_64' -is_subproject = meson.is_subproject() - -cpp = meson.get_compiler('cpp') -is_gcc = cpp.get_id() == 'gcc' -is_clang = cpp.get_id() == 'clang' -is_msvc = cpp.get_id() == 'msvc' -is_icc_cl = cpp.get_id() == 'intel-cl' -is_icc = is_icc_cl or cpp.get_id() == 'intel' -is_lld = cpp.get_linker_id() == 'ld.lld' -has_exceptions = get_option('cpp_eh') != 'none' -unreleased_features = get_option('unreleased_features') - -build_tests = (get_option('build_tests') or is_devel) and not is_subproject -build_examples = (get_option('build_examples') or is_devel) and not is_subproject -build_tt = (get_option('build_tt') or is_devel) and not is_subproject and has_exceptions and not unreleased_features -build_lib = get_option('build_lib') or get_option('compile_library') or build_tests or build_examples or build_tt - -#----------------------------------------------------------------------------------------------------------------------- -# global_args -# -# these are the arguments common to everything in the project -# *** they are not forwarded to dependents when using this as a submodule. *** -#----------------------------------------------------------------------------------------------------------------------- - -global_args = cpp.get_supported_arguments( - # clang/gcc - '-ferror-limit=5', - '-fmax-errors=5', - '-Wno-unused-command-line-argument', - '-Wno-reserved-macro-identifier', - '-Wno-init-list-lifetime', - '-fchar8_t', - # msvc - '/bigobj', - '/Gy', # function-level linking - '/GF', # string pooling - '/openmp-', - '/permissive-', - '/utf-8', - '/volatile:iso', - '/Zc:__cplusplus', - '/Zc:inline', - '/Zc:externConstexpr', - '/Zc:preprocessor' -) -if has_exceptions - global_args += cpp.get_supported_arguments('/Zc:throwingNew', '-D_HAS_EXCEPTIONS=1') -else - global_args += cpp.get_supported_arguments('-D_HAS_EXCEPTIONS=0') -endif -if is_pedantic - global_args += cpp.get_supported_arguments( - # clang - '-Weverything', - # gcc - '-Wcast-align', - '-Wcast-qual', - '-Wctor-dtor-privacy', - '-Wdisabled-optimization', - '-Wfloat-equal', - '-Wimport', - '-Winit-self', - '-Wlogical-op', - '-Wmissing-declarations', - '-Wmissing-field-initializers', - '-Wmissing-format-attribute', - '-Wmissing-include-dirs', - '-Wmissing-noreturn', - '-Wold-style-cast', - '-Woverloaded-virtual', - '-Wpacked', - '-Wpointer-arith', - '-Wredundant-decls', - '-Wshadow', - '-Wsign-conversion', - '-Wsign-promo', - '-Wstack-protector', - '-Wstrict-null-sentinel', - '-Wswitch-default', - '-Wswitch-enum', - '-Wundef', - '-Wunreachable-code', - '-Wunused', - '-Wunused-parameter', - '-Wuseless-cast', - '-Wvariadic-macros', - '-Wwrite-strings', - '-Wmissing-noreturn' - ) -endif -# unnecessary pedantry: -global_args += cpp.get_supported_arguments( - '-Wno-c++98-compat', - '-Wno-c++98-compat-pedantic', - '-Wno-documentation', - '-Wno-documentation-unknown-command', - '-Wno-switch-enum', - '-Wno-covered-switch-default', - '-Wno-padded', - '-Wno-float-equal' -) -if get_option('time_trace') - global_args += cpp.get_supported_arguments('-ftime-trace') -endif - -#----------------------------------------------------------------------------------------------------------------------- -# global_link_args -# -# these are the linker arguments common to everything in the projectwhen compiling shared libraries and executables. -# *** they are not forwarded to dependents when using this as a submodule. *** -#----------------------------------------------------------------------------------------------------------------------- - -global_link_args = [] - -if is_release - global_link_args += cpp.get_supported_link_arguments( - # msvc - '/OPT:REF,ICF=3', - '/INCREMENTAL:NO', - ) -endif - -#----------------------------------------------------------------------------------------------------------------------- -# global_overrides -# -# these are the meson overrides common to everything in the project -# *** they are not forwarded to dependents when using this as a submodule. *** -#----------------------------------------------------------------------------------------------------------------------- - -global_overrides = [ ] -if is_pedantic - global_overrides += [ - 'warning_level=3', - 'werror=true', - ] -endif - -#----------------------------------------------------------------------------------------------------------------------- -# subdirectories + files -#----------------------------------------------------------------------------------------------------------------------- - -public_headers = [] -internal_headers = [] - -# Empty dependency that will be filled either in src/ or include/ -tomlplusplus_dep = dependency('', required: false) - -subdir('include') - -if build_lib - subdir('src') -endif - -if build_tests - subdir('tests') -endif - -if build_examples - subdir('examples') -endif - -if build_tt - subdir('toml-test') -endif - -# Allow subproject usage -meson.override_dependency(meson.project_name(), tomlplusplus_dep) diff --git a/meson_options.txt b/meson_options.txt deleted file mode 100644 index 817b874..0000000 --- a/meson_options.txt +++ /dev/null @@ -1,14 +0,0 @@ -option('devel', type: 'boolean', value: false, description: 'Tell meson whether or not it is a development build. (default: false)') -option('build_lib', type: 'boolean', value: false, description: 'Compile the library, rather than consuming it in header-only mode. (default: false) (implied by devel)') -option('build_examples', type: 'boolean', value: false, description: 'Build the examples (default: false) (implied by devel)') -option('build_tests', type: 'boolean', value: false, description: 'Build tests (default: false) (implied by devel)') -option('build_tt', type: 'boolean', value: false, description: 'Enable to build the toml-test encoder and decoder. (default: false) (implied by devel) (disabled by unreleased_features)') -option('pedantic', type: 'boolean', value: false, description: 'Enable as many compiler warnings as possible (default: false) (implied by devel)') -option('time_trace', type: 'boolean', value: false, description: 'Enable the -ftime-trace option (Clang only)') -option('unreleased_features', type: 'boolean', value: false, description: 'Enable TOML_UNRELEASED_FEATURES=1 (default: false) (only relevant when compiling the library)') - -option('generate_cmake_config', type: 'boolean', value: true, description: 'Generate a cmake package config file (default: true - no effect when included as a subproject)') -option('use_vendored_libs', type: 'boolean', value: true, description: 'Use the libs from the vendor dir when building tests.') - -option('compile_library', type: 'boolean', deprecated: true) -option('float16', type: 'boolean', deprecated: true) diff --git a/src/meson.build b/src/meson.build deleted file mode 100644 index 3b3b537..0000000 --- a/src/meson.build +++ /dev/null @@ -1,88 +0,0 @@ -# This file is a part of toml++ and is subject to the the terms of the MIT license. -# Copyright (c) Mark Gillard -# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text. -# SPDX-License-Identifier: MIT - -assert(build_lib) # not header-only mode - -# These are the arguments needed to compile and consume the library, and -# are exposed to users with the `compile_args` kwarg of declare_dependency() -lib_args = cpp.get_supported_arguments('-DTOML_HEADER_ONLY=0') -if get_option('default_library') != 'static' - lib_args += cpp.get_supported_arguments('-DTOML_SHARED_LIB=1') -endif -if unreleased_features - lib_args += cpp.get_supported_arguments('-DTOML_ENABLE_UNRELEASED_FEATURES=1') -endif - -# these are the _internal_ args, just for compiling the lib -lib_internal_args = [] -lib_internal_args += global_args -lib_internal_args += lib_args -if is_pedantic and is_release - lib_internal_args += cpp.get_supported_arguments( - '-Wsuggest-attribute=const', - '-Wsuggest-attribute=pure' - ) -endif - -tomlplusplus_lib = library( - meson.project_name(), - files('toml.cpp'), - cpp_args: lib_internal_args, - gnu_symbol_visibility: get_option('default_library') == 'static' ? '' : 'hidden', - include_directories: include_dir, - install: not is_subproject, - version: meson.project_version(), - override_options: global_overrides -) - -tomlplusplus_dep = declare_dependency( - compile_args: lib_args, - include_directories: include_dir, - link_with: tomlplusplus_lib -) - -if not is_subproject - import('pkgconfig').generate( - tomlplusplus_lib, - description: 'TOML config file parser and serializer for C++', - extra_cflags: lib_args, - url: 'https://marzer.github.io/tomlplusplus' - ) -endif - -# cmake -if get_option('generate_cmake_config') and not is_subproject and not is_devel - cmake = import('cmake') - cmake.write_basic_package_version_file( - name: meson.project_name(), - version: meson.project_version(), - ) - - # This gets the full path of the library, then considers just the last - # component (i.e. the actual file name), and finally removes the - # version suffix from it, because users _should_ link against the .so - # file, as opposed to the .so.x.y.z one. - lib_name = tomlplusplus_lib.full_path().split('/')[-1] - lib_name = lib_name.replace('.' + meson.project_version(), '') - - # CMake needs space-separated values since it doesn't have types - cmake_compile_options = '' - foreach arg : lib_args - cmake_compile_options += arg + ' ' - endforeach - cmake_compile_options = cmake_compile_options.strip() - - cmake.configure_package_config_file( - name: meson.project_name(), - input: '..'/'cmake'/'tomlplusplusConfig.cmake.meson.in', - configuration: configuration_data({ - 'compile_library': true, - 'compile_options': cmake_compile_options, - 'includedir': get_option('includedir'), - 'libdir': get_option('libdir'), - 'lib_name': lib_name - }) - ) -endif diff --git a/src/toml.cpp b/src/toml.cpp deleted file mode 100644 index 8cc1877..0000000 --- a/src/toml.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// This file is a part of toml++ and is subject to the the terms of the MIT license. -// Copyright (c) Mark Gillard -// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text. -// SPDX-License-Identifier: MIT - -#ifndef TOML_IMPLEMENTATION -#define TOML_IMPLEMENTATION -#endif -#ifndef TOML_HEADER_ONLY -#define TOML_HEADER_ONLY 0 -#endif - -#include diff --git a/tests/at_path.cpp b/tests/at_path.cpp deleted file mode 100644 index 9d9d851..0000000 --- a/tests/at_path.cpp +++ /dev/null @@ -1,119 +0,0 @@ -// This file is a part of toml++ and is subject to the the terms of the MIT license. -// Copyright (c) Mark Gillard -// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text. -// SPDX-License-Identifier: MIT - -#include "tests.hpp" -TOML_DISABLE_SPAM_WARNINGS; - -TEST_CASE("at_path") -{ - // clang-format off - - const auto tbl = table - { - { ""sv, 0 }, // blank key - { "a"sv, 1 }, - { - "b"sv, - array - { - 2, - array{ 3 }, - table { { "c", 4 } } - }, - }, - { "d", table{ {"e", 5, }, {""sv, -1 } } } - }; - - // clang-format on - - /* - - # equivalent to the following TOML: - - "" = 0 - a = 1 - b = [ - 2, - [ 3 ], - { "c" = 4 } - ] - d = { "e" = 5, "" = -1 } - - */ - - SECTION("table") - { - // this section uses the free function version of at_path - - CHECK(tbl[""]); - CHECK(tbl[""] == at_path(tbl, "")); - - CHECK(tbl["a"]); - CHECK(tbl["a"] == at_path(tbl, "a")); - CHECK(tbl["a"] != at_path(tbl, ".a")); // equivalent to ""."a" - CHECK(!at_path(tbl, ".a")); - - CHECK(tbl["b"]); - CHECK(tbl["b"] == at_path(tbl, "b")); - - CHECK(tbl["b"][0]); - CHECK(tbl["b"][0] == at_path(tbl, "b[0]")); - CHECK(tbl["b"][0] == at_path(tbl, "b[0] ")); - CHECK(tbl["b"][0] == at_path(tbl, "b[ 0\t]")); // whitespace is allowed inside indexer - - CHECK(tbl["b"][1]); - CHECK(tbl["b"][1] != tbl["b"][0]); - CHECK(tbl["b"][1] == at_path(tbl, "b[1]")); - - CHECK(tbl["b"][1][0]); - CHECK(tbl["b"][1][0] == at_path(tbl, "b[1][0]")); - CHECK(tbl["b"][1][0] == at_path(tbl, "b[1] \t [0]")); // whitespace is allowed after indexers - - CHECK(tbl["b"][2]["c"]); - CHECK(tbl["b"][2]["c"] == at_path(tbl, "b[2].c")); - CHECK(tbl["b"][2]["c"] == at_path(tbl, "b[2] \t.c")); // whitespace is allowed after indexers - - // permissivity checks for missing trailing ']' - // (this permissivity is undocumented but serves to reduce error paths in user code) - CHECK(tbl["b"][1][0] == at_path(tbl, "b[1[0]")); - CHECK(tbl["b"][1][0] == at_path(tbl, "b[1[0")); - CHECK(tbl["b"][2]["c"] == at_path(tbl, "b[2.c")); - - CHECK(tbl["d"]); - CHECK(tbl["d"] == at_path(tbl, "d")); - - CHECK(tbl["d"]["e"]); - CHECK(tbl["d"]["e"] == at_path(tbl, "d.e")); - CHECK(tbl["d"]["e"] != at_path(tbl, "d. e")); // equivalent to "d"." e" - CHECK(!at_path(tbl, "d. e")); - - CHECK(tbl["d"][""]); - CHECK(tbl["d"][""] == at_path(tbl, "d.")); - } - - SECTION("array") - { - // this section uses the node_view member function version of at_path - - auto arr = tbl["b"]; - - CHECK(tbl["b"][0]); - CHECK(tbl["b"][0] == arr.at_path("[0]")); - CHECK(tbl["b"][0] == arr.at_path("[0] ")); - CHECK(tbl["b"][0] == arr.at_path("[ 0\t]")); // whitespace is allowed inside indexer - - CHECK(tbl["b"][1]); - CHECK(tbl["b"][1].node() != arr[0].node()); - CHECK(tbl["b"][1] == arr.at_path("[1]")); - - CHECK(tbl["b"][1][0]); - CHECK(tbl["b"][1][0] == arr.at_path("[1][0]")); - CHECK(tbl["b"][1][0] == arr.at_path("[1] \t [0]")); // whitespace is allowed after indexers - - CHECK(tbl["b"][2]["c"]); - CHECK(tbl["b"][2]["c"] == arr.at_path("[2].c")); - CHECK(tbl["b"][2]["c"] == arr.at_path("[2] \t.c")); // whitespace is allowed after indexers - } -} diff --git a/tests/conformance_burntsushi_invalid.cpp b/tests/conformance_burntsushi_invalid.cpp deleted file mode 100644 index 974a873..0000000 --- a/tests/conformance_burntsushi_invalid.cpp +++ /dev/null @@ -1,2022 +0,0 @@ -// This file is a part of toml++ and is subject to the the terms of the MIT license. -// Copyright (c) Mark Gillard -// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text. -// SPDX-License-Identifier: MIT -//----- -// this file was generated by generate_conformance_tests.py - do not modify it directly - -#include "tests.hpp" - -namespace -{ - static constexpr auto array_double_comma_1 = R"(array = [1,,2])"sv; - static constexpr auto array_double_comma_2 = R"(array = [1,2,,])"sv; - static constexpr auto array_extending_table = R"(a = [{ b = 1 }] - -# Cannot extend tables within static arrays -# https://github.com/toml-lang/toml/issues/908 -[a.c] -foo = 1)"sv; - static constexpr auto array_missing_separator = R"(wrong = [ 1 2 3 ])"sv; - static constexpr auto array_no_close_2 = R"(x = [42 #)"sv; - static constexpr auto array_no_close_table_2 = R"(x = [{ key = 42 #)"sv; - static constexpr auto array_no_close_table = R"(x = [{ key = 42)"sv; - static constexpr auto array_no_close = R"(long_array = [ 1, 2, 3)"sv; - static constexpr auto array_tables_1 = R"(# INVALID TOML DOC -fruit = [] - -[[fruit]] # Not allowed)"sv; - static constexpr auto array_tables_2 = R"(# INVALID TOML DOC -[[fruit]] - name = "apple" - - [[fruit.variety]] - name = "red delicious" - - # This table conflicts with the previous table - [fruit.variety] - name = "granny smith")"sv; - static constexpr auto array_text_after_array_entries = R"(array = [ - "Is there life after an array separator?", No - "Entry" -])"sv; - static constexpr auto array_text_before_array_separator = R"(array = [ - "Is there life before an array separator?" No, - "Entry" -])"sv; - static constexpr auto array_text_in_array = R"(array = [ - "Entry 1", - I don't belong, - "Entry 2", -])"sv; - - static constexpr auto bool_almost_false_with_extra = R"(a = falsify)"sv; - static constexpr auto bool_almost_false = R"(a = fals)"sv; - static constexpr auto bool_almost_true_with_extra = R"(a = truthy)"sv; - static constexpr auto bool_almost_true = R"(a = tru)"sv; - static constexpr auto bool_just_f = R"(a = f)"sv; - static constexpr auto bool_just_t = R"(a = t)"sv; - static constexpr auto bool_mixed_case = R"(valid = False)"sv; - static constexpr auto bool_starting_same_false = R"(a = falsey)"sv; - static constexpr auto bool_starting_same_true = R"(a = truer)"sv; - static constexpr auto bool_wrong_case_false = R"(b = FALSE)"sv; - static constexpr auto bool_wrong_case_true = R"(a = TRUE)"sv; - - static constexpr auto control_bare_cr = - "# The following line contains a single carriage return control character\r\n" - "\r"sv; - static constexpr auto control_bare_formfeed = "bare-formfeed = \f"sv; - static constexpr auto control_bare_null = "bare-null = \"some value\" \x00"sv; - static constexpr auto control_bare_vertical_tab = "bare-vertical-tab = \v"sv; - static constexpr auto control_comment_cr = "comment-cr = \"Carriage return in comment\" # \ra=1"sv; - static constexpr auto control_comment_del = "comment-del = \"0x7f\" # \x7F"sv; - static constexpr auto control_comment_lf = "comment-lf = \"ctrl-P\" # \x10"sv; - static constexpr auto control_comment_null = "comment-null = \"null\" # \x00"sv; - static constexpr auto control_comment_us = "comment-us = \"ctrl-_\" # \x1F"sv; - static constexpr auto control_multi_del = "multi-del = \"\"\"null\x7F\"\"\""sv; - static constexpr auto control_multi_lf = "multi-lf = \"\"\"null\x10\"\"\""sv; - static constexpr auto control_multi_null = "multi-null = \"\"\"null\x00\"\"\""sv; - static constexpr auto control_multi_us = "multi-us = \"\"\"null\x1F\"\"\""sv; - static constexpr auto control_rawmulti_del = "rawmulti-del = '''null\x7F'''"sv; - static constexpr auto control_rawmulti_lf = "rawmulti-lf = '''null\x10'''"sv; - static constexpr auto control_rawmulti_null = "rawmulti-null = '''null\x00'''"sv; - static constexpr auto control_rawmulti_us = "rawmulti-us = '''null\x1F'''"sv; - static constexpr auto control_rawstring_del = "rawstring-del = 'null\x7F'"sv; - static constexpr auto control_rawstring_lf = "rawstring-lf = 'null\x10'"sv; - static constexpr auto control_rawstring_null = "rawstring-null = 'null\x00'"sv; - static constexpr auto control_rawstring_us = "rawstring-us = 'null\x1F'"sv; - static constexpr auto control_string_bs = "string-bs = \"backspace\x08\""sv; - static constexpr auto control_string_del = "string-del = \"null\x7F\""sv; - static constexpr auto control_string_lf = "string-lf = \"null\x10\""sv; - static constexpr auto control_string_null = "string-null = \"null\x00\""sv; - static constexpr auto control_string_us = "string-us = \"null\x1F\""sv; - - static constexpr auto datetime_hour_over = R"(# time-hour = 2DIGIT ; 00-23 -d = 2006-01-01T24:00:00-00:00)"sv; - static constexpr auto datetime_mday_over = R"(# date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on -# ; month/year -d = 2006-01-32T00:00:00-00:00)"sv; - static constexpr auto datetime_mday_under = R"(# date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on -# ; month/year -d = 2006-01-00T00:00:00-00:00)"sv; - static constexpr auto datetime_minute_over = R"(# time-minute = 2DIGIT ; 00-59 -d = 2006-01-01T00:60:00-00:00)"sv; - static constexpr auto datetime_month_over = R"(# date-month = 2DIGIT ; 01-12 -d = 2006-13-01T00:00:00-00:00)"sv; - static constexpr auto datetime_month_under = R"(# date-month = 2DIGIT ; 01-12 -d = 2007-00-01T00:00:00-00:00)"sv; - static constexpr auto datetime_no_leads_month = R"(# Month "7" instead of "07"; the leading zero is required. -no-leads = 1987-7-05T17:45:00Z)"sv; - static constexpr auto datetime_no_leads_with_milli = R"(# Day "5" instead of "05"; the leading zero is required. -with-milli = 1987-07-5T17:45:00.12Z)"sv; - static constexpr auto datetime_no_leads = R"(# Month "7" instead of "07"; the leading zero is required. -no-leads = 1987-7-05T17:45:00Z)"sv; - static constexpr auto datetime_no_t = R"(# No "t" or "T" between the date and time. -no-t = 1987-07-0517:45:00Z)"sv; - static constexpr auto datetime_second_over = - R"(# time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second -# ; rules -d = 2006-01-01T00:00:61-00:00)"sv; - static constexpr auto datetime_time_no_leads = R"(# Leading 0 is always required. -d = 2023-10-01T1:32:00Z)"sv; - -#if !TOML_LANG_UNRELEASED - - static constexpr auto datetime_no_secs = R"(# No seconds in time. -no-secs = 1987-07-05T17:45Z)"sv; - -#endif // !TOML_LANG_UNRELEASED - - static constexpr auto encoding_bad_codepoint = - "\x23\x20\x49\x6E\x76\x61\x6C\x69\x64\x20\x63\x6F\x64\x65\x70\x6F\x69\x6E\x74\x20\x55\x2B\x44\x38\x30" - "\x30\x20\x3A\x20\xED\xA0\x80\x0A"sv; - static constexpr auto encoding_bad_utf8_at_end = - "\x23\x20\x54\x68\x65\x72\x65\x20\x69\x73\x20\x61\x20\x30\x78\x64\x61\x20\x61\x74\x20\x61\x66\x74\x65" - "\x72\x20\x74\x68\x65\x20\x71\x75\x6F\x74\x65\x73\x2C\x20\x61\x6E\x64\x20\x6E\x6F\x20\x45\x4F\x4C\x20" - "\x61\x74\x20\x74\x68\x65\x20\x65\x6E\x64\x20\x6F\x66\x20\x74\x68\x65\x20\x66\x69\x6C\x65\x2E\x0A\x23" - "\x0A\x23\x20\x54\x68\x69\x73\x20\x69\x73\x20\x61\x20\x62\x69\x74\x20\x6F\x66\x20\x61\x6E\x20\x65\x64" - "\x67\x65\x20\x63\x61\x73\x65\x3A\x20\x54\x68\x69\x73\x20\x69\x6E\x64\x69\x63\x61\x74\x65\x73\x20\x74" - "\x68\x65\x72\x65\x20\x73\x68\x6F\x75\x6C\x64\x20\x62\x65\x20\x74\x77\x6F\x20\x62\x79\x74\x65\x73\x0A" - "\x23\x20\x28\x30\x62\x31\x31\x30\x31\x5F\x31\x30\x31\x30\x29\x20\x62\x75\x74\x20\x74\x68\x65\x72\x65" - "\x20\x69\x73\x20\x6E\x6F\x20\x62\x79\x74\x65\x20\x74\x6F\x20\x66\x6F\x6C\x6C\x6F\x77\x20\x62\x65\x63" - "\x61\x75\x73\x65\x20\x69\x74\x27\x73\x20\x74\x68\x65\x20\x65\x6E\x64\x20\x6F\x66\x20\x74\x68\x65\x20" - "\x66\x69\x6C\x65\x2E\x0A\x78\x20\x3D\x20\x22\x22\x22\x22\x22\x22\xDA"sv; - static constexpr auto encoding_bad_utf8_in_comment = "\x23\x20\xC3\x0A"sv; - static constexpr auto encoding_bad_utf8_in_multiline_literal = - "\x23\x20\x54\x68\x65\x20\x66\x6F\x6C\x6C\x6F\x77\x69\x6E\x67\x20\x6C\x69\x6E\x65\x20\x63\x6F\x6E\x74" - "\x61\x69\x6E\x73\x20\x61\x6E\x20\x69\x6E\x76\x61\x6C\x69\x64\x20\x55\x54\x46\x2D\x38\x20\x73\x65\x71" - "\x75\x65\x6E\x63\x65\x2E\x0A\x62\x61\x64\x20\x3D\x20\x27\x27\x27\xC3\x27\x27\x27\x0A"sv; - static constexpr auto encoding_bad_utf8_in_multiline = - "\x23\x20\x54\x68\x65\x20\x66\x6F\x6C\x6C\x6F\x77\x69\x6E\x67\x20\x6C\x69\x6E\x65\x20\x63\x6F\x6E\x74" - "\x61\x69\x6E\x73\x20\x61\x6E\x20\x69\x6E\x76\x61\x6C\x69\x64\x20\x55\x54\x46\x2D\x38\x20\x73\x65\x71" - "\x75\x65\x6E\x63\x65\x2E\x0A\x62\x61\x64\x20\x3D\x20\x22\x22\x22\xC3\x22\x22\x22\x0A"sv; - static constexpr auto encoding_bad_utf8_in_string_literal = - "\x23\x20\x54\x68\x65\x20\x66\x6F\x6C\x6C\x6F\x77\x69\x6E\x67\x20\x6C\x69\x6E\x65\x20\x63\x6F\x6E\x74" - "\x61\x69\x6E\x73\x20\x61\x6E\x20\x69\x6E\x76\x61\x6C\x69\x64\x20\x55\x54\x46\x2D\x38\x20\x73\x65\x71" - "\x75\x65\x6E\x63\x65\x2E\x0A\x62\x61\x64\x20\x3D\x20\x27\xC3\x27\x0A"sv; - static constexpr auto encoding_bad_utf8_in_string = - "\x23\x20\x54\x68\x65\x20\x66\x6F\x6C\x6C\x6F\x77\x69\x6E\x67\x20\x6C\x69\x6E\x65\x20\x63\x6F\x6E\x74" - "\x61\x69\x6E\x73\x20\x61\x6E\x20\x69\x6E\x76\x61\x6C\x69\x64\x20\x55\x54\x46\x2D\x38\x20\x73\x65\x71" - "\x75\x65\x6E\x63\x65\x2E\x0A\x62\x61\x64\x20\x3D\x20\x22\xC3\x22\x0A"sv; - static constexpr auto encoding_bom_not_at_start_1 = - "\x62\x6F\x6D\x2D\x6E\x6F\x74\x2D\x61\x74\x2D\x73\x74\x61\x72\x74\x20\xFF\xFD\x0A"sv; - static constexpr auto encoding_bom_not_at_start_2 = - "\x62\x6F\x6D\x2D\x6E\x6F\x74\x2D\x61\x74\x2D\x73\x74\x61\x72\x74\x3D\x20\xFF\xFD\x0A"sv; - static constexpr auto encoding_utf16_bom = - "\xFE\xFF\x00\x23\x00\x20\x00\x55\x00\x54\x00\x46\x00\x2D\x00\x31\x00\x36\x00\x20\x00\x77\x00\x69\x00" - "\x74\x00\x68\x00\x20\x00\x42\x00\x4F\x00\x4D\x00\x0A"sv; - static constexpr auto encoding_utf16 = - "\x00#\x00 \x00U\x00T\x00F\x00-\x001\x006\x00 \x00w\x00i\x00t\x00h\x00o\x00u\x00t\x00 \x00B\x00O\x00M\x00"sv; - - static constexpr auto float_double_point_1 = R"(double-point-1 = 0..1)"sv; - static constexpr auto float_double_point_2 = R"(double-point-2 = 0.1.2)"sv; - static constexpr auto float_exp_double_e_1 = R"(exp-double-e-1 = 1ee2)"sv; - static constexpr auto float_exp_double_e_2 = R"(exp-double-e-2 = 1e2e3)"sv; - static constexpr auto float_exp_double_us = R"(exp-double-us = 1e__23)"sv; - static constexpr auto float_exp_leading_us = R"(exp-leading-us = 1e_23)"sv; - static constexpr auto float_exp_point_1 = R"(exp-point-1 = 1e2.3)"sv; - static constexpr auto float_exp_point_2 = R"(exp-point-2 = 1.e2)"sv; - static constexpr auto float_exp_trailing_us = R"(exp-trailing-us = 1e23_)"sv; - static constexpr auto float_inf_capital = R"(v = Inf)"sv; - static constexpr auto float_inf_incomplete_1 = R"(inf-incomplete-1 = in)"sv; - static constexpr auto float_inf_incomplete_2 = R"(inf-incomplete-2 = +in)"sv; - static constexpr auto float_inf_incomplete_3 = R"(inf-incomplete-3 = -in)"sv; - static constexpr auto float_inf_underscore = R"(inf_underscore = in_f)"sv; - static constexpr auto float_leading_point_neg = R"(leading-point-neg = -.12345)"sv; - static constexpr auto float_leading_point_plus = R"(leading-point-plus = +.12345)"sv; - static constexpr auto float_leading_point = R"(leading-point = .12345)"sv; - static constexpr auto float_leading_us = R"(leading-us = _1.2)"sv; - static constexpr auto float_leading_zero_neg = R"(leading-zero-neg = -03.14)"sv; - static constexpr auto float_leading_zero_plus = R"(leading-zero-plus = +03.14)"sv; - static constexpr auto float_leading_zero = R"(leading-zero = 03.14)"sv; - static constexpr auto float_nan_capital = R"(v = NaN)"sv; - static constexpr auto float_nan_incomplete_1 = R"(nan-incomplete-1 = na)"sv; - static constexpr auto float_nan_incomplete_2 = R"(nan-incomplete-2 = +na)"sv; - static constexpr auto float_nan_incomplete_3 = R"(nan-incomplete-3 = -na)"sv; - static constexpr auto float_nan_underscore = R"(nan_underscore = na_n)"sv; - static constexpr auto float_trailing_point_min = R"(trailing-point-min = -1.)"sv; - static constexpr auto float_trailing_point_plus = R"(trailing-point-plus = +1.)"sv; - static constexpr auto float_trailing_point = R"(trailing-point = 1.)"sv; - static constexpr auto float_trailing_us_exp_1 = R"(trailing-us-exp-1 = 1_e2)"sv; - static constexpr auto float_trailing_us_exp_2 = R"(trailing-us-exp-2 = 1.2_e2)"sv; - static constexpr auto float_trailing_us = R"(trailing-us = 1.2_)"sv; - static constexpr auto float_us_after_point = R"(us-after-point = 1._2)"sv; - static constexpr auto float_us_before_point = R"(us-before-point = 1_.2)"sv; - - static constexpr auto inline_table_add = R"(a={} -# Inline tables are immutable and can't be extended -[a.b])"sv; - static constexpr auto inline_table_bad_key_syntax = R"(tbl = { a = 1, [b] })"sv; - static constexpr auto inline_table_dotted_key_conflict = R"(tbl = { a.b = "a_b", a.b.c = "a_b_c" })"sv; - static constexpr auto inline_table_double_comma = R"(t = {x=3,,y=4})"sv; - static constexpr auto inline_table_duplicate_key = R"(# Duplicate keys within an inline table are invalid -a={b=1, b=2})"sv; - static constexpr auto inline_table_empty = R"(t = {,})"sv; - static constexpr auto inline_table_nested_key_conflict = - R"(tbl = { fruit = { apple.color = "red" }, fruit.apple.texture = { smooth = true } })"sv; - static constexpr auto inline_table_no_comma = R"(t = {x = 3 y = 4})"sv; - static constexpr auto inline_table_overwrite = R"(a.b=0 -# Since table "a" is already defined, it can't be replaced by an inline table. -a={})"sv; - -#if !TOML_LANG_UNRELEASED - - static constexpr auto inline_table_linebreak_1 = - R"(# No newlines are allowed between the curly braces unless they are valid within -# a value. -simple = { a = 1 -})"sv; - static constexpr auto inline_table_linebreak_2 = R"(t = {a=1, -b=2})"sv; - static constexpr auto inline_table_linebreak_3 = R"(t = {a=1 -,b=2})"sv; - static constexpr auto inline_table_linebreak_4 = R"(json_like = { - first = "Tom", - last = "Preston-Werner" -})"sv; - static constexpr auto inline_table_trailing_comma = - R"(# A terminating comma (also called trailing comma) is not permitted after the -# last key/value pair in an inline table -abc = { abc = 123, })"sv; - -#endif // !TOML_LANG_UNRELEASED - - static constexpr auto integer_capital_bin = R"(capital-bin = 0B0)"sv; - static constexpr auto integer_capital_hex = R"(capital-hex = 0X1)"sv; - static constexpr auto integer_capital_oct = R"(capital-oct = 0O0)"sv; - static constexpr auto integer_double_sign_nex = R"(double-sign-nex = --99)"sv; - static constexpr auto integer_double_sign_plus = R"(double-sign-plus = ++99)"sv; - static constexpr auto integer_double_us = R"(double-us = 1__23)"sv; - static constexpr auto integer_incomplete_bin = R"(incomplete-bin = 0b)"sv; - static constexpr auto integer_incomplete_hex = R"(incomplete-hex = 0x)"sv; - static constexpr auto integer_incomplete_oct = R"(incomplete-oct = 0o)"sv; - static constexpr auto integer_invalid_bin = R"(invalid-bin = 0b0012)"sv; - static constexpr auto integer_invalid_hex = R"(invalid-hex = 0xaafz)"sv; - static constexpr auto integer_invalid_oct = R"(invalid-oct = 0o778)"sv; - static constexpr auto integer_leading_us_bin = R"(leading-us-bin = _0o1)"sv; - static constexpr auto integer_leading_us_hex = R"(leading-us-hex = _0o1)"sv; - static constexpr auto integer_leading_us_oct = R"(leading-us-oct = _0o1)"sv; - static constexpr auto integer_leading_us = R"(leading-us = _123)"sv; - static constexpr auto integer_leading_zero_1 = R"(leading-zero-1 = 01)"sv; - static constexpr auto integer_leading_zero_2 = R"(leading-zero-2 = 00)"sv; - static constexpr auto integer_leading_zero_3 = R"(leading-zero-3 = 0_0)"sv; - static constexpr auto integer_leading_zero_sign_1 = R"(leading-zero-sign-1 = -01)"sv; - static constexpr auto integer_leading_zero_sign_2 = R"(leading-zero-sign-2 = +01)"sv; - static constexpr auto integer_leading_zero_sign_3 = R"(leading-zero-sign-3 = +0_1)"sv; - static constexpr auto integer_negative_bin = R"(negative-bin = -0b11010110)"sv; - static constexpr auto integer_negative_hex = R"(negative-hex = -0xff)"sv; - static constexpr auto integer_negative_oct = R"(negative-oct = -0o99)"sv; - static constexpr auto integer_positive_bin = R"(positive-bin = +0b11010110)"sv; - static constexpr auto integer_positive_hex = R"(positive-hex = +0xff)"sv; - static constexpr auto integer_positive_oct = R"(positive-oct = +0o99)"sv; - static constexpr auto integer_text_after_integer = R"(answer = 42 the ultimate answer?)"sv; - static constexpr auto integer_trailing_us_bin = R"(trailing-us-bin = 0b1_)"sv; - static constexpr auto integer_trailing_us_hex = R"(trailing-us-hex = 0x1_)"sv; - static constexpr auto integer_trailing_us_oct = R"(trailing-us-oct = 0o1_)"sv; - static constexpr auto integer_trailing_us = R"(trailing-us = 123_)"sv; - static constexpr auto integer_us_after_bin = R"(us-after-bin = 0b_1)"sv; - static constexpr auto integer_us_after_hex = R"(us-after-hex = 0x_1)"sv; - static constexpr auto integer_us_after_oct = R"(us-after-oct = 0o_1)"sv; - - static constexpr auto key_after_array = R"([[agencies]] owner = "S Cjelli")"sv; - static constexpr auto key_after_table = R"([error] this = "should not be here")"sv; - static constexpr auto key_after_value = R"(first = "Tom" last = "Preston-Werner" # INVALID)"sv; - static constexpr auto key_bare_invalid_character = R"(bare!key = 123)"sv; - static constexpr auto key_dotted_redefine_table = R"(# Defined a.b as int -a.b = 1 -# Tries to access it as table: error -a.b.c = 2)"sv; - static constexpr auto key_duplicate_keys = R"(dupe = false -dupe = true)"sv; - static constexpr auto key_duplicate = R"(# DO NOT DO THIS -name = "Tom" -name = "Pradyun")"sv; - static constexpr auto key_empty = R"( = 1)"sv; - static constexpr auto key_escape = R"(\u00c0 = "latin capital letter A with grave")"sv; - static constexpr auto key_hash = R"(a# = 1)"sv; - static constexpr auto key_multiline = R"("""long -key""" = 1)"sv; - static constexpr auto key_newline = R"(barekey - = 123)"sv; - static constexpr auto key_no_eol = R"(a = 1 b = 2)"sv; - static constexpr auto key_open_bracket = R"([abc = 1)"sv; - static constexpr auto key_partial_quoted = R"(partial"quoted" = 5)"sv; - static constexpr auto key_quoted_unclosed_1 = R"("key = x)"sv; - static constexpr auto key_quoted_unclosed_2 = R"("key)"sv; - static constexpr auto key_single_open_bracket = R"([)"sv; - static constexpr auto key_space = R"(a b = 1)"sv; - static constexpr auto key_start_bracket = R"([a] -[xyz = 5 -[b])"sv; - static constexpr auto key_start_dot = R"(.key = 1)"sv; - static constexpr auto key_two_equals = R"(key= = 1)"sv; - static constexpr auto key_two_equals2 = R"(a==1)"sv; - static constexpr auto key_two_equals3 = R"(a=b=1)"sv; - static constexpr auto key_without_value_1 = R"(key)"sv; - static constexpr auto key_without_value_2 = R"(key = )"sv; - static constexpr auto key_without_value_3 = R"("key")"sv; - static constexpr auto key_without_value_4 = R"("key" = )"sv; - -#if !TOML_LANG_UNRELEASED && UNICODE_LITERALS_OK - - static constexpr auto key_special_character = R"(μ = "greek small letter mu")"sv; - -#endif // !TOML_LANG_UNRELEASED && UNICODE_LITERALS_OK - - static constexpr auto local_date_mday_over = R"(# date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on -# ; month/year -d = 2006-01-32)"sv; - static constexpr auto local_date_mday_under = R"(# date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on -# ; month/year -d = 2006-01-00)"sv; - static constexpr auto local_date_month_over = R"(# date-month = 2DIGIT ; 01-12 -d = 2006-13-01)"sv; - static constexpr auto local_date_month_under = R"(# date-month = 2DIGIT ; 01-12 -d = 2007-00-01)"sv; - static constexpr auto local_date_no_leads_with_milli = R"(# Day "5" instead of "05"; the leading zero is required. -with-milli = 1987-07-5)"sv; - static constexpr auto local_date_no_leads = R"(# Month "7" instead of "07"; the leading zero is required. -no-leads = 1987-7-05)"sv; - static constexpr auto local_date_trailing_t = R"(# Date cannot end with trailing T -d = 2006-01-30T)"sv; - static constexpr auto local_datetime_hour_over = R"(# time-hour = 2DIGIT ; 00-23 -d = 2006-01-01T24:00:00)"sv; - static constexpr auto local_datetime_mday_over = - R"(# date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on -# ; month/year -d = 2006-01-32T00:00:00)"sv; - static constexpr auto local_datetime_mday_under = - R"(# date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on -# ; month/year -d = 2006-01-00T00:00:00)"sv; - static constexpr auto local_datetime_minute_over = R"(# time-minute = 2DIGIT ; 00-59 -d = 2006-01-01T00:60:00)"sv; - static constexpr auto local_datetime_month_over = R"(# date-month = 2DIGIT ; 01-12 -d = 2006-13-01T00:00:00)"sv; - static constexpr auto local_datetime_month_under = R"(# date-month = 2DIGIT ; 01-12 -d = 2007-00-01T00:00:00)"sv; - static constexpr auto local_datetime_no_leads_with_milli = - R"(# Day "5" instead of "05"; the leading zero is required. -with-milli = 1987-07-5T17:45:00.12)"sv; - static constexpr auto local_datetime_no_leads = R"(# Month "7" instead of "07"; the leading zero is required. -no-leads = 1987-7-05T17:45:00)"sv; - static constexpr auto local_datetime_no_secs = R"(# No seconds in time. -no-secs = 1987-07-05T17:45)"sv; - static constexpr auto local_datetime_no_t = R"(# No "t" or "T" between the date and time. -no-t = 1987-07-0517:45:00)"sv; - static constexpr auto local_datetime_second_over = - R"(# time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second -# ; rules -d = 2006-01-01T00:00:61)"sv; - static constexpr auto local_datetime_time_no_leads = R"(# Leading 0 is always required. -d = 2023-10-01T1:32:00Z)"sv; - static constexpr auto local_time_hour_over = R"(# time-hour = 2DIGIT ; 00-23 -d = 24:00:00)"sv; - static constexpr auto local_time_minute_over = R"(# time-minute = 2DIGIT ; 00-59 -d = 00:60:00)"sv; - static constexpr auto local_time_no_secs = R"(# No seconds in time. -no-secs = 17:45)"sv; - static constexpr auto local_time_second_over = - R"(# time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second -# ; rules -d = 00:00:61)"sv; - static constexpr auto local_time_time_no_leads_2 = R"(# Leading 0 is always required. -d = 01:32:0)"sv; - static constexpr auto local_time_time_no_leads = R"(# Leading 0 is always required. -d = 1:32:00)"sv; - - static constexpr auto spec_inline_table_2_0 = R"([product] -type = { name = "Nail" } -type.edible = false # INVALID)"sv; - static constexpr auto spec_inline_table_3_0 = R"([product] -type.name = "Nail" -type = { edible = false } # INVALID)"sv; - static constexpr auto spec_key_value_pair_1 = R"(key = # INVALID)"sv; - static constexpr auto spec_keys_2 = R"(= "no key name" # INVALID -"" = "blank" # VALID but discouraged -'' = 'blank' # VALID but discouraged)"sv; - static constexpr auto spec_string_4_0 = R"(str4 = """Here are two quotation marks: "". Simple enough.""" -str5 = """Here are three quotation marks: """.""" # INVALID -str5 = """Here are three quotation marks: ""\".""" -str6 = """Here are fifteen quotation marks: ""\"""\"""\"""\"""\".""" - -# "This," she said, "is just a pointless statement." -str7 = """"This," she said, "is just a pointless statement."""")"sv; - static constexpr auto spec_string_7_0 = R"(quot15 = '''Here are fifteen quotation marks: """""""""""""""''' - -apos15 = '''Here are fifteen apostrophes: '''''''''''''''''' # INVALID -apos15 = "Here are fifteen apostrophes: '''''''''''''''" - -# 'That,' she said, 'is still pointless.' -str = ''''That,' she said, 'is still pointless.'''')"sv; - static constexpr auto spec_table_9_0 = R"([fruit] -apple.color = "red" -apple.taste.sweet = true - -[fruit.apple] # INVALID -# [fruit.apple.taste] # INVALID - -[fruit.apple.texture] # you can add sub-tables -smooth = true)"sv; - static constexpr auto spec_table_9_1 = R"([fruit] -apple.color = "red" -apple.taste.sweet = true - -# [fruit.apple] # INVALID -[fruit.apple.taste] # INVALID - -[fruit.apple.texture] # you can add sub-tables -smooth = true)"sv; - - static constexpr auto string_bad_byte_escape = R"(naughty = "\xAg")"sv; - static constexpr auto string_bad_codepoint = - R"(invalid-codepoint = "This string contains a non scalar unicode codepoint \uD801")"sv; - static constexpr auto string_bad_concat = R"(no_concat = "first" "second")"sv; - static constexpr auto string_bad_escape_1 = R"(invalid-escape = "This string has a bad \a escape character.")"sv; - static constexpr auto string_bad_escape_2 = R"(invalid-escape = "This string has a bad \ escape character.")"sv; - static constexpr auto string_bad_hex_esc_1 = R"(bad-hex-esc-1 = "\x0g")"sv; - static constexpr auto string_bad_hex_esc_2 = R"(bad-hex-esc-2 = "\xG0")"sv; - static constexpr auto string_bad_hex_esc_3 = R"(bad-hex-esc-3 = "\x")"sv; - static constexpr auto string_bad_hex_esc_4 = R"(bad-hex-esc-4 = "\x 50")"sv; - static constexpr auto string_bad_hex_esc_5 = R"(bad-hex-esc-5 = "\x 50")"sv; - static constexpr auto string_bad_multiline = R"(multi = "first line -second line")"sv; - static constexpr auto string_bad_slash_escape = - R"(invalid-escape = "This string has a bad \/ escape character.")"sv; - static constexpr auto string_bad_uni_esc_1 = R"(str = "val\ue")"sv; - static constexpr auto string_bad_uni_esc_2 = R"(str = "val\Ux")"sv; - static constexpr auto string_bad_uni_esc_3 = R"(str = "val\U0000000")"sv; - static constexpr auto string_bad_uni_esc_4 = R"(str = "val\U0000")"sv; - static constexpr auto string_bad_uni_esc_5 = R"(str = "val\Ugggggggg")"sv; - static constexpr auto string_basic_multiline_out_of_range_unicode_escape_1 = R"(a = """\UFFFFFFFF""")"sv; - static constexpr auto string_basic_multiline_out_of_range_unicode_escape_2 = R"(a = """\U00D80000""")"sv; - static constexpr auto string_basic_multiline_quotes = R"(str5 = """Here are three quotation marks: """.""")"sv; - static constexpr auto string_basic_multiline_unknown_escape = R"(a = """\@""")"sv; - static constexpr auto string_basic_out_of_range_unicode_escape_1 = R"(a = "\UFFFFFFFF")"sv; - static constexpr auto string_basic_out_of_range_unicode_escape_2 = R"(a = "\U00D80000")"sv; - static constexpr auto string_basic_unknown_escape = R"(a = "\@")"sv; - static constexpr auto string_literal_multiline_quotes_1 = R"(a = '''6 apostrophes: '''''')"sv; - static constexpr auto string_literal_multiline_quotes_2 = R"(a = '''15 apostrophes: '''''''''''''''''')"sv; - static constexpr auto string_missing_quotes = R"(name = value)"sv; - static constexpr auto string_multiline_bad_escape_1 = R"(k = """t\a""")"sv; - static constexpr auto string_multiline_bad_escape_2 = R"(# \ is not a valid escape. -k = """t\ t""")"sv; - static constexpr auto string_multiline_bad_escape_3 = R"(# \ is not a valid escape. -k = """t\ """)"sv; - static constexpr auto string_multiline_escape_space = R"(a = """ - foo \ \n - bar""")"sv; - static constexpr auto string_multiline_no_close_2 = R"(x=""")"sv; - static constexpr auto string_multiline_no_close = R"(invalid = """ - this will fail)"sv; - static constexpr auto string_multiline_quotes_1 = R"(a = """6 quotes: """""")"sv; - static constexpr auto string_no_close = R"(no-ending-quote = "One time, at band camp)"sv; - static constexpr auto string_text_after_string = R"(string = "Is there life after strings?" No.)"sv; - static constexpr auto string_wrong_close = R"(bad-ending-quote = "double and single')"sv; - -#if !TOML_LANG_UNRELEASED - - static constexpr auto string_basic_byte_escapes = R"(answer = "\x33")"sv; - -#endif // !TOML_LANG_UNRELEASED - - static constexpr auto table_append_to_array_with_dotted_keys = R"([[a.b]] - -[a] -b.y = 2)"sv; - static constexpr auto table_append_with_dotted_keys_1 = R"(# First a.b.c defines a table: a.b.c = {z=9} -# -# Then we define a.b.c.t = "str" to add a str to the above table, making it: -# -# a.b.c = {z=9, t="..."} -# -# While this makes sense, logically, it was decided this is not valid TOML as -# it's too confusing/convoluted. -# -# See: https://github.com/toml-lang/toml/issues/846 -# https://github.com/toml-lang/toml/pull/859 - -[a.b.c] - z = 9 - -[a] - b.c.t = "Using dotted keys to add to [a.b.c] after explicitly defining it above is not allowed")"sv; - static constexpr auto table_append_with_dotted_keys_2 = - R"(# This is the same issue as in injection-1.toml, except that nests one level -# deeper. See that file for a more complete description. - -[a.b.c.d] - z = 9 - -[a] - b.c.d.k.t = "Using dotted keys to add to [a.b.c.d] after explicitly defining it above is not allowed")"sv; - static constexpr auto table_array_empty = R"([[]] -name = "Born to Run")"sv; - static constexpr auto table_array_implicit = - R"(# This test is a bit tricky. It should fail because the first use of -# `[[albums.songs]]` without first declaring `albums` implies that `albums` -# must be a table. The alternative would be quite weird. Namely, it wouldn't -# comply with the TOML spec: "Each double-bracketed sub-table will belong to -# the most *recently* defined table element *above* it." -# -# This is in contrast to the *valid* test, table-array-implicit where -# `[[albums.songs]]` works by itself, so long as `[[albums]]` isn't declared -# later. (Although, `[albums]` could be.) -[[albums.songs]] -name = "Glory Days" - -[[albums]] -name = "Born in the USA")"sv; - static constexpr auto table_array_missing_bracket = R"([[albums] -name = "Born to Run")"sv; - static constexpr auto table_duplicate_key_dotted_array = R"([fruit] -apple.color = "red" - -[[fruit.apple]])"sv; - static constexpr auto table_duplicate_key_dotted_table = R"([fruit] -apple.color = "red" - -[fruit.apple] # INVALID)"sv; - static constexpr auto table_duplicate_key_dotted_table2 = R"([fruit] -apple.taste.sweet = true - -[fruit.apple.taste] # INVALID)"sv; - static constexpr auto table_duplicate_key_table = R"([fruit] -type = "apple" - -[fruit.type] -apple = "yes")"sv; - static constexpr auto table_duplicate_table_array = R"([tbl] -[[tbl]])"sv; - static constexpr auto table_duplicate_table_array2 = R"([[tbl]] -[tbl])"sv; - static constexpr auto table_duplicate = R"([a] -b = 1 - -[a] -c = 2)"sv; - static constexpr auto table_empty_implicit_table = R"([naughty..naughty])"sv; - static constexpr auto table_empty = R"([])"sv; - static constexpr auto table_equals_sign = R"([name=bad])"sv; - static constexpr auto table_llbrace = R"([ [table]])"sv; - static constexpr auto table_nested_brackets_close = R"([a]b] -zyx = 42)"sv; - static constexpr auto table_nested_brackets_open = R"([a[b] -zyx = 42)"sv; - static constexpr auto table_quoted_no_close = R"(["where will it end] -name = value)"sv; - static constexpr auto table_redefine = R"(# Define b as int, and try to use it as a table: error -[a] -b = 1 - -[a.b] -c = 2)"sv; - static constexpr auto table_rrbrace = R"([[table] ])"sv; - static constexpr auto table_text_after_table = R"([error] this shouldn't be here)"sv; - static constexpr auto table_whitespace = R"([invalid key])"sv; - static constexpr auto table_with_pound = R"([key#group] -answer = 42)"sv; -} - -TEST_CASE("conformance - burntsushi/invalid") -{ - SECTION("array-double-comma-1") - { - parsing_should_fail(FILE_LINE_ARGS, array_double_comma_1); // array-double-comma-1 - } - - SECTION("array-double-comma-2") - { - parsing_should_fail(FILE_LINE_ARGS, array_double_comma_2); // array-double-comma-2 - } - - SECTION("array-extending-table") - { - parsing_should_fail(FILE_LINE_ARGS, array_extending_table); // array-extending-table - } - - SECTION("array-missing-separator") - { - parsing_should_fail(FILE_LINE_ARGS, array_missing_separator); // array-missing-separator - } - - SECTION("array-no-close-2") - { - parsing_should_fail(FILE_LINE_ARGS, array_no_close_2); // array-no-close-2 - } - - SECTION("array-no-close-table-2") - { - parsing_should_fail(FILE_LINE_ARGS, array_no_close_table_2); // array-no-close-table-2 - } - - SECTION("array-no-close-table") - { - parsing_should_fail(FILE_LINE_ARGS, array_no_close_table); // array-no-close-table - } - - SECTION("array-no-close") - { - parsing_should_fail(FILE_LINE_ARGS, array_no_close); // array-no-close - } - - SECTION("array-tables-1") - { - parsing_should_fail(FILE_LINE_ARGS, array_tables_1); // array-tables-1 - } - - SECTION("array-tables-2") - { - parsing_should_fail(FILE_LINE_ARGS, array_tables_2); // array-tables-2 - } - - SECTION("array-text-after-array-entries") - { - parsing_should_fail(FILE_LINE_ARGS, array_text_after_array_entries); // array-text-after-array-entries - } - - SECTION("array-text-before-array-separator") - { - parsing_should_fail(FILE_LINE_ARGS, array_text_before_array_separator); // array-text-before-array-separator - } - - SECTION("array-text-in-array") - { - parsing_should_fail(FILE_LINE_ARGS, array_text_in_array); // array-text-in-array - } - - SECTION("bool-almost-false-with-extra") - { - parsing_should_fail(FILE_LINE_ARGS, bool_almost_false_with_extra); // bool-almost-false-with-extra - } - - SECTION("bool-almost-false") - { - parsing_should_fail(FILE_LINE_ARGS, bool_almost_false); // bool-almost-false - } - - SECTION("bool-almost-true-with-extra") - { - parsing_should_fail(FILE_LINE_ARGS, bool_almost_true_with_extra); // bool-almost-true-with-extra - } - - SECTION("bool-almost-true") - { - parsing_should_fail(FILE_LINE_ARGS, bool_almost_true); // bool-almost-true - } - - SECTION("bool-just-f") - { - parsing_should_fail(FILE_LINE_ARGS, bool_just_f); // bool-just-f - } - - SECTION("bool-just-t") - { - parsing_should_fail(FILE_LINE_ARGS, bool_just_t); // bool-just-t - } - - SECTION("bool-mixed-case") - { - parsing_should_fail(FILE_LINE_ARGS, bool_mixed_case); // bool-mixed-case - } - - SECTION("bool-starting-same-false") - { - parsing_should_fail(FILE_LINE_ARGS, bool_starting_same_false); // bool-starting-same-false - } - - SECTION("bool-starting-same-true") - { - parsing_should_fail(FILE_LINE_ARGS, bool_starting_same_true); // bool-starting-same-true - } - - SECTION("bool-wrong-case-false") - { - parsing_should_fail(FILE_LINE_ARGS, bool_wrong_case_false); // bool-wrong-case-false - } - - SECTION("bool-wrong-case-true") - { - parsing_should_fail(FILE_LINE_ARGS, bool_wrong_case_true); // bool-wrong-case-true - } - - SECTION("control-bare-cr") - { - parsing_should_fail(FILE_LINE_ARGS, control_bare_cr); // control-bare-cr - } - - SECTION("control-bare-formfeed") - { - parsing_should_fail(FILE_LINE_ARGS, control_bare_formfeed); // control-bare-formfeed - } - - SECTION("control-bare-null") - { - parsing_should_fail(FILE_LINE_ARGS, control_bare_null); // control-bare-null - } - - SECTION("control-bare-vertical-tab") - { - parsing_should_fail(FILE_LINE_ARGS, control_bare_vertical_tab); // control-bare-vertical-tab - } - - SECTION("control-comment-cr") - { - parsing_should_fail(FILE_LINE_ARGS, control_comment_cr); // control-comment-cr - } - - SECTION("control-comment-del") - { - parsing_should_fail(FILE_LINE_ARGS, control_comment_del); // control-comment-del - } - - SECTION("control-comment-lf") - { - parsing_should_fail(FILE_LINE_ARGS, control_comment_lf); // control-comment-lf - } - - SECTION("control-comment-null") - { - parsing_should_fail(FILE_LINE_ARGS, control_comment_null); // control-comment-null - } - - SECTION("control-comment-us") - { - parsing_should_fail(FILE_LINE_ARGS, control_comment_us); // control-comment-us - } - - SECTION("control-multi-del") - { - parsing_should_fail(FILE_LINE_ARGS, control_multi_del); // control-multi-del - } - - SECTION("control-multi-lf") - { - parsing_should_fail(FILE_LINE_ARGS, control_multi_lf); // control-multi-lf - } - - SECTION("control-multi-null") - { - parsing_should_fail(FILE_LINE_ARGS, control_multi_null); // control-multi-null - } - - SECTION("control-multi-us") - { - parsing_should_fail(FILE_LINE_ARGS, control_multi_us); // control-multi-us - } - - SECTION("control-rawmulti-del") - { - parsing_should_fail(FILE_LINE_ARGS, control_rawmulti_del); // control-rawmulti-del - } - - SECTION("control-rawmulti-lf") - { - parsing_should_fail(FILE_LINE_ARGS, control_rawmulti_lf); // control-rawmulti-lf - } - - SECTION("control-rawmulti-null") - { - parsing_should_fail(FILE_LINE_ARGS, control_rawmulti_null); // control-rawmulti-null - } - - SECTION("control-rawmulti-us") - { - parsing_should_fail(FILE_LINE_ARGS, control_rawmulti_us); // control-rawmulti-us - } - - SECTION("control-rawstring-del") - { - parsing_should_fail(FILE_LINE_ARGS, control_rawstring_del); // control-rawstring-del - } - - SECTION("control-rawstring-lf") - { - parsing_should_fail(FILE_LINE_ARGS, control_rawstring_lf); // control-rawstring-lf - } - - SECTION("control-rawstring-null") - { - parsing_should_fail(FILE_LINE_ARGS, control_rawstring_null); // control-rawstring-null - } - - SECTION("control-rawstring-us") - { - parsing_should_fail(FILE_LINE_ARGS, control_rawstring_us); // control-rawstring-us - } - - SECTION("control-string-bs") - { - parsing_should_fail(FILE_LINE_ARGS, control_string_bs); // control-string-bs - } - - SECTION("control-string-del") - { - parsing_should_fail(FILE_LINE_ARGS, control_string_del); // control-string-del - } - - SECTION("control-string-lf") - { - parsing_should_fail(FILE_LINE_ARGS, control_string_lf); // control-string-lf - } - - SECTION("control-string-null") - { - parsing_should_fail(FILE_LINE_ARGS, control_string_null); // control-string-null - } - - SECTION("control-string-us") - { - parsing_should_fail(FILE_LINE_ARGS, control_string_us); // control-string-us - } - - SECTION("datetime-hour-over") - { - parsing_should_fail(FILE_LINE_ARGS, datetime_hour_over); // datetime-hour-over - } - - SECTION("datetime-mday-over") - { - parsing_should_fail(FILE_LINE_ARGS, datetime_mday_over); // datetime-mday-over - } - - SECTION("datetime-mday-under") - { - parsing_should_fail(FILE_LINE_ARGS, datetime_mday_under); // datetime-mday-under - } - - SECTION("datetime-minute-over") - { - parsing_should_fail(FILE_LINE_ARGS, datetime_minute_over); // datetime-minute-over - } - - SECTION("datetime-month-over") - { - parsing_should_fail(FILE_LINE_ARGS, datetime_month_over); // datetime-month-over - } - - SECTION("datetime-month-under") - { - parsing_should_fail(FILE_LINE_ARGS, datetime_month_under); // datetime-month-under - } - - SECTION("datetime-no-leads-month") - { - parsing_should_fail(FILE_LINE_ARGS, datetime_no_leads_month); // datetime-no-leads-month - } - - SECTION("datetime-no-leads-with-milli") - { - parsing_should_fail(FILE_LINE_ARGS, datetime_no_leads_with_milli); // datetime-no-leads-with-milli - } - - SECTION("datetime-no-leads") - { - parsing_should_fail(FILE_LINE_ARGS, datetime_no_leads); // datetime-no-leads - } - - SECTION("datetime-no-t") - { - parsing_should_fail(FILE_LINE_ARGS, datetime_no_t); // datetime-no-t - } - - SECTION("datetime-second-over") - { - parsing_should_fail(FILE_LINE_ARGS, datetime_second_over); // datetime-second-over - } - - SECTION("datetime-time-no-leads") - { - parsing_should_fail(FILE_LINE_ARGS, datetime_time_no_leads); // datetime-time-no-leads - } - -#if !TOML_LANG_UNRELEASED - - SECTION("datetime-no-secs") - { - parsing_should_fail(FILE_LINE_ARGS, datetime_no_secs); // datetime-no-secs - } - -#endif // !TOML_LANG_UNRELEASED - - SECTION("encoding-bad-codepoint") - { - parsing_should_fail(FILE_LINE_ARGS, encoding_bad_codepoint); // encoding-bad-codepoint - } - - SECTION("encoding-bad-utf8-at-end") - { - parsing_should_fail(FILE_LINE_ARGS, encoding_bad_utf8_at_end); // encoding-bad-utf8-at-end - } - - SECTION("encoding-bad-utf8-in-comment") - { - parsing_should_fail(FILE_LINE_ARGS, encoding_bad_utf8_in_comment); // encoding-bad-utf8-in-comment - } - - SECTION("encoding-bad-utf8-in-multiline-literal") - { - parsing_should_fail(FILE_LINE_ARGS, - encoding_bad_utf8_in_multiline_literal); // encoding-bad-utf8-in-multiline-literal - } - - SECTION("encoding-bad-utf8-in-multiline") - { - parsing_should_fail(FILE_LINE_ARGS, encoding_bad_utf8_in_multiline); // encoding-bad-utf8-in-multiline - } - - SECTION("encoding-bad-utf8-in-string-literal") - { - parsing_should_fail(FILE_LINE_ARGS, encoding_bad_utf8_in_string_literal); // encoding-bad-utf8-in-string-literal - } - - SECTION("encoding-bad-utf8-in-string") - { - parsing_should_fail(FILE_LINE_ARGS, encoding_bad_utf8_in_string); // encoding-bad-utf8-in-string - } - - SECTION("encoding-bom-not-at-start-1") - { - parsing_should_fail(FILE_LINE_ARGS, encoding_bom_not_at_start_1); // encoding-bom-not-at-start-1 - } - - SECTION("encoding-bom-not-at-start-2") - { - parsing_should_fail(FILE_LINE_ARGS, encoding_bom_not_at_start_2); // encoding-bom-not-at-start-2 - } - - SECTION("encoding-utf16-bom") - { - parsing_should_fail(FILE_LINE_ARGS, encoding_utf16_bom); // encoding-utf16-bom - } - - SECTION("encoding-utf16") - { - parsing_should_fail(FILE_LINE_ARGS, encoding_utf16); // encoding-utf16 - } - - SECTION("float-double-point-1") - { - parsing_should_fail(FILE_LINE_ARGS, float_double_point_1); // float-double-point-1 - } - - SECTION("float-double-point-2") - { - parsing_should_fail(FILE_LINE_ARGS, float_double_point_2); // float-double-point-2 - } - - SECTION("float-exp-double-e-1") - { - parsing_should_fail(FILE_LINE_ARGS, float_exp_double_e_1); // float-exp-double-e-1 - } - - SECTION("float-exp-double-e-2") - { - parsing_should_fail(FILE_LINE_ARGS, float_exp_double_e_2); // float-exp-double-e-2 - } - - SECTION("float-exp-double-us") - { - parsing_should_fail(FILE_LINE_ARGS, float_exp_double_us); // float-exp-double-us - } - - SECTION("float-exp-leading-us") - { - parsing_should_fail(FILE_LINE_ARGS, float_exp_leading_us); // float-exp-leading-us - } - - SECTION("float-exp-point-1") - { - parsing_should_fail(FILE_LINE_ARGS, float_exp_point_1); // float-exp-point-1 - } - - SECTION("float-exp-point-2") - { - parsing_should_fail(FILE_LINE_ARGS, float_exp_point_2); // float-exp-point-2 - } - - SECTION("float-exp-trailing-us") - { - parsing_should_fail(FILE_LINE_ARGS, float_exp_trailing_us); // float-exp-trailing-us - } - - SECTION("float-inf-capital") - { - parsing_should_fail(FILE_LINE_ARGS, float_inf_capital); // float-inf-capital - } - - SECTION("float-inf-incomplete-1") - { - parsing_should_fail(FILE_LINE_ARGS, float_inf_incomplete_1); // float-inf-incomplete-1 - } - - SECTION("float-inf-incomplete-2") - { - parsing_should_fail(FILE_LINE_ARGS, float_inf_incomplete_2); // float-inf-incomplete-2 - } - - SECTION("float-inf-incomplete-3") - { - parsing_should_fail(FILE_LINE_ARGS, float_inf_incomplete_3); // float-inf-incomplete-3 - } - - SECTION("float-inf_underscore") - { - parsing_should_fail(FILE_LINE_ARGS, float_inf_underscore); // float-inf_underscore - } - - SECTION("float-leading-point-neg") - { - parsing_should_fail(FILE_LINE_ARGS, float_leading_point_neg); // float-leading-point-neg - } - - SECTION("float-leading-point-plus") - { - parsing_should_fail(FILE_LINE_ARGS, float_leading_point_plus); // float-leading-point-plus - } - - SECTION("float-leading-point") - { - parsing_should_fail(FILE_LINE_ARGS, float_leading_point); // float-leading-point - } - - SECTION("float-leading-us") - { - parsing_should_fail(FILE_LINE_ARGS, float_leading_us); // float-leading-us - } - - SECTION("float-leading-zero-neg") - { - parsing_should_fail(FILE_LINE_ARGS, float_leading_zero_neg); // float-leading-zero-neg - } - - SECTION("float-leading-zero-plus") - { - parsing_should_fail(FILE_LINE_ARGS, float_leading_zero_plus); // float-leading-zero-plus - } - - SECTION("float-leading-zero") - { - parsing_should_fail(FILE_LINE_ARGS, float_leading_zero); // float-leading-zero - } - - SECTION("float-nan-capital") - { - parsing_should_fail(FILE_LINE_ARGS, float_nan_capital); // float-nan-capital - } - - SECTION("float-nan-incomplete-1") - { - parsing_should_fail(FILE_LINE_ARGS, float_nan_incomplete_1); // float-nan-incomplete-1 - } - - SECTION("float-nan-incomplete-2") - { - parsing_should_fail(FILE_LINE_ARGS, float_nan_incomplete_2); // float-nan-incomplete-2 - } - - SECTION("float-nan-incomplete-3") - { - parsing_should_fail(FILE_LINE_ARGS, float_nan_incomplete_3); // float-nan-incomplete-3 - } - - SECTION("float-nan_underscore") - { - parsing_should_fail(FILE_LINE_ARGS, float_nan_underscore); // float-nan_underscore - } - - SECTION("float-trailing-point-min") - { - parsing_should_fail(FILE_LINE_ARGS, float_trailing_point_min); // float-trailing-point-min - } - - SECTION("float-trailing-point-plus") - { - parsing_should_fail(FILE_LINE_ARGS, float_trailing_point_plus); // float-trailing-point-plus - } - - SECTION("float-trailing-point") - { - parsing_should_fail(FILE_LINE_ARGS, float_trailing_point); // float-trailing-point - } - - SECTION("float-trailing-us-exp-1") - { - parsing_should_fail(FILE_LINE_ARGS, float_trailing_us_exp_1); // float-trailing-us-exp-1 - } - - SECTION("float-trailing-us-exp-2") - { - parsing_should_fail(FILE_LINE_ARGS, float_trailing_us_exp_2); // float-trailing-us-exp-2 - } - - SECTION("float-trailing-us") - { - parsing_should_fail(FILE_LINE_ARGS, float_trailing_us); // float-trailing-us - } - - SECTION("float-us-after-point") - { - parsing_should_fail(FILE_LINE_ARGS, float_us_after_point); // float-us-after-point - } - - SECTION("float-us-before-point") - { - parsing_should_fail(FILE_LINE_ARGS, float_us_before_point); // float-us-before-point - } - - SECTION("inline-table-add") - { - parsing_should_fail(FILE_LINE_ARGS, inline_table_add); // inline-table-add - } - - SECTION("inline-table-bad-key-syntax") - { - parsing_should_fail(FILE_LINE_ARGS, inline_table_bad_key_syntax); // inline-table-bad-key-syntax - } - - SECTION("inline-table-dotted-key-conflict") - { - parsing_should_fail(FILE_LINE_ARGS, inline_table_dotted_key_conflict); // inline-table-dotted-key-conflict - } - - SECTION("inline-table-double-comma") - { - parsing_should_fail(FILE_LINE_ARGS, inline_table_double_comma); // inline-table-double-comma - } - - SECTION("inline-table-duplicate-key") - { - parsing_should_fail(FILE_LINE_ARGS, inline_table_duplicate_key); // inline-table-duplicate-key - } - - SECTION("inline-table-empty") - { - parsing_should_fail(FILE_LINE_ARGS, inline_table_empty); // inline-table-empty - } - - SECTION("inline-table-nested_key_conflict") - { - parsing_should_fail(FILE_LINE_ARGS, inline_table_nested_key_conflict); // inline-table-nested_key_conflict - } - - SECTION("inline-table-no-comma") - { - parsing_should_fail(FILE_LINE_ARGS, inline_table_no_comma); // inline-table-no-comma - } - - SECTION("inline-table-overwrite") - { - parsing_should_fail(FILE_LINE_ARGS, inline_table_overwrite); // inline-table-overwrite - } - -#if !TOML_LANG_UNRELEASED - - SECTION("inline-table-linebreak-1") - { - parsing_should_fail(FILE_LINE_ARGS, inline_table_linebreak_1); // inline-table-linebreak-1 - } - - SECTION("inline-table-linebreak-2") - { - parsing_should_fail(FILE_LINE_ARGS, inline_table_linebreak_2); // inline-table-linebreak-2 - } - - SECTION("inline-table-linebreak-3") - { - parsing_should_fail(FILE_LINE_ARGS, inline_table_linebreak_3); // inline-table-linebreak-3 - } - - SECTION("inline-table-linebreak-4") - { - parsing_should_fail(FILE_LINE_ARGS, inline_table_linebreak_4); // inline-table-linebreak-4 - } - - SECTION("inline-table-trailing-comma") - { - parsing_should_fail(FILE_LINE_ARGS, inline_table_trailing_comma); // inline-table-trailing-comma - } - -#endif // !TOML_LANG_UNRELEASED - - SECTION("integer-capital-bin") - { - parsing_should_fail(FILE_LINE_ARGS, integer_capital_bin); // integer-capital-bin - } - - SECTION("integer-capital-hex") - { - parsing_should_fail(FILE_LINE_ARGS, integer_capital_hex); // integer-capital-hex - } - - SECTION("integer-capital-oct") - { - parsing_should_fail(FILE_LINE_ARGS, integer_capital_oct); // integer-capital-oct - } - - SECTION("integer-double-sign-nex") - { - parsing_should_fail(FILE_LINE_ARGS, integer_double_sign_nex); // integer-double-sign-nex - } - - SECTION("integer-double-sign-plus") - { - parsing_should_fail(FILE_LINE_ARGS, integer_double_sign_plus); // integer-double-sign-plus - } - - SECTION("integer-double-us") - { - parsing_should_fail(FILE_LINE_ARGS, integer_double_us); // integer-double-us - } - - SECTION("integer-incomplete-bin") - { - parsing_should_fail(FILE_LINE_ARGS, integer_incomplete_bin); // integer-incomplete-bin - } - - SECTION("integer-incomplete-hex") - { - parsing_should_fail(FILE_LINE_ARGS, integer_incomplete_hex); // integer-incomplete-hex - } - - SECTION("integer-incomplete-oct") - { - parsing_should_fail(FILE_LINE_ARGS, integer_incomplete_oct); // integer-incomplete-oct - } - - SECTION("integer-invalid-bin") - { - parsing_should_fail(FILE_LINE_ARGS, integer_invalid_bin); // integer-invalid-bin - } - - SECTION("integer-invalid-hex") - { - parsing_should_fail(FILE_LINE_ARGS, integer_invalid_hex); // integer-invalid-hex - } - - SECTION("integer-invalid-oct") - { - parsing_should_fail(FILE_LINE_ARGS, integer_invalid_oct); // integer-invalid-oct - } - - SECTION("integer-leading-us-bin") - { - parsing_should_fail(FILE_LINE_ARGS, integer_leading_us_bin); // integer-leading-us-bin - } - - SECTION("integer-leading-us-hex") - { - parsing_should_fail(FILE_LINE_ARGS, integer_leading_us_hex); // integer-leading-us-hex - } - - SECTION("integer-leading-us-oct") - { - parsing_should_fail(FILE_LINE_ARGS, integer_leading_us_oct); // integer-leading-us-oct - } - - SECTION("integer-leading-us") - { - parsing_should_fail(FILE_LINE_ARGS, integer_leading_us); // integer-leading-us - } - - SECTION("integer-leading-zero-1") - { - parsing_should_fail(FILE_LINE_ARGS, integer_leading_zero_1); // integer-leading-zero-1 - } - - SECTION("integer-leading-zero-2") - { - parsing_should_fail(FILE_LINE_ARGS, integer_leading_zero_2); // integer-leading-zero-2 - } - - SECTION("integer-leading-zero-3") - { - parsing_should_fail(FILE_LINE_ARGS, integer_leading_zero_3); // integer-leading-zero-3 - } - - SECTION("integer-leading-zero-sign-1") - { - parsing_should_fail(FILE_LINE_ARGS, integer_leading_zero_sign_1); // integer-leading-zero-sign-1 - } - - SECTION("integer-leading-zero-sign-2") - { - parsing_should_fail(FILE_LINE_ARGS, integer_leading_zero_sign_2); // integer-leading-zero-sign-2 - } - - SECTION("integer-leading-zero-sign-3") - { - parsing_should_fail(FILE_LINE_ARGS, integer_leading_zero_sign_3); // integer-leading-zero-sign-3 - } - - SECTION("integer-negative-bin") - { - parsing_should_fail(FILE_LINE_ARGS, integer_negative_bin); // integer-negative-bin - } - - SECTION("integer-negative-hex") - { - parsing_should_fail(FILE_LINE_ARGS, integer_negative_hex); // integer-negative-hex - } - - SECTION("integer-negative-oct") - { - parsing_should_fail(FILE_LINE_ARGS, integer_negative_oct); // integer-negative-oct - } - - SECTION("integer-positive-bin") - { - parsing_should_fail(FILE_LINE_ARGS, integer_positive_bin); // integer-positive-bin - } - - SECTION("integer-positive-hex") - { - parsing_should_fail(FILE_LINE_ARGS, integer_positive_hex); // integer-positive-hex - } - - SECTION("integer-positive-oct") - { - parsing_should_fail(FILE_LINE_ARGS, integer_positive_oct); // integer-positive-oct - } - - SECTION("integer-text-after-integer") - { - parsing_should_fail(FILE_LINE_ARGS, integer_text_after_integer); // integer-text-after-integer - } - - SECTION("integer-trailing-us-bin") - { - parsing_should_fail(FILE_LINE_ARGS, integer_trailing_us_bin); // integer-trailing-us-bin - } - - SECTION("integer-trailing-us-hex") - { - parsing_should_fail(FILE_LINE_ARGS, integer_trailing_us_hex); // integer-trailing-us-hex - } - - SECTION("integer-trailing-us-oct") - { - parsing_should_fail(FILE_LINE_ARGS, integer_trailing_us_oct); // integer-trailing-us-oct - } - - SECTION("integer-trailing-us") - { - parsing_should_fail(FILE_LINE_ARGS, integer_trailing_us); // integer-trailing-us - } - - SECTION("integer-us-after-bin") - { - parsing_should_fail(FILE_LINE_ARGS, integer_us_after_bin); // integer-us-after-bin - } - - SECTION("integer-us-after-hex") - { - parsing_should_fail(FILE_LINE_ARGS, integer_us_after_hex); // integer-us-after-hex - } - - SECTION("integer-us-after-oct") - { - parsing_should_fail(FILE_LINE_ARGS, integer_us_after_oct); // integer-us-after-oct - } - - SECTION("key-after-array") - { - parsing_should_fail(FILE_LINE_ARGS, key_after_array); // key-after-array - } - - SECTION("key-after-table") - { - parsing_should_fail(FILE_LINE_ARGS, key_after_table); // key-after-table - } - - SECTION("key-after-value") - { - parsing_should_fail(FILE_LINE_ARGS, key_after_value); // key-after-value - } - - SECTION("key-bare-invalid-character") - { - parsing_should_fail(FILE_LINE_ARGS, key_bare_invalid_character); // key-bare-invalid-character - } - - SECTION("key-dotted-redefine-table") - { - parsing_should_fail(FILE_LINE_ARGS, key_dotted_redefine_table); // key-dotted-redefine-table - } - - SECTION("key-duplicate-keys") - { - parsing_should_fail(FILE_LINE_ARGS, key_duplicate_keys); // key-duplicate-keys - } - - SECTION("key-duplicate") - { - parsing_should_fail(FILE_LINE_ARGS, key_duplicate); // key-duplicate - } - - SECTION("key-empty") - { - parsing_should_fail(FILE_LINE_ARGS, key_empty); // key-empty - } - - SECTION("key-escape") - { - parsing_should_fail(FILE_LINE_ARGS, key_escape); // key-escape - } - - SECTION("key-hash") - { - parsing_should_fail(FILE_LINE_ARGS, key_hash); // key-hash - } - - SECTION("key-multiline") - { - parsing_should_fail(FILE_LINE_ARGS, key_multiline); // key-multiline - } - - SECTION("key-newline") - { - parsing_should_fail(FILE_LINE_ARGS, key_newline); // key-newline - } - - SECTION("key-no-eol") - { - parsing_should_fail(FILE_LINE_ARGS, key_no_eol); // key-no-eol - } - - SECTION("key-open-bracket") - { - parsing_should_fail(FILE_LINE_ARGS, key_open_bracket); // key-open-bracket - } - - SECTION("key-partial-quoted") - { - parsing_should_fail(FILE_LINE_ARGS, key_partial_quoted); // key-partial-quoted - } - - SECTION("key-quoted-unclosed-1") - { - parsing_should_fail(FILE_LINE_ARGS, key_quoted_unclosed_1); // key-quoted-unclosed-1 - } - - SECTION("key-quoted-unclosed-2") - { - parsing_should_fail(FILE_LINE_ARGS, key_quoted_unclosed_2); // key-quoted-unclosed-2 - } - - SECTION("key-single-open-bracket") - { - parsing_should_fail(FILE_LINE_ARGS, key_single_open_bracket); // key-single-open-bracket - } - - SECTION("key-space") - { - parsing_should_fail(FILE_LINE_ARGS, key_space); // key-space - } - - SECTION("key-start-bracket") - { - parsing_should_fail(FILE_LINE_ARGS, key_start_bracket); // key-start-bracket - } - - SECTION("key-start-dot") - { - parsing_should_fail(FILE_LINE_ARGS, key_start_dot); // key-start-dot - } - - SECTION("key-two-equals") - { - parsing_should_fail(FILE_LINE_ARGS, key_two_equals); // key-two-equals - } - - SECTION("key-two-equals2") - { - parsing_should_fail(FILE_LINE_ARGS, key_two_equals2); // key-two-equals2 - } - - SECTION("key-two-equals3") - { - parsing_should_fail(FILE_LINE_ARGS, key_two_equals3); // key-two-equals3 - } - - SECTION("key-without-value-1") - { - parsing_should_fail(FILE_LINE_ARGS, key_without_value_1); // key-without-value-1 - } - - SECTION("key-without-value-2") - { - parsing_should_fail(FILE_LINE_ARGS, key_without_value_2); // key-without-value-2 - } - - SECTION("key-without-value-3") - { - parsing_should_fail(FILE_LINE_ARGS, key_without_value_3); // key-without-value-3 - } - - SECTION("key-without-value-4") - { - parsing_should_fail(FILE_LINE_ARGS, key_without_value_4); // key-without-value-4 - } - -#if !TOML_LANG_UNRELEASED && UNICODE_LITERALS_OK - - SECTION("key-special-character") - { - parsing_should_fail(FILE_LINE_ARGS, key_special_character); // key-special-character - } - -#endif // !TOML_LANG_UNRELEASED && UNICODE_LITERALS_OK - - SECTION("local-date-mday-over") - { - parsing_should_fail(FILE_LINE_ARGS, local_date_mday_over); // local-date-mday-over - } - - SECTION("local-date-mday-under") - { - parsing_should_fail(FILE_LINE_ARGS, local_date_mday_under); // local-date-mday-under - } - - SECTION("local-date-month-over") - { - parsing_should_fail(FILE_LINE_ARGS, local_date_month_over); // local-date-month-over - } - - SECTION("local-date-month-under") - { - parsing_should_fail(FILE_LINE_ARGS, local_date_month_under); // local-date-month-under - } - - SECTION("local-date-no-leads-with-milli") - { - parsing_should_fail(FILE_LINE_ARGS, local_date_no_leads_with_milli); // local-date-no-leads-with-milli - } - - SECTION("local-date-no-leads") - { - parsing_should_fail(FILE_LINE_ARGS, local_date_no_leads); // local-date-no-leads - } - - SECTION("local-date-trailing-t") - { - parsing_should_fail(FILE_LINE_ARGS, local_date_trailing_t); // local-date-trailing-t - } - - SECTION("local-datetime-hour-over") - { - parsing_should_fail(FILE_LINE_ARGS, local_datetime_hour_over); // local-datetime-hour-over - } - - SECTION("local-datetime-mday-over") - { - parsing_should_fail(FILE_LINE_ARGS, local_datetime_mday_over); // local-datetime-mday-over - } - - SECTION("local-datetime-mday-under") - { - parsing_should_fail(FILE_LINE_ARGS, local_datetime_mday_under); // local-datetime-mday-under - } - - SECTION("local-datetime-minute-over") - { - parsing_should_fail(FILE_LINE_ARGS, local_datetime_minute_over); // local-datetime-minute-over - } - - SECTION("local-datetime-month-over") - { - parsing_should_fail(FILE_LINE_ARGS, local_datetime_month_over); // local-datetime-month-over - } - - SECTION("local-datetime-month-under") - { - parsing_should_fail(FILE_LINE_ARGS, local_datetime_month_under); // local-datetime-month-under - } - - SECTION("local-datetime-no-leads-with-milli") - { - parsing_should_fail(FILE_LINE_ARGS, local_datetime_no_leads_with_milli); // local-datetime-no-leads-with-milli - } - - SECTION("local-datetime-no-leads") - { - parsing_should_fail(FILE_LINE_ARGS, local_datetime_no_leads); // local-datetime-no-leads - } - - SECTION("local-datetime-no-secs") - { - parsing_should_fail(FILE_LINE_ARGS, local_datetime_no_secs); // local-datetime-no-secs - } - - SECTION("local-datetime-no-t") - { - parsing_should_fail(FILE_LINE_ARGS, local_datetime_no_t); // local-datetime-no-t - } - - SECTION("local-datetime-second-over") - { - parsing_should_fail(FILE_LINE_ARGS, local_datetime_second_over); // local-datetime-second-over - } - - SECTION("local-datetime-time-no-leads") - { - parsing_should_fail(FILE_LINE_ARGS, local_datetime_time_no_leads); // local-datetime-time-no-leads - } - - SECTION("local-time-hour-over") - { - parsing_should_fail(FILE_LINE_ARGS, local_time_hour_over); // local-time-hour-over - } - - SECTION("local-time-minute-over") - { - parsing_should_fail(FILE_LINE_ARGS, local_time_minute_over); // local-time-minute-over - } - - SECTION("local-time-no-secs") - { - parsing_should_fail(FILE_LINE_ARGS, local_time_no_secs); // local-time-no-secs - } - - SECTION("local-time-second-over") - { - parsing_should_fail(FILE_LINE_ARGS, local_time_second_over); // local-time-second-over - } - - SECTION("local-time-time-no-leads-2") - { - parsing_should_fail(FILE_LINE_ARGS, local_time_time_no_leads_2); // local-time-time-no-leads-2 - } - - SECTION("local-time-time-no-leads") - { - parsing_should_fail(FILE_LINE_ARGS, local_time_time_no_leads); // local-time-time-no-leads - } - - SECTION("spec-inline-table-2-0") - { - parsing_should_fail(FILE_LINE_ARGS, spec_inline_table_2_0); // spec-inline-table-2-0 - } - - SECTION("spec-inline-table-3-0") - { - parsing_should_fail(FILE_LINE_ARGS, spec_inline_table_3_0); // spec-inline-table-3-0 - } - - SECTION("spec-key-value-pair-1") - { - parsing_should_fail(FILE_LINE_ARGS, spec_key_value_pair_1); // spec-key-value-pair-1 - } - - SECTION("spec-keys-2") - { - parsing_should_fail(FILE_LINE_ARGS, spec_keys_2); // spec-keys-2 - } - - SECTION("spec-string-4-0") - { - parsing_should_fail(FILE_LINE_ARGS, spec_string_4_0); // spec-string-4-0 - } - - SECTION("spec-string-7-0") - { - parsing_should_fail(FILE_LINE_ARGS, spec_string_7_0); // spec-string-7-0 - } - - SECTION("spec-table-9-0") - { - parsing_should_fail(FILE_LINE_ARGS, spec_table_9_0); // spec-table-9-0 - } - - SECTION("spec-table-9-1") - { - parsing_should_fail(FILE_LINE_ARGS, spec_table_9_1); // spec-table-9-1 - } - - SECTION("string-bad-byte-escape") - { - parsing_should_fail(FILE_LINE_ARGS, string_bad_byte_escape); // string-bad-byte-escape - } - - SECTION("string-bad-codepoint") - { - parsing_should_fail(FILE_LINE_ARGS, string_bad_codepoint); // string-bad-codepoint - } - - SECTION("string-bad-concat") - { - parsing_should_fail(FILE_LINE_ARGS, string_bad_concat); // string-bad-concat - } - - SECTION("string-bad-escape-1") - { - parsing_should_fail(FILE_LINE_ARGS, string_bad_escape_1); // string-bad-escape-1 - } - - SECTION("string-bad-escape-2") - { - parsing_should_fail(FILE_LINE_ARGS, string_bad_escape_2); // string-bad-escape-2 - } - - SECTION("string-bad-hex-esc-1") - { - parsing_should_fail(FILE_LINE_ARGS, string_bad_hex_esc_1); // string-bad-hex-esc-1 - } - - SECTION("string-bad-hex-esc-2") - { - parsing_should_fail(FILE_LINE_ARGS, string_bad_hex_esc_2); // string-bad-hex-esc-2 - } - - SECTION("string-bad-hex-esc-3") - { - parsing_should_fail(FILE_LINE_ARGS, string_bad_hex_esc_3); // string-bad-hex-esc-3 - } - - SECTION("string-bad-hex-esc-4") - { - parsing_should_fail(FILE_LINE_ARGS, string_bad_hex_esc_4); // string-bad-hex-esc-4 - } - - SECTION("string-bad-hex-esc-5") - { - parsing_should_fail(FILE_LINE_ARGS, string_bad_hex_esc_5); // string-bad-hex-esc-5 - } - - SECTION("string-bad-multiline") - { - parsing_should_fail(FILE_LINE_ARGS, string_bad_multiline); // string-bad-multiline - } - - SECTION("string-bad-slash-escape") - { - parsing_should_fail(FILE_LINE_ARGS, string_bad_slash_escape); // string-bad-slash-escape - } - - SECTION("string-bad-uni-esc-1") - { - parsing_should_fail(FILE_LINE_ARGS, string_bad_uni_esc_1); // string-bad-uni-esc-1 - } - - SECTION("string-bad-uni-esc-2") - { - parsing_should_fail(FILE_LINE_ARGS, string_bad_uni_esc_2); // string-bad-uni-esc-2 - } - - SECTION("string-bad-uni-esc-3") - { - parsing_should_fail(FILE_LINE_ARGS, string_bad_uni_esc_3); // string-bad-uni-esc-3 - } - - SECTION("string-bad-uni-esc-4") - { - parsing_should_fail(FILE_LINE_ARGS, string_bad_uni_esc_4); // string-bad-uni-esc-4 - } - - SECTION("string-bad-uni-esc-5") - { - parsing_should_fail(FILE_LINE_ARGS, string_bad_uni_esc_5); // string-bad-uni-esc-5 - } - - SECTION("string-basic-multiline-out-of-range-unicode-escape-1") - { - parsing_should_fail( - FILE_LINE_ARGS, - string_basic_multiline_out_of_range_unicode_escape_1); // string-basic-multiline-out-of-range-unicode-escape-1 - } - - SECTION("string-basic-multiline-out-of-range-unicode-escape-2") - { - parsing_should_fail( - FILE_LINE_ARGS, - string_basic_multiline_out_of_range_unicode_escape_2); // string-basic-multiline-out-of-range-unicode-escape-2 - } - - SECTION("string-basic-multiline-quotes") - { - parsing_should_fail(FILE_LINE_ARGS, string_basic_multiline_quotes); // string-basic-multiline-quotes - } - - SECTION("string-basic-multiline-unknown-escape") - { - parsing_should_fail(FILE_LINE_ARGS, - string_basic_multiline_unknown_escape); // string-basic-multiline-unknown-escape - } - - SECTION("string-basic-out-of-range-unicode-escape-1") - { - parsing_should_fail(FILE_LINE_ARGS, - string_basic_out_of_range_unicode_escape_1); // string-basic-out-of-range-unicode-escape-1 - } - - SECTION("string-basic-out-of-range-unicode-escape-2") - { - parsing_should_fail(FILE_LINE_ARGS, - string_basic_out_of_range_unicode_escape_2); // string-basic-out-of-range-unicode-escape-2 - } - - SECTION("string-basic-unknown-escape") - { - parsing_should_fail(FILE_LINE_ARGS, string_basic_unknown_escape); // string-basic-unknown-escape - } - - SECTION("string-literal-multiline-quotes-1") - { - parsing_should_fail(FILE_LINE_ARGS, string_literal_multiline_quotes_1); // string-literal-multiline-quotes-1 - } - - SECTION("string-literal-multiline-quotes-2") - { - parsing_should_fail(FILE_LINE_ARGS, string_literal_multiline_quotes_2); // string-literal-multiline-quotes-2 - } - - SECTION("string-missing-quotes") - { - parsing_should_fail(FILE_LINE_ARGS, string_missing_quotes); // string-missing-quotes - } - - SECTION("string-multiline-bad-escape-1") - { - parsing_should_fail(FILE_LINE_ARGS, string_multiline_bad_escape_1); // string-multiline-bad-escape-1 - } - - SECTION("string-multiline-bad-escape-2") - { - parsing_should_fail(FILE_LINE_ARGS, string_multiline_bad_escape_2); // string-multiline-bad-escape-2 - } - - SECTION("string-multiline-bad-escape-3") - { - parsing_should_fail(FILE_LINE_ARGS, string_multiline_bad_escape_3); // string-multiline-bad-escape-3 - } - - SECTION("string-multiline-escape-space") - { - parsing_should_fail(FILE_LINE_ARGS, string_multiline_escape_space); // string-multiline-escape-space - } - - SECTION("string-multiline-no-close-2") - { - parsing_should_fail(FILE_LINE_ARGS, string_multiline_no_close_2); // string-multiline-no-close-2 - } - - SECTION("string-multiline-no-close") - { - parsing_should_fail(FILE_LINE_ARGS, string_multiline_no_close); // string-multiline-no-close - } - - SECTION("string-multiline-quotes-1") - { - parsing_should_fail(FILE_LINE_ARGS, string_multiline_quotes_1); // string-multiline-quotes-1 - } - - SECTION("string-no-close") - { - parsing_should_fail(FILE_LINE_ARGS, string_no_close); // string-no-close - } - - SECTION("string-text-after-string") - { - parsing_should_fail(FILE_LINE_ARGS, string_text_after_string); // string-text-after-string - } - - SECTION("string-wrong-close") - { - parsing_should_fail(FILE_LINE_ARGS, string_wrong_close); // string-wrong-close - } - -#if !TOML_LANG_UNRELEASED - - SECTION("string-basic-byte-escapes") - { - parsing_should_fail(FILE_LINE_ARGS, string_basic_byte_escapes); // string-basic-byte-escapes - } - -#endif // !TOML_LANG_UNRELEASED - - SECTION("table-append-to-array-with-dotted-keys") - { - parsing_should_fail(FILE_LINE_ARGS, - table_append_to_array_with_dotted_keys); // table-append-to-array-with-dotted-keys - } - - SECTION("table-append-with-dotted-keys-1") - { - parsing_should_fail(FILE_LINE_ARGS, table_append_with_dotted_keys_1); // table-append-with-dotted-keys-1 - } - - SECTION("table-append-with-dotted-keys-2") - { - parsing_should_fail(FILE_LINE_ARGS, table_append_with_dotted_keys_2); // table-append-with-dotted-keys-2 - } - - SECTION("table-array-empty") - { - parsing_should_fail(FILE_LINE_ARGS, table_array_empty); // table-array-empty - } - - SECTION("table-array-implicit") - { - parsing_should_fail(FILE_LINE_ARGS, table_array_implicit); // table-array-implicit - } - - SECTION("table-array-missing-bracket") - { - parsing_should_fail(FILE_LINE_ARGS, table_array_missing_bracket); // table-array-missing-bracket - } - - SECTION("table-duplicate-key-dotted-array") - { - parsing_should_fail(FILE_LINE_ARGS, table_duplicate_key_dotted_array); // table-duplicate-key-dotted-array - } - - SECTION("table-duplicate-key-dotted-table") - { - parsing_should_fail(FILE_LINE_ARGS, table_duplicate_key_dotted_table); // table-duplicate-key-dotted-table - } - - SECTION("table-duplicate-key-dotted-table2") - { - parsing_should_fail(FILE_LINE_ARGS, table_duplicate_key_dotted_table2); // table-duplicate-key-dotted-table2 - } - - SECTION("table-duplicate-key-table") - { - parsing_should_fail(FILE_LINE_ARGS, table_duplicate_key_table); // table-duplicate-key-table - } - - SECTION("table-duplicate-table-array") - { - parsing_should_fail(FILE_LINE_ARGS, table_duplicate_table_array); // table-duplicate-table-array - } - - SECTION("table-duplicate-table-array2") - { - parsing_should_fail(FILE_LINE_ARGS, table_duplicate_table_array2); // table-duplicate-table-array2 - } - - SECTION("table-duplicate") - { - parsing_should_fail(FILE_LINE_ARGS, table_duplicate); // table-duplicate - } - - SECTION("table-empty-implicit-table") - { - parsing_should_fail(FILE_LINE_ARGS, table_empty_implicit_table); // table-empty-implicit-table - } - - SECTION("table-empty") - { - parsing_should_fail(FILE_LINE_ARGS, table_empty); // table-empty - } - - SECTION("table-equals-sign") - { - parsing_should_fail(FILE_LINE_ARGS, table_equals_sign); // table-equals-sign - } - - SECTION("table-llbrace") - { - parsing_should_fail(FILE_LINE_ARGS, table_llbrace); // table-llbrace - } - - SECTION("table-nested-brackets-close") - { - parsing_should_fail(FILE_LINE_ARGS, table_nested_brackets_close); // table-nested-brackets-close - } - - SECTION("table-nested-brackets-open") - { - parsing_should_fail(FILE_LINE_ARGS, table_nested_brackets_open); // table-nested-brackets-open - } - - SECTION("table-quoted-no-close") - { - parsing_should_fail(FILE_LINE_ARGS, table_quoted_no_close); // table-quoted-no-close - } - - SECTION("table-redefine") - { - parsing_should_fail(FILE_LINE_ARGS, table_redefine); // table-redefine - } - - SECTION("table-rrbrace") - { - parsing_should_fail(FILE_LINE_ARGS, table_rrbrace); // table-rrbrace - } - - SECTION("table-text-after-table") - { - parsing_should_fail(FILE_LINE_ARGS, table_text_after_table); // table-text-after-table - } - - SECTION("table-whitespace") - { - parsing_should_fail(FILE_LINE_ARGS, table_whitespace); // table-whitespace - } - - SECTION("table-with-pound") - { - parsing_should_fail(FILE_LINE_ARGS, table_with_pound); // table-with-pound - } -} diff --git a/tests/conformance_burntsushi_valid.cpp b/tests/conformance_burntsushi_valid.cpp deleted file mode 100644 index 14520d6..0000000 --- a/tests/conformance_burntsushi_valid.cpp +++ /dev/null @@ -1,4734 +0,0 @@ -// This file is a part of toml++ and is subject to the the terms of the MIT license. -// Copyright (c) Mark Gillard -// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text. -// SPDX-License-Identifier: MIT -//----- -// this file was generated by generate_conformance_tests.py - do not modify it directly - -#include "tests.hpp" - -namespace -{ - static constexpr auto array_array = R"(ints = [1, 2, 3, ] -floats = [1.1, 2.1, 3.1] -strings = ["a", "b", "c"] -dates = [ - 1987-07-05T17:45:00Z, - 1979-05-27T07:32:00Z, - 2006-06-01T11:00:00Z, -] -comments = [ - 1, - 2, #this is ok -])"sv; - static constexpr auto array_bool = R"(a = [true, false])"sv; - static constexpr auto array_empty = R"(thevoid = [[[[[]]]]])"sv; - static constexpr auto array_hetergeneous = R"(mixed = [[1, 2], ["a", "b"], [1.1, 2.1]])"sv; - static constexpr auto array_mixed_int_array = R"(arrays-and-ints = [1, ["Arrays are not integers."]])"sv; - static constexpr auto array_mixed_int_float = R"(ints-and-floats = [1, 1.1])"sv; - static constexpr auto array_mixed_int_string = R"(strings-and-ints = ["hi", 42])"sv; - static constexpr auto array_mixed_string_table = R"(contributors = [ - "Foo Bar ", - { name = "Baz Qux", email = "bazqux@example.com", url = "https://example.com/bazqux" } -] - -# Start with a table as the first element. This tests a case that some libraries -# might have where they will check if the first entry is a table/map/hash/assoc -# array and then encode it as a table array. This was a reasonable thing to do -# before TOML 1.0 since arrays could only contain one type, but now it's no -# longer. -mixed = [{k="a"}, "b", 1])"sv; - static constexpr auto array_nested_double = R"(nest = [ - [ - ["a"], - [1, 2, [3]] - ] -])"sv; - static constexpr auto array_nested_inline_table = R"(a = [ { b = {} } ])"sv; - static constexpr auto array_nested = R"(nest = [["a"], ["b"]])"sv; - static constexpr auto array_nospaces = R"(ints = [1,2,3])"sv; - static constexpr auto array_string_quote_comma_2 = R"(title = [ " \", ",])"sv; - static constexpr auto array_string_quote_comma = R"(title = [ -"Client: \"XXXX\", Job: XXXX", -"Code: XXXX" -])"sv; - static constexpr auto array_string_with_comma_2 = R"(title = [ -"""Client: XXXX, -Job: XXXX""", -"Code: XXXX" -])"sv; - static constexpr auto array_string_with_comma = R"(title = [ -"Client: XXXX, Job: XXXX", -"Code: XXXX" -])"sv; - static constexpr auto array_strings = R"(string_array = [ "all", 'strings', """are the same""", '''type'''])"sv; - static constexpr auto array_table_array_string_backslash = R"(foo = [ { bar="\"{{baz}}\""} ])"sv; - - static constexpr auto bool_bool = R"(t = true -f = false)"sv; - - static constexpr auto comment_after_literal_no_ws = R"(inf=inf#infinity -nan=nan#not a number -true=true#true -false=false#false)"sv; - static constexpr auto comment_at_eof = R"(# This is a full-line comment -key = "value" # This is a comment at the end of a line)"sv; - static constexpr auto comment_at_eof2 = R"(# This is a full-line comment -key = "value" # This is a comment at the end of a line)"sv; - static constexpr auto comment_everywhere = R"(# Top comment. - # Top comment. -# Top comment. - -# [no-extraneous-groups-please] - -[group] # Comment -answer = 42 # Comment -# no-extraneous-keys-please = 999 -# Inbetween comment. -more = [ # Comment - # What about multiple # comments? - # Can you handle it? - # - # Evil. -# Evil. - 42, 42, # Comments within arrays are fun. - # What about multiple # comments? - # Can you handle it? - # - # Evil. -# Evil. -# ] Did I fool you? -] # Hopefully not. - -# Make sure the space between the datetime and "#" isn't lexed. -dt = 1979-05-27T07:32:12-07:00 # c -d = 1979-05-27 # Comment)"sv; - static constexpr auto comment_noeol = R"(# single comment without any eol characters)"sv; - static constexpr auto comment_tricky = R"([section]#attached comment -#[notsection] -one = "11"#cmt -two = "22#" -three = '#' - -four = """# no comment -# nor this -#also not comment"""#is_comment - -five = 5.5#66 -six = 6#7 -8 = "eight" -#nine = 99 -ten = 10e2#1 -eleven = 1.11e1#23 - -["hash#tag"] -"#!" = "hash bang" -arr3 = [ "#", '#', """###""" ] -arr4 = [ 1,# 9, 9, -2#,9 -,#9 -3#] -,4] -arr5 = [[[[#["#"], -["#"]]]]#] -] -tbl1 = { "#" = '}#'}#}})"sv; - -#if UNICODE_LITERALS_OK - - static constexpr auto comment_nonascii = R"(# ~ € ÿ ퟿  ￿ 𐀀 􏿿)"sv; - -#endif // UNICODE_LITERALS_OK - - static constexpr auto datetime_datetime = R"(space = 1987-07-05 17:45:00Z -lower = 1987-07-05t17:45:00z)"sv; - static constexpr auto datetime_local_date = R"(bestdayever = 1987-07-05)"sv; - static constexpr auto datetime_local_time = R"(besttimeever = 17:45:00 -milliseconds = 10:32:00.555)"sv; - static constexpr auto datetime_local = R"(local = 1987-07-05T17:45:00 -milli = 1977-12-21T10:32:00.555 -space = 1987-07-05 17:45:00)"sv; - static constexpr auto datetime_milliseconds = R"(utc1 = 1987-07-05T17:45:56.123Z -utc2 = 1987-07-05T17:45:56.6Z -wita1 = 1987-07-05T17:45:56.123+08:00 -wita2 = 1987-07-05T17:45:56.6+08:00)"sv; - static constexpr auto datetime_timezone = R"(utc = 1987-07-05T17:45:56Z -pdt = 1987-07-05T17:45:56-05:00 -nzst = 1987-07-05T17:45:56+12:00 -nzdt = 1987-07-05T17:45:56+13:00 # DST)"sv; - -#if TOML_LANG_UNRELEASED - - static constexpr auto datetime_no_seconds = R"(# Seconds are optional in date-time and time. -without-seconds-1 = 13:37 -without-seconds-2 = 1979-05-27 07:32Z -without-seconds-3 = 1979-05-27 07:32-07:00 -without-seconds-4 = 1979-05-27T07:32)"sv; - -#endif // TOML_LANG_UNRELEASED - - static constexpr auto empty_file = R"()"sv; - - static constexpr auto example = R"(best-day-ever = 1987-07-05T17:45:00Z - -[numtheory] -boring = false -perfection = [6, 28, 496])"sv; - - static constexpr auto float_exponent = R"(lower = 3e2 -upper = 3E2 -neg = 3e-2 -pos = 3E+2 -zero = 3e0 -pointlower = 3.1e2 -pointupper = 3.1E2 -minustenth = -1E-1)"sv; - static constexpr auto float_float = R"(pi = 3.14 -pospi = +3.14 -negpi = -3.14 -zero-intpart = 0.123)"sv; - static constexpr auto float_inf_and_nan = - R"(# We don't encode +nan and -nan back with the signs; many languages don't -# support a sign on NaN (it doesn't really make much sense). -nan = nan -nan_neg = -nan -nan_plus = +nan -infinity = inf -infinity_neg = -inf -infinity_plus = +inf)"sv; - static constexpr auto float_long = R"(longpi = 3.141592653589793 -neglongpi = -3.141592653589793)"sv; - static constexpr auto float_underscore = R"(before = 3_141.5927 -after = 3141.592_7 -exponent = 3e1_4)"sv; - static constexpr auto float_zero = R"(zero = 0.0 -signed-pos = +0.0 -signed-neg = -0.0 -exponent = 0e0 -exponent-two-0 = 0e00 -exponent-signed-pos = +0e0 -exponent-signed-neg = -0e0)"sv; - - static constexpr auto implicit_and_explicit_after = R"([a.b.c] -answer = 42 - -[a] -better = 43)"sv; - static constexpr auto implicit_and_explicit_before = R"([a] -better = 43 - -[a.b.c] -answer = 42)"sv; - static constexpr auto implicit_groups = R"([a.b.c] -answer = 42)"sv; - - static constexpr auto inline_table_array = R"(people = [{first_name = "Bruce", last_name = "Springsteen"}, - {first_name = "Eric", last_name = "Clapton"}, - {first_name = "Bob", last_name = "Seger"}])"sv; - static constexpr auto inline_table_bool = R"(a = {a = true, b = false})"sv; - static constexpr auto inline_table_empty = R"(empty1 = {} -empty2 = { } -empty_in_array = [ { not_empty = 1 }, {} ] -empty_in_array2 = [{},{not_empty=1}] -many_empty = [{},{},{}] -nested_empty = {"empty"={}})"sv; - static constexpr auto inline_table_end_in_bool = - R"(black = { python=">3.6", version=">=18.9b0", allow_prereleases=true })"sv; - static constexpr auto inline_table_inline_table = R"(name = { first = "Tom", last = "Preston-Werner" } -point = { x = 1, y = 2 } -simple = { a = 1 } -str-key = { "a" = 1 } -table-array = [{ "a" = 1 }, { "b" = 2 }])"sv; - static constexpr auto inline_table_multiline = R"(tbl_multiline = { a = 1, b = """ -multiline -""", c = """and yet -another line""", d = 4 })"sv; - static constexpr auto inline_table_nest = R"(tbl_tbl_empty = { tbl_0 = {} } -tbl_tbl_val = { tbl_1 = { one = 1 } } -tbl_arr_tbl = { arr_tbl = [ { one = 1 } ] } -arr_tbl_tbl = [ { tbl = { one = 1 } } ] - -# Array-of-array-of-table is interesting because it can only -# be represented in inline form. -arr_arr_tbl_empty = [ [ {} ] ] -arr_arr_tbl_val = [ [ { one = 1 } ] ] -arr_arr_tbls = [ [ { one = 1 }, { two = 2 } ] ])"sv; - -#if !TOML_MSVC - - static constexpr auto inline_table_key_dotted = R"(inline = {a.b = 42} - -many.dots.here.dot.dot.dot = {a.b.c = 1, a.b.d = 2} - -a = { a.b = 1 } -b = { "a"."b" = 1 } -c = { a . b = 1 } -d = { 'a' . "b" = 1 } -e = {a.b=1} - -[tbl] -a.b.c = {d.e=1} - -[tbl.x] -a.b.c = {d.e=1} - -[[arr]] -t = {a.b=1} -T = {a.b=1} - -[[arr]] -t = {a.b=2} -T = {a.b=2})"sv; - -#endif // !TOML_MSVC - -#if TOML_LANG_UNRELEASED - - static constexpr auto inline_table_newline = R"(# TOML 1.1 supports newlines in inline tables and trailing commas. - -trailing-comma-1 = { - c = 1, -} -trailing-comma-2 = { c = 1, } - -tbl-1 = { - hello = "world", - 1 = 2, - arr = [1, - 2, - 3, - ], - tbl = { - k = 1, - } -} - -tbl-2 = { - k = """ - Hello - """ -})"sv; - -#endif // TOML_LANG_UNRELEASED - - static constexpr auto integer_integer = R"(answer = 42 -posanswer = +42 -neganswer = -42 -zero = 0)"sv; - static constexpr auto integer_literals = R"(bin1 = 0b11010110 -bin2 = 0b1_0_1 - -oct1 = 0o01234567 -oct2 = 0o755 -oct3 = 0o7_6_5 - -hex1 = 0xDEADBEEF -hex2 = 0xdeadbeef -hex3 = 0xdead_beef -hex4 = 0x00987)"sv; - static constexpr auto integer_long = R"(int64-max = 9223372036854775807 -int64-max-neg = -9223372036854775808)"sv; - static constexpr auto integer_underscore = R"(kilo = 1_000 -x = 1_1_1_1)"sv; - static constexpr auto integer_zero = R"(d1 = 0 -d2 = +0 -d3 = -0 - -h1 = 0x0 -h2 = 0x00 -h3 = 0x00000 - -o1 = 0o0 -a2 = 0o00 -a3 = 0o00000 - -b1 = 0b0 -b2 = 0b00 -b3 = 0b00000)"sv; - -#if UNICODE_LITERALS_OK - - static constexpr auto key_case_sensitive = R"(sectioN = "NN" - -[section] -name = "lower" -NAME = "upper" -Name = "capitalized" - -[Section] -name = "different section!!" -"μ" = "greek small letter mu" -"Μ" = "greek capital letter MU" -M = "latin letter M")"sv; - static constexpr auto key_escapes = R"("\n" = "newline" -"\u00c0" = "latin capital letter A with grave" -"\"" = "just a quote" - -["backsp\b\b"] - -["\"quoted\""] -quote = true - -["a.b"."\u00c0"])"sv; - static constexpr auto key_quoted_unicode = R"( -"\u0000" = "null" -'\u0000' = "different key" -"\u0008 \u000c \U00000041 \u007f \u0080 \u00ff \ud7ff \ue000 \uffff \U00010000 \U0010ffff" = "escaped key" - -"~ € ÿ ퟿  ￿ 𐀀 􏿿" = "basic key" -'l ~ € ÿ ퟿  ￿ 𐀀 􏿿' = "literal key")"sv; - -#endif // UNICODE_LITERALS_OK - - static constexpr auto key_dotted_empty = R"(''.x = "empty.x" -x."" = "x.empty" -[a] -"".'' = "empty.empty")"sv; - static constexpr auto key_dotted = R"(# Note: this file contains literal tab characters. - -name.first = "Arthur" -"name".'last' = "Dent" - -many.dots.here.dot.dot.dot = 42 - -# Space are ignored, and key parts can be quoted. -count.a = 1 -count . b = 2 -"count"."c" = 3 -"count" . "d" = 4 -'count'.'e' = 5 -'count' . 'f' = 6 -"count".'g' = 7 -"count" . 'h' = 8 -count.'i' = 9 -count . 'j' = 10 -"count".k = 11 -"count" . l = 12 - -[tbl] -a.b.c = 42.666 - -[a.few.dots] -polka.dot = "again?" -polka.dance-with = "Dot" - -[[arr]] -a.b.c=1 -a.b.d=2 - -[[arr]] -a.b.c=3 -a.b.d=4)"sv; - static constexpr auto key_empty = R"("" = "blank")"sv; - static constexpr auto key_equals_nospace = R"(answer=42)"sv; - static constexpr auto key_numeric_dotted = R"(1.2 = 3)"sv; - static constexpr auto key_numeric = R"(1 = 1)"sv; - static constexpr auto key_quoted_dots = R"(plain = 1 -"with.dot" = 2 - -[plain_table] -plain = 3 -"with.dot" = 4 - -[table.withdot] -plain = 5 -"key.with.dots" = 6)"sv; - static constexpr auto key_space = R"(# Keep whitespace inside quotes keys at all positions. -"a b" = 1 -" c d " = 2 - -[ " tbl " ] -"\ttab\ttab\t" = "tab")"sv; - static constexpr auto key_special_chars = R"("=~!@$^&*()_+-`1234567890[]|/?><.,;:'=" = 1)"sv; - static constexpr auto key_special_word = R"(false = false -true = 1 -inf = 100000000 -nan = "ceci n'est pas un nombre")"sv; - -#if TOML_LANG_UNRELEASED && UNICODE_LITERALS_OK - - static constexpr auto key_unicode = R"(# TOML 1.1 supports Unicode for bare keys. - -€ = 'Euro' -😂 = "rofl" -a‍b = "zwj" -ÅÅ = "U+00C5 U+0041 U+030A" - -[中文] -中文 = {中文 = "Chinese language"} - -[[tiếng-Việt]] -tiəŋ˧˦.viət̚˧˨ʔ = "north" - -[[tiếng-Việt]] -tiəŋ˦˧˥.viək̚˨˩ʔ = "central")"sv; - -#endif // TOML_LANG_UNRELEASED && UNICODE_LITERALS_OK - - static constexpr auto newline_crlf = "os = \"DOS\"\r\n" - "newline = \"crlf\""sv; - static constexpr auto newline_lf = R"(os = "unix" -newline = "lf")"sv; - - static constexpr auto spec_array_0 = R"(integers = [ 1, 2, 3 ] -colors = [ "red", "yellow", "green" ] -nested_arrays_of_ints = [ [ 1, 2 ], [3, 4, 5] ] -nested_mixed_array = [ [ 1, 2 ], ["a", "b", "c"] ] -string_array = [ "all", 'strings', """are the same""", '''type''' ] - -# Mixed-type arrays are allowed -numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ] -contributors = [ - "Foo Bar ", - { name = "Baz Qux", email = "bazqux@example.com", url = "https://example.com/bazqux" } -])"sv; - static constexpr auto spec_array_1 = R"(integers2 = [ - 1, 2, 3 -] - -integers3 = [ - 1, - 2, # this is ok -])"sv; - static constexpr auto spec_array_of_tables_0 = R"([[products]] -name = "Hammer" -sku = 738594937 - -[[products]] # empty table within the array - -[[products]] -name = "Nail" -sku = 284758393 - -color = "gray")"sv; - static constexpr auto spec_array_of_tables_1 = R"([[fruits]] -name = "apple" - -[fruits.physical] # subtable -color = "red" -shape = "round" - -[[fruits.varieties]] # nested array of tables -name = "red delicious" - -[[fruits.varieties]] -name = "granny smith" - - -[[fruits]] -name = "banana" - -[[fruits.varieties]] -name = "plantain")"sv; - static constexpr auto spec_array_of_tables_2 = R"(points = [ { x = 1, y = 2, z = 3 }, - { x = 7, y = 8, z = 9 }, - { x = 2, y = 4, z = 8 } ])"sv; - static constexpr auto spec_boolean_0 = R"(bool1 = true -bool2 = false)"sv; - static constexpr auto spec_comment_0 = R"(# This is a full-line comment -key = "value" # This is a comment at the end of a line -another = "# This is not a comment")"sv; - static constexpr auto spec_float_0 = R"(# fractional -flt1 = +1.0 -flt2 = 3.1415 -flt3 = -0.01 - -# exponent -flt4 = 5e+22 -flt5 = 1e06 -flt6 = -2E-2 - -# both -flt7 = 6.626e-34)"sv; - static constexpr auto spec_float_1 = R"(flt8 = 224_617.445_991_228)"sv; - static constexpr auto spec_float_2 = R"(# infinity -sf1 = inf # positive infinity -sf2 = +inf # positive infinity -sf3 = -inf # negative infinity - -# not a number -sf4 = nan # actual sNaN/qNaN encoding is implementation-specific -sf5 = +nan # same as `nan` -sf6 = -nan # valid, actual encoding is implementation-specific)"sv; - static constexpr auto spec_inline_table_0 = R"(name = { first = "Tom", last = "Preston-Werner" } -point = { x = 1, y = 2 } -animal = { type.name = "pug" })"sv; - static constexpr auto spec_inline_table_1 = R"([name] -first = "Tom" -last = "Preston-Werner" - -[point] -x = 1 -y = 2 - -[animal] -type.name = "pug")"sv; - static constexpr auto spec_inline_table_2 = R"([product] -type = { name = "Nail" } -# type.edible = false # INVALID)"sv; - static constexpr auto spec_inline_table_3 = R"([product] -type.name = "Nail" -# type = { edible = false } # INVALID)"sv; - static constexpr auto spec_integer_0 = R"(int1 = +99 -int2 = 42 -int3 = 0 -int4 = -17)"sv; - static constexpr auto spec_integer_1 = R"(int5 = 1_000 -int6 = 5_349_221 -int7 = 53_49_221 # Indian number system grouping -int8 = 1_2_3_4_5 # VALID but discouraged)"sv; - static constexpr auto spec_integer_2 = R"(# hexadecimal with prefix `0x` -hex1 = 0xDEADBEEF -hex2 = 0xdeadbeef -hex3 = 0xdead_beef - -# octal with prefix `0o` -oct1 = 0o01234567 -oct2 = 0o755 # useful for Unix file permissions - -# binary with prefix `0b` -bin1 = 0b11010110)"sv; - static constexpr auto spec_key_value_pair_0 = R"(key = "value")"sv; - static constexpr auto spec_keys_0 = R"(key = "value" -bare_key = "value" -bare-key = "value" -1234 = "value")"sv; - static constexpr auto spec_keys_3 = R"(name = "Orange" -physical.color = "orange" -physical.shape = "round" -site."google.com" = true)"sv; - static constexpr auto spec_keys_4 = R"(fruit.name = "banana" # this is best practice -fruit. color = "yellow" # same as fruit.color -fruit . flavor = "banana" # same as fruit.flavor)"sv; - static constexpr auto spec_keys_5 = R"(# VALID BUT DISCOURAGED - -apple.type = "fruit" -orange.type = "fruit" - -apple.skin = "thin" -orange.skin = "thick" - -apple.color = "red" -orange.color = "orange")"sv; - static constexpr auto spec_keys_6 = R"(# RECOMMENDED - -apple.type = "fruit" -apple.skin = "thin" -apple.color = "red" - -orange.type = "fruit" -orange.skin = "thick" -orange.color = "orange")"sv; - static constexpr auto spec_keys_7 = R"(3.14159 = "pi")"sv; - static constexpr auto spec_local_date_0 = R"(ld1 = 1979-05-27)"sv; - static constexpr auto spec_local_date_time_0 = R"(ldt1 = 1979-05-27T07:32:00 -ldt2 = 1979-05-27T00:32:00.999999)"sv; - static constexpr auto spec_local_time_0 = R"(lt1 = 07:32:00 -lt2 = 00:32:00.999999)"sv; - static constexpr auto spec_offset_date_time_0 = R"(odt1 = 1979-05-27T07:32:00Z -odt2 = 1979-05-27T00:32:00-07:00 -odt3 = 1979-05-27T00:32:00.999999-07:00)"sv; - static constexpr auto spec_offset_date_time_1 = R"(odt4 = 1979-05-27 07:32:00Z)"sv; - static constexpr auto spec_string_1 = R"(str1 = """ -Roses are red -Violets are blue""")"sv; - static constexpr auto spec_string_2 = - R"(# On a Unix system, the above multi-line string will most likely be the same as: -str2 = "Roses are red\nViolets are blue" - -# On a Windows system, it will most likely be equivalent to: -str3 = "Roses are red\r\nViolets are blue")"sv; - static constexpr auto spec_string_3 = R"(# The following strings are byte-for-byte equivalent: -str1 = "The quick brown fox jumps over the lazy dog." - -str2 = """ -The quick brown \ - - - fox jumps over \ - the lazy dog.""" - -str3 = """\ - The quick brown \ - fox jumps over \ - the lazy dog.\ - """)"sv; - static constexpr auto spec_string_4 = R"(str4 = """Here are two quotation marks: "". Simple enough.""" -# str5 = """Here are three quotation marks: """.""" # INVALID -str5 = """Here are three quotation marks: ""\".""" -str6 = """Here are fifteen quotation marks: ""\"""\"""\"""\"""\".""" - -# "This," she said, "is just a pointless statement." -str7 = """"This," she said, "is just a pointless statement."""")"sv; - static constexpr auto spec_string_5 = R"(# What you see is what you get. -winpath = 'C:\Users\nodejs\templates' -winpath2 = '\\ServerX\admin$\system32\' -quoted = 'Tom "Dubs" Preston-Werner' -regex = '<\i\c*\s*>')"sv; - static constexpr auto spec_string_6 = R"(regex2 = '''I [dw]on't need \d{2} apples''' -lines = ''' -The first newline is -trimmed in raw strings. - All other whitespace - is preserved. -''')"sv; - static constexpr auto spec_string_7 = R"(quot15 = '''Here are fifteen quotation marks: """""""""""""""''' - -# apos15 = '''Here are fifteen apostrophes: '''''''''''''''''' # INVALID -apos15 = "Here are fifteen apostrophes: '''''''''''''''" - -# 'That,' she said, 'is still pointless.' -str = ''''That,' she said, 'is still pointless.'''')"sv; - static constexpr auto spec_table_0 = R"([table])"sv; - static constexpr auto spec_table_1 = R"([table-1] -key1 = "some string" -key2 = 123 - -[table-2] -key1 = "another string" -key2 = 456)"sv; - static constexpr auto spec_table_2 = R"([dog."tater.man"] -type.name = "pug")"sv; - static constexpr auto spec_table_4 = R"(# [x] you -# [x.y] don't -# [x.y.z] need these -[x.y.z.w] # for this to work - -[x] # defining a super-table afterward is ok)"sv; - static constexpr auto spec_table_5 = R"(# VALID BUT DISCOURAGED -[fruit.apple] -[animal] -[fruit.orange])"sv; - static constexpr auto spec_table_6 = R"(# RECOMMENDED -[fruit.apple] -[fruit.orange] -[animal])"sv; - static constexpr auto spec_table_7 = R"(# Top-level table begins. -name = "Fido" -breed = "pug" - -# Top-level table ends. -[owner] -name = "Regina Dogman" -member_since = 1999-08-04)"sv; - static constexpr auto spec_table_8 = R"(fruit.apple.color = "red" -# Defines a table named fruit -# Defines a table named fruit.apple - -fruit.apple.taste.sweet = true -# Defines a table named fruit.apple.taste -# fruit and fruit.apple were already created)"sv; - static constexpr auto spec_table_9 = R"([fruit] -apple.color = "red" -apple.taste.sweet = true - -# [fruit.apple] # INVALID -# [fruit.apple.taste] # INVALID - -[fruit.apple.texture] # you can add sub-tables -smooth = true)"sv; - static constexpr auto spec_example_1_compact = R"(#Useless spaces eliminated. -title="TOML Example" -[owner] -name="Lance Uppercut" -dob=1979-05-27T07:32:00-08:00#First class dates -[database] -server="192.168.1.1" -ports=[8001,8001,8002] -connection_max=5000 -enabled=true -[servers] -[servers.alpha] -ip="10.0.0.1" -dc="eqdc10" -[servers.beta] -ip="10.0.0.2" -dc="eqdc10" -[clients] -data=[["gamma","delta"],[1,2]] -hosts=[ -"alpha", -"omega" -])"sv; - static constexpr auto spec_example_1 = R"(# This is a TOML document. Boom. - -title = "TOML Example" - -[owner] -name = "Lance Uppercut" -dob = 1979-05-27T07:32:00-08:00 # First class dates? Why not? - -[database] -server = "192.168.1.1" -ports = [ 8001, 8001, 8002 ] -connection_max = 5000 -enabled = true - -[servers] - - # You can indent as you please. Tabs or spaces. TOML don't care. - [servers.alpha] - ip = "10.0.0.1" - dc = "eqdc10" - - [servers.beta] - ip = "10.0.0.2" - dc = "eqdc10" - -[clients] -data = [ ["gamma", "delta"], [1, 2] ] - -# Line breaks are OK when inside arrays -hosts = [ - "alpha", - "omega" -])"sv; - -#if UNICODE_LITERALS_OK - - static constexpr auto spec_keys_1 = R"("127.0.0.1" = "value" -"character encoding" = "value" -"ʎǝʞ" = "value" -'key2' = "value" -'quoted "value"' = "value")"sv; - static constexpr auto spec_string_0 = - R"(str = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF.")"sv; - static constexpr auto spec_table_3 = R"([a.b.c] # this is best practice -[ d.e.f ] # same as [d.e.f] -[ g . h . i ] # same as [g.h.i] -[ j . "ʞ" . 'l' ] # same as [j."ʞ".'l'])"sv; - -#endif // UNICODE_LITERALS_OK - - static constexpr auto string_double_quote_escape = R"(test = "\"one\"")"sv; - static constexpr auto string_empty = R"(answer = "")"sv; - static constexpr auto string_escaped_escape = R"(answer = "\\x64")"sv; - static constexpr auto string_escapes = R"(backspace = "This string has a \b backspace character." -tab = "This string has a \t tab character." -newline = "This string has a \n new line character." -formfeed = "This string has a \f form feed character." -carriage = "This string has a \r carriage return character." -quote = "This string has a \" quote character." -backslash = "This string has a \\ backslash character." -notunicode1 = "This string does not have a unicode \\u escape." -notunicode2 = "This string does not have a unicode \u005Cu escape." -notunicode3 = "This string does not have a unicode \\u0075 escape." -notunicode4 = "This string does not have a unicode \\\u0075 escape." -delete = "This string has a \u007F delete control code." -unitseparator = "This string has a \u001F unit separator control code.")"sv; - static constexpr auto string_multiline_escaped_crlf = - "# The following line should be an unescaped backslash followed by a Windows\r\n" - "# newline sequence (\"\\r\\n\")\r\n" - "0=\"\"\"\\\r\n" - "\"\"\""sv; - static constexpr auto string_multiline_quotes = - R"(# Make sure that quotes inside multiline strings are allowed, including right -# after the opening '''/""" and before the closing '''/""" - -lit_one = ''''one quote'''' -lit_two = '''''two quotes''''' -lit_one_space = ''' 'one quote' ''' -lit_two_space = ''' ''two quotes'' ''' - -one = """"one quote"""" -two = """""two quotes""""" -one_space = """ "one quote" """ -two_space = """ ""two quotes"" """ - -mismatch1 = """aaa'''bbb""" -mismatch2 = '''aaa"""bbb''' - -# Three opening """, then one escaped ", then two "" (allowed), and then three -# closing """ -escaped = """lol\"""""")"sv; - static constexpr auto string_multiline = - "# NOTE: this file includes some literal tab characters.\n" - "\n" - "multiline_empty_one = \"\"\"\"\"\"\n" - "\n" - "# A newline immediately following the opening delimiter will be trimmed.\n" - "multiline_empty_two = \"\"\"\n" - "\"\"\"\n" - "\n" - "# \\ at the end of line trims newlines as well; note that last \\ is followed by\n" - "# two spaces, which are ignored.\n" - "multiline_empty_three = \"\"\"\\\n" - " \"\"\"\n" - "multiline_empty_four = \"\"\"\\\n" - " \\\n" - " \\ \n" - " \"\"\"\n" - "\n" - "equivalent_one = \"The quick brown fox jumps over the lazy dog.\"\n" - "equivalent_two = \"\"\"\n" - "The quick brown \\\n" - "\n" - "\n" - " fox jumps over \\\n" - " the lazy dog.\"\"\"\n" - "\n" - "equivalent_three = \"\"\"\\\n" - " The quick brown \\\n" - " fox jumps over \\\n" - " the lazy dog.\\\n" - " \"\"\"\n" - "\n" - "whitespace-after-bs = \"\"\"\\\n" - " The quick brown \\\n" - " fox jumps over \\ \n" - " the lazy dog.\\ \n" - " \"\"\"\n" - "\n" - "no-space = \"\"\"a\\\n" - " b\"\"\"\n" - "\n" - "# Has tab character.\n" - "keep-ws-before = \"\"\"a \\\n" - " b\"\"\"\n" - "\n" - "escape-bs-1 = \"\"\"a \\\\\n" - "b\"\"\"\n" - "\n" - "escape-bs-2 = \"\"\"a \\\\\\\n" - "b\"\"\"\n" - "\n" - "escape-bs-3 = \"\"\"a \\\\\\\\\n" - " b\"\"\""sv; - static constexpr auto string_nl = R"(nl_mid = "val\nue" -nl_end = """value\n""" - -lit_nl_end = '''value\n''' -lit_nl_mid = 'val\nue' -lit_nl_uni = 'val\ue')"sv; - static constexpr auto string_raw_multiline = R"(# Single ' should be allowed. -oneline = '''This string has a ' quote character.''' - -# A newline immediately following the opening delimiter will be trimmed. -firstnl = ''' -This string has a ' quote character.''' - -# All other whitespace and newline characters remain intact. -multiline = ''' -This string -has ' a quote character -and more than -one newline -in it.''' - -# Tab character in literal string does not need to be escaped -multiline_with_tab = '''First line - Followed by a tab''')"sv; - static constexpr auto string_raw = R"(backspace = 'This string has a \b backspace character.' -tab = 'This string has a \t tab character.' -unescaped_tab = 'This string has an unescaped tab character.' -newline = 'This string has a \n new line character.' -formfeed = 'This string has a \f form feed character.' -carriage = 'This string has a \r carriage return character.' -slash = 'This string has a \/ slash character.' -backslash = 'This string has a \\ backslash character.')"sv; - static constexpr auto string_simple = R"(answer = "You are not drinking enough whisky.")"sv; - static constexpr auto string_with_pound = R"(pound = "We see no # comments here." -poundcomment = "But there are # some comments here." # Did I # mess you up?)"sv; - -#if TOML_LANG_UNRELEASED - - static constexpr auto string_escape_esc = R"(esc = "\e There is no escape! \e")"sv; - -#endif // TOML_LANG_UNRELEASED - -#if UNICODE_LITERALS_OK - - static constexpr auto string_escape_tricky = R"(end_esc = "String does not end here\" but ends here\\" -lit_end_esc = 'String ends here\' - -multiline_unicode = """ -\u00a0""" - -multiline_not_unicode = """ -\\u0041""" - -multiline_end_esc = """When will it end? \"""...""\" should be here\"""" - -lit_multiline_not_unicode = ''' -\u007f''' - -lit_multiline_end = '''There is no escape\''')"sv; - static constexpr auto string_quoted_unicode = R"( -escaped_string = "\u0000 \u0008 \u000c \U00000041 \u007f \u0080 \u00ff \ud7ff \ue000 \uffff \U00010000 \U0010ffff" -not_escaped_string = '\u0000 \u0008 \u000c \U00000041 \u007f \u0080 \u00ff \ud7ff \ue000 \uffff \U00010000 \U0010ffff' - -basic_string = "~ € ÿ ퟿  ￿ 𐀀 􏿿" -literal_string = '~ € ÿ ퟿  ￿ 𐀀 􏿿')"sv; - static constexpr auto string_unicode_escape = R"(answer4 = "\u03B4" -answer8 = "\U000003B4")"sv; - static constexpr auto string_unicode_literal = R"(answer = "δ")"sv; - -#endif // UNICODE_LITERALS_OK - -#if TOML_LANG_UNRELEASED && UNICODE_LITERALS_OK - - static constexpr auto string_hex_escape = R"(# \x for the first 255 codepoints - -whitespace = "\x20 \x09 \x1b \x0d\x0a" -bs = "\x7f" -nul = "\x00" -hello = "\x68\x65\x6c\x6c\x6f\x0a" -higher-than-127 = "S\xf8rmirb\xe6ren" - -multiline = """ -\x20 \x09 \x1b \x0d\x0a -\x7f -\x00 -\x68\x65\x6c\x6c\x6f\x0a -\x53\xF8\x72\x6D\x69\x72\x62\xE6\x72\x65\x6E -""" - -# Not inside literals. -literal = '\x20 \x09 \x0d\x0a' -multiline-literal = ''' -\x20 \x09 \x0d\x0a -''')"sv; - -#endif // TOML_LANG_UNRELEASED && UNICODE_LITERALS_OK - - static constexpr auto table_array_implicit_and_explicit_after = R"([[a.b]] -x = 1 - -[a] -y = 2)"sv; - static constexpr auto table_array_implicit = R"([[albums.songs]] -name = "Glory Days")"sv; - static constexpr auto table_array_many = R"([[people]] -first_name = "Bruce" -last_name = "Springsteen" - -[[people]] -first_name = "Eric" -last_name = "Clapton" - -[[people]] -first_name = "Bob" -last_name = "Seger")"sv; - static constexpr auto table_array_nest = R"([[albums]] -name = "Born to Run" - - [[albums.songs]] - name = "Jungleland" - - [[albums.songs]] - name = "Meeting Across the River" - -[[albums]] -name = "Born in the USA" - - [[albums.songs]] - name = "Glory Days" - - [[albums.songs]] - name = "Dancing in the Dark")"sv; - static constexpr auto table_array_one = R"([[people]] -first_name = "Bruce" -last_name = "Springsteen")"sv; - static constexpr auto table_array_table_array = R"([[a]] - [[a.b]] - [a.b.c] - d = "val0" - [[a.b]] - [a.b.c] - d = "val1")"sv; - static constexpr auto table_array_within_dotted = R"([fruit] -apple.color = "red" - -[[fruit.apple.seeds]] -size = 2)"sv; - static constexpr auto table_empty_name = R"([''] -x = 1 - -["".a] -x = 2 - -[a.''] -x = 3)"sv; - static constexpr auto table_empty = R"([a])"sv; - static constexpr auto table_keyword = R"([true] - -[false] - -[inf] - -[nan])"sv; - static constexpr auto table_no_eol = R"([table])"sv; - static constexpr auto table_sub_empty = R"([a] -[a.b])"sv; - static constexpr auto table_sub = R"([a] -key = 1 - -# a.extend is a key inside the "a" table. -[a.extend] -key = 2 - -[a.extend.more] -key = 3)"sv; - static constexpr auto table_whitespace = R"(["valid key"])"sv; - static constexpr auto table_with_literal_string = R"(['a'] -[a.'"b"'] -[a.'"b"'.c] -answer = 42 )"sv; - static constexpr auto table_with_pound = R"(["key#group"] -answer = 42)"sv; - static constexpr auto table_with_single_quotes = R"(['a'] -[a.'b'] -[a.'b'.c] -answer = 42 )"sv; - static constexpr auto table_without_super = R"(# [x] you -# [x.y] don't -# [x.y.z] need these -[x.y.z.w] # for this to work -[x] # defining a super-table afterwards is ok)"sv; - -#if UNICODE_LITERALS_OK - - static constexpr auto table_names = R"([a.b.c] -[a."b.c"] -[a.'d.e'] -[a.' x '] -[ d.e.f ] -[ g . h . i ] -[ j . "ʞ" . 'l' ] - -[x.1.2])"sv; - -#endif // UNICODE_LITERALS_OK -} - -TEST_CASE("conformance - burntsushi/valid") -{ - SECTION("array-array") - { - parsing_should_succeed(FILE_LINE_ARGS, - array_array, - [](toml::table&& tbl) // array-array - { - const auto expected = toml::table{ - { R"(comments)"sv, - toml::array{ - 1, - 2, - } }, - { R"(dates)"sv, - toml::array{ - toml::date_time{ { 1987, 7, 5 }, { 17, 45 }, { 0, 0 } }, - toml::date_time{ { 1979, 5, 27 }, { 7, 32 }, { 0, 0 } }, - toml::date_time{ { 2006, 6, 1 }, { 11, 0 }, { 0, 0 } }, - } }, - { R"(floats)"sv, - toml::array{ - 1.1, - 2.1, - 3.1, - } }, - { R"(ints)"sv, - toml::array{ - 1, - 2, - 3, - } }, - { R"(strings)"sv, - toml::array{ - R"(a)"sv, - R"(b)"sv, - R"(c)"sv, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("array-bool") - { - parsing_should_succeed(FILE_LINE_ARGS, - array_bool, - [](toml::table&& tbl) // array-bool - { - const auto expected = toml::table{ - { R"(a)"sv, - toml::array{ - true, - false, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("array-empty") - { - parsing_should_succeed(FILE_LINE_ARGS, - array_empty, - [](toml::table&& tbl) // array-empty - { - const auto expected = toml::table{ - { R"(thevoid)"sv, - toml::array{ - toml::inserter{ toml::array{ - toml::inserter{ toml::array{ - toml::inserter{ toml::array{ - toml::inserter{ toml::array{} }, - } }, - } }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("array-hetergeneous") - { - parsing_should_succeed(FILE_LINE_ARGS, - array_hetergeneous, - [](toml::table&& tbl) // array-hetergeneous - { - const auto expected = toml::table{ - { R"(mixed)"sv, - toml::array{ - toml::array{ - 1, - 2, - }, - toml::array{ - R"(a)"sv, - R"(b)"sv, - }, - toml::array{ - 1.1, - 2.1, - }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("array-mixed-int-array") - { - parsing_should_succeed(FILE_LINE_ARGS, - array_mixed_int_array, - [](toml::table&& tbl) // array-mixed-int-array - { - const auto expected = toml::table{ - { R"(arrays-and-ints)"sv, - toml::array{ - 1, - toml::array{ - R"(Arrays are not integers.)"sv, - }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("array-mixed-int-float") - { - parsing_should_succeed(FILE_LINE_ARGS, - array_mixed_int_float, - [](toml::table&& tbl) // array-mixed-int-float - { - const auto expected = toml::table{ - { R"(ints-and-floats)"sv, - toml::array{ - 1, - 1.1, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("array-mixed-int-string") - { - parsing_should_succeed(FILE_LINE_ARGS, - array_mixed_int_string, - [](toml::table&& tbl) // array-mixed-int-string - { - const auto expected = toml::table{ - { R"(strings-and-ints)"sv, - toml::array{ - R"(hi)"sv, - 42, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("array-mixed-string-table") - { - parsing_should_succeed(FILE_LINE_ARGS, - array_mixed_string_table, - [](toml::table&& tbl) // array-mixed-string-table - { - const auto expected = toml::table{ - { R"(contributors)"sv, - toml::array{ - R"(Foo Bar )"sv, - toml::table{ - { R"(email)"sv, R"(bazqux@example.com)"sv }, - { R"(name)"sv, R"(Baz Qux)"sv }, - { R"(url)"sv, R"(https://example.com/bazqux)"sv }, - }, - } }, - { R"(mixed)"sv, - toml::array{ - toml::table{ - { R"(k)"sv, R"(a)"sv }, - }, - R"(b)"sv, - 1, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("array-nested-double") - { - parsing_should_succeed(FILE_LINE_ARGS, - array_nested_double, - [](toml::table&& tbl) // array-nested-double - { - const auto expected = toml::table{ - { R"(nest)"sv, - toml::array{ - toml::inserter{ toml::array{ - toml::array{ - R"(a)"sv, - }, - toml::array{ - 1, - 2, - toml::array{ - 3, - }, - }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("array-nested-inline-table") - { - parsing_should_succeed(FILE_LINE_ARGS, - array_nested_inline_table, - [](toml::table&& tbl) // array-nested-inline-table - { - const auto expected = toml::table{ - { R"(a)"sv, - toml::array{ - toml::table{ - { R"(b)"sv, toml::table{} }, - }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("array-nested") - { - parsing_should_succeed(FILE_LINE_ARGS, - array_nested, - [](toml::table&& tbl) // array-nested - { - const auto expected = toml::table{ - { R"(nest)"sv, - toml::array{ - toml::array{ - R"(a)"sv, - }, - toml::array{ - R"(b)"sv, - }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("array-nospaces") - { - parsing_should_succeed(FILE_LINE_ARGS, - array_nospaces, - [](toml::table&& tbl) // array-nospaces - { - const auto expected = toml::table{ - { R"(ints)"sv, - toml::array{ - 1, - 2, - 3, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("array-string-quote-comma-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - array_string_quote_comma_2, - [](toml::table&& tbl) // array-string-quote-comma-2 - { - const auto expected = toml::table{ - { R"(title)"sv, - toml::array{ - R"( ", )"sv, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("array-string-quote-comma") - { - parsing_should_succeed(FILE_LINE_ARGS, - array_string_quote_comma, - [](toml::table&& tbl) // array-string-quote-comma - { - const auto expected = toml::table{ - { R"(title)"sv, - toml::array{ - R"(Client: "XXXX", Job: XXXX)"sv, - R"(Code: XXXX)"sv, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("array-string-with-comma-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - array_string_with_comma_2, - [](toml::table&& tbl) // array-string-with-comma-2 - { - const auto expected = toml::table{ - { R"(title)"sv, - toml::array{ - R"(Client: XXXX, -Job: XXXX)"sv, - R"(Code: XXXX)"sv, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("array-string-with-comma") - { - parsing_should_succeed(FILE_LINE_ARGS, - array_string_with_comma, - [](toml::table&& tbl) // array-string-with-comma - { - const auto expected = toml::table{ - { R"(title)"sv, - toml::array{ - R"(Client: XXXX, Job: XXXX)"sv, - R"(Code: XXXX)"sv, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("array-strings") - { - parsing_should_succeed(FILE_LINE_ARGS, - array_strings, - [](toml::table&& tbl) // array-strings - { - const auto expected = toml::table{ - { R"(string_array)"sv, - toml::array{ - R"(all)"sv, - R"(strings)"sv, - R"(are the same)"sv, - R"(type)"sv, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("array-table-array-string-backslash") - { - parsing_should_succeed(FILE_LINE_ARGS, - array_table_array_string_backslash, - [](toml::table&& tbl) // array-table-array-string-backslash - { - const auto expected = toml::table{ - { R"(foo)"sv, - toml::array{ - toml::table{ - { R"(bar)"sv, R"("{{baz}}")"sv }, - }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("bool-bool") - { - parsing_should_succeed(FILE_LINE_ARGS, - bool_bool, - [](toml::table&& tbl) // bool-bool - { - const auto expected = toml::table{ - { R"(f)"sv, false }, - { R"(t)"sv, true }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("comment-after-literal-no-ws") - { - parsing_should_succeed(FILE_LINE_ARGS, - comment_after_literal_no_ws, - [](toml::table&& tbl) // comment-after-literal-no-ws - { - const auto expected = toml::table{ - { R"(false)"sv, false }, - { R"(inf)"sv, std::numeric_limits::infinity() }, - { R"(nan)"sv, std::numeric_limits::quiet_NaN() }, - { R"(true)"sv, true }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("comment-at-eof") - { - parsing_should_succeed(FILE_LINE_ARGS, - comment_at_eof, - [](toml::table&& tbl) // comment-at-eof - { - const auto expected = toml::table{ - { R"(key)"sv, R"(value)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("comment-at-eof2") - { - parsing_should_succeed(FILE_LINE_ARGS, - comment_at_eof2, - [](toml::table&& tbl) // comment-at-eof2 - { - const auto expected = toml::table{ - { R"(key)"sv, R"(value)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("comment-everywhere") - { - parsing_should_succeed( - FILE_LINE_ARGS, - comment_everywhere, - [](toml::table&& tbl) // comment-everywhere - { - const auto expected = toml::table{ - { R"(group)"sv, - toml::table{ - { R"(answer)"sv, 42 }, - { R"(d)"sv, toml::date{ 1979, 5, 27 } }, - { R"(dt)"sv, toml::date_time{ { 1979, 5, 27 }, { 7, 32, 12 }, { -7, 0 } } }, - { R"(more)"sv, - toml::array{ - 42, - 42, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("comment-noeol") - { - parsing_should_succeed(FILE_LINE_ARGS, - comment_noeol, - [](toml::table&& tbl) // comment-noeol - { - const auto expected = toml::table{}; - REQUIRE(tbl == expected); - }); - } - - SECTION("comment-tricky") - { - parsing_should_succeed(FILE_LINE_ARGS, - comment_tricky, - [](toml::table&& tbl) // comment-tricky - { - const auto expected = toml::table{ - { R"(hash#tag)"sv, - toml::table{ - { R"(#!)"sv, R"(hash bang)"sv }, - { R"(arr3)"sv, - toml::array{ - R"(#)"sv, - R"(#)"sv, - R"(###)"sv, - } }, - { R"(arr4)"sv, - toml::array{ - 1, - 2, - 3, - 4, - } }, - { R"(arr5)"sv, - toml::array{ - toml::inserter{ toml::array{ - toml::inserter{ toml::array{ - toml::inserter{ toml::array{ - toml::inserter{ toml::array{ - R"(#)"sv, - } }, - } }, - } }, - } }, - } }, - { R"(tbl1)"sv, - toml::table{ - { R"(#)"sv, R"(}#)"sv }, - } }, - } }, - { R"(section)"sv, - toml::table{ - { R"(8)"sv, R"(eight)"sv }, - { R"(eleven)"sv, 11.1 }, - { R"(five)"sv, 5.5 }, - { R"(four)"sv, R"(# no comment -# nor this -#also not comment)"sv }, - { R"(one)"sv, R"(11)"sv }, - { R"(six)"sv, 6 }, - { R"(ten)"sv, 1000.0 }, - { R"(three)"sv, R"(#)"sv }, - { R"(two)"sv, R"(22#)"sv }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - -#if UNICODE_LITERALS_OK - - SECTION("comment-nonascii") - { - parsing_should_succeed(FILE_LINE_ARGS, - comment_nonascii, - [](toml::table&& tbl) // comment-nonascii - { - const auto expected = toml::table{}; - REQUIRE(tbl == expected); - }); - } - -#endif // UNICODE_LITERALS_OK - - SECTION("datetime-datetime") - { - parsing_should_succeed(FILE_LINE_ARGS, - datetime_datetime, - [](toml::table&& tbl) // datetime-datetime - { - const auto expected = toml::table{ - { R"(lower)"sv, toml::date_time{ { 1987, 7, 5 }, { 17, 45 }, { 0, 0 } } }, - { R"(space)"sv, toml::date_time{ { 1987, 7, 5 }, { 17, 45 }, { 0, 0 } } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("datetime-local-date") - { - parsing_should_succeed(FILE_LINE_ARGS, - datetime_local_date, - [](toml::table&& tbl) // datetime-local-date - { - const auto expected = toml::table{ - { R"(bestdayever)"sv, toml::date{ 1987, 7, 5 } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("datetime-local-time") - { - parsing_should_succeed(FILE_LINE_ARGS, - datetime_local_time, - [](toml::table&& tbl) // datetime-local-time - { - const auto expected = toml::table{ - { R"(besttimeever)"sv, toml::time{ 17, 45 } }, - { R"(milliseconds)"sv, toml::time{ 10, 32, 0, 555000000 } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("datetime-local") - { - parsing_should_succeed(FILE_LINE_ARGS, - datetime_local, - [](toml::table&& tbl) // datetime-local - { - const auto expected = toml::table{ - { R"(local)"sv, toml::date_time{ { 1987, 7, 5 }, { 17, 45 } } }, - { R"(milli)"sv, toml::date_time{ { 1977, 12, 21 }, { 10, 32, 0, 555000000 } } }, - { R"(space)"sv, toml::date_time{ { 1987, 7, 5 }, { 17, 45 } } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("datetime-milliseconds") - { - parsing_should_succeed( - FILE_LINE_ARGS, - datetime_milliseconds, - [](toml::table&& tbl) // datetime-milliseconds - { - const auto expected = toml::table{ - { R"(utc1)"sv, toml::date_time{ { 1987, 7, 5 }, { 17, 45, 56, 123000000 }, { 0, 0 } } }, - { R"(utc2)"sv, toml::date_time{ { 1987, 7, 5 }, { 17, 45, 56, 600000000 }, { 0, 0 } } }, - { R"(wita1)"sv, toml::date_time{ { 1987, 7, 5 }, { 17, 45, 56, 123000000 }, { 8, 0 } } }, - { R"(wita2)"sv, toml::date_time{ { 1987, 7, 5 }, { 17, 45, 56, 600000000 }, { 8, 0 } } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("datetime-timezone") - { - parsing_should_succeed(FILE_LINE_ARGS, - datetime_timezone, - [](toml::table&& tbl) // datetime-timezone - { - const auto expected = toml::table{ - { R"(nzdt)"sv, toml::date_time{ { 1987, 7, 5 }, { 17, 45, 56 }, { 13, 0 } } }, - { R"(nzst)"sv, toml::date_time{ { 1987, 7, 5 }, { 17, 45, 56 }, { 12, 0 } } }, - { R"(pdt)"sv, toml::date_time{ { 1987, 7, 5 }, { 17, 45, 56 }, { -5, 0 } } }, - { R"(utc)"sv, toml::date_time{ { 1987, 7, 5 }, { 17, 45, 56 }, { 0, 0 } } }, - }; - REQUIRE(tbl == expected); - }); - } - -#if TOML_LANG_UNRELEASED - - SECTION("datetime-no-seconds") - { - parsing_should_succeed( - FILE_LINE_ARGS, - datetime_no_seconds, - [](toml::table&& tbl) // datetime-no-seconds - { - const auto expected = toml::table{ - { R"(without-seconds-1)"sv, toml::time{ 13, 37 } }, - { R"(without-seconds-2)"sv, toml::date_time{ { 1979, 5, 27 }, { 7, 32 }, { 0, 0 } } }, - { R"(without-seconds-3)"sv, toml::date_time{ { 1979, 5, 27 }, { 7, 32 }, { -7, 0 } } }, - { R"(without-seconds-4)"sv, toml::date_time{ { 1979, 5, 27 }, { 7, 32 } } }, - }; - REQUIRE(tbl == expected); - }); - } - -#endif // TOML_LANG_UNRELEASED - - SECTION("empty-file") - { - parsing_should_succeed(FILE_LINE_ARGS, - empty_file, - [](toml::table&& tbl) // empty-file - { - const auto expected = toml::table{}; - REQUIRE(tbl == expected); - }); - } - - SECTION("example") - { - parsing_should_succeed( - FILE_LINE_ARGS, - example, - [](toml::table&& tbl) // example - { - const auto expected = toml::table{ - { R"(best-day-ever)"sv, toml::date_time{ { 1987, 7, 5 }, { 17, 45 }, { 0, 0 } } }, - { R"(numtheory)"sv, - toml::table{ - { R"(boring)"sv, false }, - { R"(perfection)"sv, - toml::array{ - 6, - 28, - 496, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("float-exponent") - { - parsing_should_succeed(FILE_LINE_ARGS, - float_exponent, - [](toml::table&& tbl) // float-exponent - { - const auto expected = toml::table{ - { R"(lower)"sv, 300.0 }, { R"(minustenth)"sv, -0.1 }, - { R"(neg)"sv, 0.03 }, { R"(pointlower)"sv, 310.0 }, - { R"(pointupper)"sv, 310.0 }, { R"(pos)"sv, 300.0 }, - { R"(upper)"sv, 300.0 }, { R"(zero)"sv, 3.0 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("float-float") - { - parsing_should_succeed(FILE_LINE_ARGS, - float_float, - [](toml::table&& tbl) // float-float - { - const auto expected = toml::table{ - { R"(negpi)"sv, -3.14 }, - { R"(pi)"sv, 3.14 }, - { R"(pospi)"sv, 3.14 }, - { R"(zero-intpart)"sv, 0.123 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("float-inf-and-nan") - { - parsing_should_succeed(FILE_LINE_ARGS, - float_inf_and_nan, - [](toml::table&& tbl) // float-inf-and-nan - { - const auto expected = toml::table{ - { R"(infinity)"sv, std::numeric_limits::infinity() }, - { R"(infinity_neg)"sv, -std::numeric_limits::infinity() }, - { R"(infinity_plus)"sv, std::numeric_limits::infinity() }, - { R"(nan)"sv, std::numeric_limits::quiet_NaN() }, - { R"(nan_neg)"sv, std::numeric_limits::quiet_NaN() }, - { R"(nan_plus)"sv, std::numeric_limits::quiet_NaN() }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("float-long") - { - parsing_should_succeed(FILE_LINE_ARGS, - float_long, - [](toml::table&& tbl) // float-long - { - const auto expected = toml::table{ - { R"(longpi)"sv, 3.141592653589793 }, - { R"(neglongpi)"sv, -3.141592653589793 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("float-underscore") - { - parsing_should_succeed(FILE_LINE_ARGS, - float_underscore, - [](toml::table&& tbl) // float-underscore - { - const auto expected = toml::table{ - { R"(after)"sv, 3141.5927 }, - { R"(before)"sv, 3141.5927 }, - { R"(exponent)"sv, 300000000000000.0 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("float-zero") - { - parsing_should_succeed(FILE_LINE_ARGS, - float_zero, - [](toml::table&& tbl) // float-zero - { - const auto expected = toml::table{ - { R"(exponent)"sv, 0.0 }, - { R"(exponent-signed-neg)"sv, -0.0 }, - { R"(exponent-signed-pos)"sv, 0.0 }, - { R"(exponent-two-0)"sv, 0.0 }, - { R"(signed-neg)"sv, -0.0 }, - { R"(signed-pos)"sv, 0.0 }, - { R"(zero)"sv, 0.0 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("implicit-and-explicit-after") - { - parsing_should_succeed(FILE_LINE_ARGS, - implicit_and_explicit_after, - [](toml::table&& tbl) // implicit-and-explicit-after - { - const auto expected = toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, - toml::table{ - { R"(c)"sv, - toml::table{ - { R"(answer)"sv, 42 }, - } }, - } }, - { R"(better)"sv, 43 }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("implicit-and-explicit-before") - { - parsing_should_succeed(FILE_LINE_ARGS, - implicit_and_explicit_before, - [](toml::table&& tbl) // implicit-and-explicit-before - { - const auto expected = toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, - toml::table{ - { R"(c)"sv, - toml::table{ - { R"(answer)"sv, 42 }, - } }, - } }, - { R"(better)"sv, 43 }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("implicit-groups") - { - parsing_should_succeed(FILE_LINE_ARGS, - implicit_groups, - [](toml::table&& tbl) // implicit-groups - { - const auto expected = toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, - toml::table{ - { R"(c)"sv, - toml::table{ - { R"(answer)"sv, 42 }, - } }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("inline-table-array") - { - parsing_should_succeed(FILE_LINE_ARGS, - inline_table_array, - [](toml::table&& tbl) // inline-table-array - { - const auto expected = toml::table{ - { R"(people)"sv, - toml::array{ - toml::table{ - { R"(first_name)"sv, R"(Bruce)"sv }, - { R"(last_name)"sv, R"(Springsteen)"sv }, - }, - toml::table{ - { R"(first_name)"sv, R"(Eric)"sv }, - { R"(last_name)"sv, R"(Clapton)"sv }, - }, - toml::table{ - { R"(first_name)"sv, R"(Bob)"sv }, - { R"(last_name)"sv, R"(Seger)"sv }, - }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("inline-table-bool") - { - parsing_should_succeed(FILE_LINE_ARGS, - inline_table_bool, - [](toml::table&& tbl) // inline-table-bool - { - const auto expected = toml::table{ - { R"(a)"sv, - toml::table{ - { R"(a)"sv, true }, - { R"(b)"sv, false }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("inline-table-empty") - { - parsing_should_succeed(FILE_LINE_ARGS, - inline_table_empty, - [](toml::table&& tbl) // inline-table-empty - { - const auto expected = toml::table{ - { R"(empty1)"sv, toml::table{} }, - { R"(empty2)"sv, toml::table{} }, - { R"(empty_in_array)"sv, - toml::array{ - toml::table{ - { R"(not_empty)"sv, 1 }, - }, - toml::table{}, - } }, - { R"(empty_in_array2)"sv, - toml::array{ - toml::table{}, - toml::table{ - { R"(not_empty)"sv, 1 }, - }, - } }, - { R"(many_empty)"sv, - toml::array{ - toml::table{}, - toml::table{}, - toml::table{}, - } }, - { R"(nested_empty)"sv, - toml::table{ - { R"(empty)"sv, toml::table{} }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("inline-table-end-in-bool") - { - parsing_should_succeed(FILE_LINE_ARGS, - inline_table_end_in_bool, - [](toml::table&& tbl) // inline-table-end-in-bool - { - const auto expected = toml::table{ - { R"(black)"sv, - toml::table{ - { R"(allow_prereleases)"sv, true }, - { R"(python)"sv, R"(>3.6)"sv }, - { R"(version)"sv, R"(>=18.9b0)"sv }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("inline-table-inline-table") - { - parsing_should_succeed(FILE_LINE_ARGS, - inline_table_inline_table, - [](toml::table&& tbl) // inline-table-inline-table - { - const auto expected = toml::table{ - { R"(name)"sv, - toml::table{ - { R"(first)"sv, R"(Tom)"sv }, - { R"(last)"sv, R"(Preston-Werner)"sv }, - } }, - { R"(point)"sv, - toml::table{ - { R"(x)"sv, 1 }, - { R"(y)"sv, 2 }, - } }, - { R"(simple)"sv, - toml::table{ - { R"(a)"sv, 1 }, - } }, - { R"(str-key)"sv, - toml::table{ - { R"(a)"sv, 1 }, - } }, - { R"(table-array)"sv, - toml::array{ - toml::table{ - { R"(a)"sv, 1 }, - }, - toml::table{ - { R"(b)"sv, 2 }, - }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("inline-table-multiline") - { - parsing_should_succeed(FILE_LINE_ARGS, - inline_table_multiline, - [](toml::table&& tbl) // inline-table-multiline - { - const auto expected = toml::table{ - { R"(tbl_multiline)"sv, - toml::table{ - { R"(a)"sv, 1 }, - { R"(b)"sv, R"(multiline -)"sv }, - { R"(c)"sv, R"(and yet -another line)"sv }, - { R"(d)"sv, 4 }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("inline-table-nest") - { - parsing_should_succeed(FILE_LINE_ARGS, - inline_table_nest, - [](toml::table&& tbl) // inline-table-nest - { - const auto expected = toml::table{ - { R"(arr_arr_tbl_empty)"sv, - toml::array{ - toml::inserter{ toml::array{ - toml::table{}, - } }, - } }, - { R"(arr_arr_tbl_val)"sv, - toml::array{ - toml::inserter{ toml::array{ - toml::table{ - { R"(one)"sv, 1 }, - }, - } }, - } }, - { R"(arr_arr_tbls)"sv, - toml::array{ - toml::inserter{ toml::array{ - toml::table{ - { R"(one)"sv, 1 }, - }, - toml::table{ - { R"(two)"sv, 2 }, - }, - } }, - } }, - { R"(arr_tbl_tbl)"sv, - toml::array{ - toml::table{ - { R"(tbl)"sv, - toml::table{ - { R"(one)"sv, 1 }, - } }, - }, - } }, - { R"(tbl_arr_tbl)"sv, - toml::table{ - { R"(arr_tbl)"sv, - toml::array{ - toml::table{ - { R"(one)"sv, 1 }, - }, - } }, - } }, - { R"(tbl_tbl_empty)"sv, - toml::table{ - { R"(tbl_0)"sv, toml::table{} }, - } }, - { R"(tbl_tbl_val)"sv, - toml::table{ - { R"(tbl_1)"sv, - toml::table{ - { R"(one)"sv, 1 }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - -#if !TOML_MSVC - - SECTION("inline-table-key-dotted") - { - parsing_should_succeed(FILE_LINE_ARGS, - inline_table_key_dotted, - [](toml::table&& tbl) // inline-table-key-dotted - { - const auto expected = toml::table{ - { R"(a)"sv, - toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, 1 }, - } }, - } }, - { R"(arr)"sv, - toml::array{ - toml::table{ - { R"(T)"sv, - toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, 1 }, - } }, - } }, - { R"(t)"sv, - toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, 1 }, - } }, - } }, - }, - toml::table{ - { R"(T)"sv, - toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, 2 }, - } }, - } }, - { R"(t)"sv, - toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, 2 }, - } }, - } }, - }, - } }, - { R"(b)"sv, - toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, 1 }, - } }, - } }, - { R"(c)"sv, - toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, 1 }, - } }, - } }, - { R"(d)"sv, - toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, 1 }, - } }, - } }, - { R"(e)"sv, - toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, 1 }, - } }, - } }, - { R"(inline)"sv, - toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, 42 }, - } }, - } }, - { R"(many)"sv, - toml::table{ - { R"(dots)"sv, - toml::table{ - { R"(here)"sv, - toml::table{ - { R"(dot)"sv, - toml::table{ - { R"(dot)"sv, - toml::table{ - { R"(dot)"sv, - toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, - toml::table{ - { R"(c)"sv, 1 }, - { R"(d)"sv, 2 }, - } }, - } }, - } }, - } }, - } }, - } }, - } }, - } }, - { R"(tbl)"sv, - toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, - toml::table{ - { R"(c)"sv, - toml::table{ - { R"(d)"sv, - toml::table{ - { R"(e)"sv, 1 }, - } }, - } }, - } }, - } }, - { R"(x)"sv, - toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, - toml::table{ - { R"(c)"sv, - toml::table{ - { R"(d)"sv, - toml::table{ - { R"(e)"sv, 1 }, - } }, - } }, - } }, - } }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - -#endif // !TOML_MSVC - -#if TOML_LANG_UNRELEASED - - SECTION("inline-table-newline") - { - parsing_should_succeed(FILE_LINE_ARGS, - inline_table_newline, - [](toml::table&& tbl) // inline-table-newline - { - const auto expected = toml::table{ - { R"(tbl-1)"sv, - toml::table{ - { R"(1)"sv, 2 }, - { R"(arr)"sv, - toml::array{ - 1, - 2, - 3, - } }, - { R"(hello)"sv, R"(world)"sv }, - { R"(tbl)"sv, - toml::table{ - { R"(k)"sv, 1 }, - } }, - } }, - { R"(tbl-2)"sv, - toml::table{ - { R"(k)"sv, R"( Hello - )"sv }, - } }, - { R"(trailing-comma-1)"sv, - toml::table{ - { R"(c)"sv, 1 }, - } }, - { R"(trailing-comma-2)"sv, - toml::table{ - { R"(c)"sv, 1 }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - -#endif // TOML_LANG_UNRELEASED - - SECTION("integer-integer") - { - parsing_should_succeed(FILE_LINE_ARGS, - integer_integer, - [](toml::table&& tbl) // integer-integer - { - const auto expected = toml::table{ - { R"(answer)"sv, 42 }, - { R"(neganswer)"sv, -42 }, - { R"(posanswer)"sv, 42 }, - { R"(zero)"sv, 0 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("integer-literals") - { - parsing_should_succeed( - FILE_LINE_ARGS, - integer_literals, - [](toml::table&& tbl) // integer-literals - { - const auto expected = toml::table{ - { R"(bin1)"sv, 214 }, { R"(bin2)"sv, 5 }, { R"(hex1)"sv, 3735928559 }, - { R"(hex2)"sv, 3735928559 }, { R"(hex3)"sv, 3735928559 }, { R"(hex4)"sv, 2439 }, - { R"(oct1)"sv, 342391 }, { R"(oct2)"sv, 493 }, { R"(oct3)"sv, 501 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("integer-long") - { - parsing_should_succeed(FILE_LINE_ARGS, - integer_long, - [](toml::table&& tbl) // integer-long - { - const auto expected = toml::table{ - { R"(int64-max)"sv, std::numeric_limits::max() }, - { R"(int64-max-neg)"sv, std::numeric_limits::min() }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("integer-underscore") - { - parsing_should_succeed(FILE_LINE_ARGS, - integer_underscore, - [](toml::table&& tbl) // integer-underscore - { - const auto expected = toml::table{ - { R"(kilo)"sv, 1000 }, - { R"(x)"sv, 1111 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("integer-zero") - { - parsing_should_succeed(FILE_LINE_ARGS, - integer_zero, - [](toml::table&& tbl) // integer-zero - { - const auto expected = toml::table{ - { R"(a2)"sv, 0 }, { R"(a3)"sv, 0 }, { R"(b1)"sv, 0 }, { R"(b2)"sv, 0 }, - { R"(b3)"sv, 0 }, { R"(d1)"sv, 0 }, { R"(d2)"sv, 0 }, { R"(d3)"sv, 0 }, - { R"(h1)"sv, 0 }, { R"(h2)"sv, 0 }, { R"(h3)"sv, 0 }, { R"(o1)"sv, 0 }, - }; - REQUIRE(tbl == expected); - }); - } - -#if UNICODE_LITERALS_OK - - SECTION("key-case-sensitive") - { - parsing_should_succeed(FILE_LINE_ARGS, - key_case_sensitive, - [](toml::table&& tbl) // key-case-sensitive - { - const auto expected = toml::table{ - { R"(Section)"sv, - toml::table{ - { R"(M)"sv, R"(latin letter M)"sv }, - { R"(name)"sv, R"(different section!!)"sv }, - { R"(Μ)"sv, R"(greek capital letter MU)"sv }, - { R"(μ)"sv, R"(greek small letter mu)"sv }, - } }, - { R"(sectioN)"sv, R"(NN)"sv }, - { R"(section)"sv, - toml::table{ - { R"(NAME)"sv, R"(upper)"sv }, - { R"(Name)"sv, R"(capitalized)"sv }, - { R"(name)"sv, R"(lower)"sv }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("key-escapes") - { - parsing_should_succeed(FILE_LINE_ARGS, - key_escapes, - [](toml::table&& tbl) // key-escapes - { - const auto expected = toml::table{ - { R"( -)"sv, - R"(newline)"sv }, - { R"(")"sv, R"(just a quote)"sv }, - { R"("quoted")"sv, - toml::table{ - { R"(quote)"sv, true }, - } }, - { R"(a.b)"sv, - toml::table{ - { R"(À)"sv, toml::table{} }, - } }, - { "backsp\x08\x08"sv, toml::table{} }, - { R"(À)"sv, R"(latin capital letter A with grave)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("key-quoted-unicode") - { - parsing_should_succeed(FILE_LINE_ARGS, - key_quoted_unicode, - [](toml::table&& tbl) // key-quoted-unicode - { - const auto expected = toml::table{ - { "\x00"sv, R"(null)"sv }, - { R"(\u0000)"sv, R"(different key)"sv }, - { "\x08 \f A \x7F € ÿ ퟿  ￿ 𐀀 􏿿"sv, R"(escaped key)"sv }, - { R"(~ € ÿ ퟿  ￿ 𐀀 􏿿)"sv, R"(basic key)"sv }, - { R"(l ~ € ÿ ퟿  ￿ 𐀀 􏿿)"sv, R"(literal key)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - -#endif // UNICODE_LITERALS_OK - - SECTION("key-dotted-empty") - { - parsing_should_succeed(FILE_LINE_ARGS, - key_dotted_empty, - [](toml::table&& tbl) // key-dotted-empty - { - const auto expected = toml::table{ - { ""sv, - toml::table{ - { R"(x)"sv, R"(empty.x)"sv }, - } }, - { R"(a)"sv, - toml::table{ - { ""sv, - toml::table{ - { ""sv, R"(empty.empty)"sv }, - } }, - } }, - { R"(x)"sv, - toml::table{ - { ""sv, R"(x.empty)"sv }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("key-dotted") - { - parsing_should_succeed(FILE_LINE_ARGS, - key_dotted, - [](toml::table&& tbl) // key-dotted - { - const auto expected = toml::table{ - { R"(a)"sv, - toml::table{ - { R"(few)"sv, - toml::table{ - { R"(dots)"sv, - toml::table{ - { R"(polka)"sv, - toml::table{ - { R"(dance-with)"sv, R"(Dot)"sv }, - { R"(dot)"sv, R"(again?)"sv }, - } }, - } }, - } }, - } }, - { R"(arr)"sv, - toml::array{ - toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, - toml::table{ - { R"(c)"sv, 1 }, - { R"(d)"sv, 2 }, - } }, - } }, - }, - toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, - toml::table{ - { R"(c)"sv, 3 }, - { R"(d)"sv, 4 }, - } }, - } }, - }, - } }, - { R"(count)"sv, - toml::table{ - { R"(a)"sv, 1 }, - { R"(b)"sv, 2 }, - { R"(c)"sv, 3 }, - { R"(d)"sv, 4 }, - { R"(e)"sv, 5 }, - { R"(f)"sv, 6 }, - { R"(g)"sv, 7 }, - { R"(h)"sv, 8 }, - { R"(i)"sv, 9 }, - { R"(j)"sv, 10 }, - { R"(k)"sv, 11 }, - { R"(l)"sv, 12 }, - } }, - { R"(many)"sv, - toml::table{ - { R"(dots)"sv, - toml::table{ - { R"(here)"sv, - toml::table{ - { R"(dot)"sv, - toml::table{ - { R"(dot)"sv, - toml::table{ - { R"(dot)"sv, 42 }, - } }, - } }, - } }, - } }, - } }, - { R"(name)"sv, - toml::table{ - { R"(first)"sv, R"(Arthur)"sv }, - { R"(last)"sv, R"(Dent)"sv }, - } }, - { R"(tbl)"sv, - toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, - toml::table{ - { R"(c)"sv, 42.666 }, - } }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("key-empty") - { - parsing_should_succeed(FILE_LINE_ARGS, - key_empty, - [](toml::table&& tbl) // key-empty - { - const auto expected = toml::table{ - { ""sv, R"(blank)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("key-equals-nospace") - { - parsing_should_succeed(FILE_LINE_ARGS, - key_equals_nospace, - [](toml::table&& tbl) // key-equals-nospace - { - const auto expected = toml::table{ - { R"(answer)"sv, 42 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("key-numeric-dotted") - { - parsing_should_succeed(FILE_LINE_ARGS, - key_numeric_dotted, - [](toml::table&& tbl) // key-numeric-dotted - { - const auto expected = toml::table{ - { R"(1)"sv, - toml::table{ - { R"(2)"sv, 3 }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("key-numeric") - { - parsing_should_succeed(FILE_LINE_ARGS, - key_numeric, - [](toml::table&& tbl) // key-numeric - { - const auto expected = toml::table{ - { R"(1)"sv, 1 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("key-quoted-dots") - { - parsing_should_succeed(FILE_LINE_ARGS, - key_quoted_dots, - [](toml::table&& tbl) // key-quoted-dots - { - const auto expected = toml::table{ - { R"(plain)"sv, 1 }, - { R"(plain_table)"sv, - toml::table{ - { R"(plain)"sv, 3 }, - { R"(with.dot)"sv, 4 }, - } }, - { R"(table)"sv, - toml::table{ - { R"(withdot)"sv, - toml::table{ - { R"(key.with.dots)"sv, 6 }, - { R"(plain)"sv, 5 }, - } }, - } }, - { R"(with.dot)"sv, 2 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("key-space") - { - parsing_should_succeed(FILE_LINE_ARGS, - key_space, - [](toml::table&& tbl) // key-space - { - const auto expected = toml::table{ - { R"( c d )"sv, 2 }, - { R"( tbl )"sv, - toml::table{ - { R"( tab tab )"sv, R"(tab)"sv }, - } }, - { R"(a b)"sv, 1 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("key-special-chars") - { - parsing_should_succeed(FILE_LINE_ARGS, - key_special_chars, - [](toml::table&& tbl) // key-special-chars - { - const auto expected = toml::table{ - { R"(=~!@$^&*()_+-`1234567890[]|/?><.,;:'=)"sv, 1 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("key-special-word") - { - parsing_should_succeed(FILE_LINE_ARGS, - key_special_word, - [](toml::table&& tbl) // key-special-word - { - const auto expected = toml::table{ - { R"(false)"sv, false }, - { R"(inf)"sv, 100000000 }, - { R"(nan)"sv, R"(ceci n'est pas un nombre)"sv }, - { R"(true)"sv, 1 }, - }; - REQUIRE(tbl == expected); - }); - } - -#if TOML_LANG_UNRELEASED && UNICODE_LITERALS_OK - - SECTION("key-unicode") - { - parsing_should_succeed(FILE_LINE_ARGS, - key_unicode, - [](toml::table&& tbl) // key-unicode - { - const auto expected = toml::table{ - { R"(a‍b)"sv, R"(zwj)"sv }, - { R"(tiếng-Việt)"sv, - toml::array{ - toml::table{ - { R"(tiəŋ˧˦)"sv, - toml::table{ - { R"(viət̚˧˨ʔ)"sv, R"(north)"sv }, - } }, - }, - toml::table{ - { R"(tiəŋ˦˧˥)"sv, - toml::table{ - { R"(viək̚˨˩ʔ)"sv, R"(central)"sv }, - } }, - }, - } }, - { R"(ÅÅ)"sv, R"(U+00C5 U+0041 U+030A)"sv }, - { R"(€)"sv, R"(Euro)"sv }, - { R"(中文)"sv, - toml::table{ - { R"(中文)"sv, - toml::table{ - { R"(中文)"sv, R"(Chinese language)"sv }, - } }, - } }, - { R"(😂)"sv, R"(rofl)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - -#endif // TOML_LANG_UNRELEASED && UNICODE_LITERALS_OK - - SECTION("newline-crlf") - { - parsing_should_succeed(FILE_LINE_ARGS, - newline_crlf, - [](toml::table&& tbl) // newline-crlf - { - const auto expected = toml::table{ - { R"(newline)"sv, R"(crlf)"sv }, - { R"(os)"sv, R"(DOS)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("newline-lf") - { - parsing_should_succeed(FILE_LINE_ARGS, - newline_lf, - [](toml::table&& tbl) // newline-lf - { - const auto expected = toml::table{ - { R"(newline)"sv, R"(lf)"sv }, - { R"(os)"sv, R"(unix)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-array-0") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_array_0, - [](toml::table&& tbl) // spec-array-0 - { - const auto expected = toml::table{ - { R"(colors)"sv, - toml::array{ - R"(red)"sv, - R"(yellow)"sv, - R"(green)"sv, - } }, - { R"(contributors)"sv, - toml::array{ - R"(Foo Bar )"sv, - toml::table{ - { R"(email)"sv, R"(bazqux@example.com)"sv }, - { R"(name)"sv, R"(Baz Qux)"sv }, - { R"(url)"sv, R"(https://example.com/bazqux)"sv }, - }, - } }, - { R"(integers)"sv, - toml::array{ - 1, - 2, - 3, - } }, - { R"(nested_arrays_of_ints)"sv, - toml::array{ - toml::array{ - 1, - 2, - }, - toml::array{ - 3, - 4, - 5, - }, - } }, - { R"(nested_mixed_array)"sv, - toml::array{ - toml::array{ - 1, - 2, - }, - toml::array{ - R"(a)"sv, - R"(b)"sv, - R"(c)"sv, - }, - } }, - { R"(numbers)"sv, - toml::array{ - 0.1, - 0.2, - 0.5, - 1, - 2, - 5, - } }, - { R"(string_array)"sv, - toml::array{ - R"(all)"sv, - R"(strings)"sv, - R"(are the same)"sv, - R"(type)"sv, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-array-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_array_1, - [](toml::table&& tbl) // spec-array-1 - { - const auto expected = toml::table{ - { R"(integers2)"sv, - toml::array{ - 1, - 2, - 3, - } }, - { R"(integers3)"sv, - toml::array{ - 1, - 2, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-array-of-tables-0") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_array_of_tables_0, - [](toml::table&& tbl) // spec-array-of-tables-0 - { - const auto expected = toml::table{ - { R"(products)"sv, - toml::array{ - toml::table{ - { R"(name)"sv, R"(Hammer)"sv }, - { R"(sku)"sv, 738594937 }, - }, - toml::table{}, - toml::table{ - { R"(color)"sv, R"(gray)"sv }, - { R"(name)"sv, R"(Nail)"sv }, - { R"(sku)"sv, 284758393 }, - }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-array-of-tables-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_array_of_tables_1, - [](toml::table&& tbl) // spec-array-of-tables-1 - { - const auto expected = toml::table{ - { R"(fruits)"sv, - toml::array{ - toml::table{ - { R"(name)"sv, R"(apple)"sv }, - { R"(physical)"sv, - toml::table{ - { R"(color)"sv, R"(red)"sv }, - { R"(shape)"sv, R"(round)"sv }, - } }, - { R"(varieties)"sv, - toml::array{ - toml::table{ - { R"(name)"sv, R"(red delicious)"sv }, - }, - toml::table{ - { R"(name)"sv, R"(granny smith)"sv }, - }, - } }, - }, - toml::table{ - { R"(name)"sv, R"(banana)"sv }, - { R"(varieties)"sv, - toml::array{ - toml::table{ - { R"(name)"sv, R"(plantain)"sv }, - }, - } }, - }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-array-of-tables-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_array_of_tables_2, - [](toml::table&& tbl) // spec-array-of-tables-2 - { - const auto expected = toml::table{ - { R"(points)"sv, - toml::array{ - toml::table{ - { R"(x)"sv, 1 }, - { R"(y)"sv, 2 }, - { R"(z)"sv, 3 }, - }, - toml::table{ - { R"(x)"sv, 7 }, - { R"(y)"sv, 8 }, - { R"(z)"sv, 9 }, - }, - toml::table{ - { R"(x)"sv, 2 }, - { R"(y)"sv, 4 }, - { R"(z)"sv, 8 }, - }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-boolean-0") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_boolean_0, - [](toml::table&& tbl) // spec-boolean-0 - { - const auto expected = toml::table{ - { R"(bool1)"sv, true }, - { R"(bool2)"sv, false }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-comment-0") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_comment_0, - [](toml::table&& tbl) // spec-comment-0 - { - const auto expected = toml::table{ - { R"(another)"sv, R"(# This is not a comment)"sv }, - { R"(key)"sv, R"(value)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-float-0") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_float_0, - [](toml::table&& tbl) // spec-float-0 - { - const auto expected = toml::table{ - { R"(flt1)"sv, 1.0 }, { R"(flt2)"sv, 3.1415 }, { R"(flt3)"sv, -0.01 }, - { R"(flt4)"sv, 5e+22 }, { R"(flt5)"sv, 1000000.0 }, { R"(flt6)"sv, -0.02 }, - { R"(flt7)"sv, 6.626e-34 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-float-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_float_1, - [](toml::table&& tbl) // spec-float-1 - { - const auto expected = toml::table{ - { R"(flt8)"sv, 224617.445991228 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-float-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_float_2, - [](toml::table&& tbl) // spec-float-2 - { - const auto expected = toml::table{ - { R"(sf1)"sv, std::numeric_limits::infinity() }, - { R"(sf2)"sv, std::numeric_limits::infinity() }, - { R"(sf3)"sv, -std::numeric_limits::infinity() }, - { R"(sf4)"sv, std::numeric_limits::quiet_NaN() }, - { R"(sf5)"sv, std::numeric_limits::quiet_NaN() }, - { R"(sf6)"sv, std::numeric_limits::quiet_NaN() }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-inline-table-0") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_inline_table_0, - [](toml::table&& tbl) // spec-inline-table-0 - { - const auto expected = toml::table{ - { R"(animal)"sv, - toml::table{ - { R"(type)"sv, - toml::table{ - { R"(name)"sv, R"(pug)"sv }, - } }, - } }, - { R"(name)"sv, - toml::table{ - { R"(first)"sv, R"(Tom)"sv }, - { R"(last)"sv, R"(Preston-Werner)"sv }, - } }, - { R"(point)"sv, - toml::table{ - { R"(x)"sv, 1 }, - { R"(y)"sv, 2 }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-inline-table-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_inline_table_1, - [](toml::table&& tbl) // spec-inline-table-1 - { - const auto expected = toml::table{ - { R"(animal)"sv, - toml::table{ - { R"(type)"sv, - toml::table{ - { R"(name)"sv, R"(pug)"sv }, - } }, - } }, - { R"(name)"sv, - toml::table{ - { R"(first)"sv, R"(Tom)"sv }, - { R"(last)"sv, R"(Preston-Werner)"sv }, - } }, - { R"(point)"sv, - toml::table{ - { R"(x)"sv, 1 }, - { R"(y)"sv, 2 }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-inline-table-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_inline_table_2, - [](toml::table&& tbl) // spec-inline-table-2 - { - const auto expected = toml::table{ - { R"(product)"sv, - toml::table{ - { R"(type)"sv, - toml::table{ - { R"(name)"sv, R"(Nail)"sv }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-inline-table-3") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_inline_table_3, - [](toml::table&& tbl) // spec-inline-table-3 - { - const auto expected = toml::table{ - { R"(product)"sv, - toml::table{ - { R"(type)"sv, - toml::table{ - { R"(name)"sv, R"(Nail)"sv }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-integer-0") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_integer_0, - [](toml::table&& tbl) // spec-integer-0 - { - const auto expected = toml::table{ - { R"(int1)"sv, 99 }, - { R"(int2)"sv, 42 }, - { R"(int3)"sv, 0 }, - { R"(int4)"sv, -17 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-integer-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_integer_1, - [](toml::table&& tbl) // spec-integer-1 - { - const auto expected = toml::table{ - { R"(int5)"sv, 1000 }, - { R"(int6)"sv, 5349221 }, - { R"(int7)"sv, 5349221 }, - { R"(int8)"sv, 12345 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-integer-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_integer_2, - [](toml::table&& tbl) // spec-integer-2 - { - const auto expected = toml::table{ - { R"(bin1)"sv, 214 }, { R"(hex1)"sv, 3735928559 }, - { R"(hex2)"sv, 3735928559 }, { R"(hex3)"sv, 3735928559 }, - { R"(oct1)"sv, 342391 }, { R"(oct2)"sv, 493 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-key-value-pair-0") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_key_value_pair_0, - [](toml::table&& tbl) // spec-key-value-pair-0 - { - const auto expected = toml::table{ - { R"(key)"sv, R"(value)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-keys-0") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_keys_0, - [](toml::table&& tbl) // spec-keys-0 - { - const auto expected = toml::table{ - { R"(1234)"sv, R"(value)"sv }, - { R"(bare-key)"sv, R"(value)"sv }, - { R"(bare_key)"sv, R"(value)"sv }, - { R"(key)"sv, R"(value)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-keys-3") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_keys_3, - [](toml::table&& tbl) // spec-keys-3 - { - const auto expected = toml::table{ - { R"(name)"sv, R"(Orange)"sv }, - { R"(physical)"sv, - toml::table{ - { R"(color)"sv, R"(orange)"sv }, - { R"(shape)"sv, R"(round)"sv }, - } }, - { R"(site)"sv, - toml::table{ - { R"(google.com)"sv, true }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-keys-4") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_keys_4, - [](toml::table&& tbl) // spec-keys-4 - { - const auto expected = toml::table{ - { R"(fruit)"sv, - toml::table{ - { R"(color)"sv, R"(yellow)"sv }, - { R"(flavor)"sv, R"(banana)"sv }, - { R"(name)"sv, R"(banana)"sv }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-keys-5") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_keys_5, - [](toml::table&& tbl) // spec-keys-5 - { - const auto expected = toml::table{ - { R"(apple)"sv, - toml::table{ - { R"(color)"sv, R"(red)"sv }, - { R"(skin)"sv, R"(thin)"sv }, - { R"(type)"sv, R"(fruit)"sv }, - } }, - { R"(orange)"sv, - toml::table{ - { R"(color)"sv, R"(orange)"sv }, - { R"(skin)"sv, R"(thick)"sv }, - { R"(type)"sv, R"(fruit)"sv }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-keys-6") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_keys_6, - [](toml::table&& tbl) // spec-keys-6 - { - const auto expected = toml::table{ - { R"(apple)"sv, - toml::table{ - { R"(color)"sv, R"(red)"sv }, - { R"(skin)"sv, R"(thin)"sv }, - { R"(type)"sv, R"(fruit)"sv }, - } }, - { R"(orange)"sv, - toml::table{ - { R"(color)"sv, R"(orange)"sv }, - { R"(skin)"sv, R"(thick)"sv }, - { R"(type)"sv, R"(fruit)"sv }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-keys-7") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_keys_7, - [](toml::table&& tbl) // spec-keys-7 - { - const auto expected = toml::table{ - { R"(3)"sv, - toml::table{ - { R"(14159)"sv, R"(pi)"sv }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-local-date-0") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_local_date_0, - [](toml::table&& tbl) // spec-local-date-0 - { - const auto expected = toml::table{ - { R"(ld1)"sv, toml::date{ 1979, 5, 27 } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-local-date-time-0") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_local_date_time_0, - [](toml::table&& tbl) // spec-local-date-time-0 - { - const auto expected = toml::table{ - { R"(ldt1)"sv, toml::date_time{ { 1979, 5, 27 }, { 7, 32 } } }, - { R"(ldt2)"sv, toml::date_time{ { 1979, 5, 27 }, { 0, 32, 0, 999999000 } } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-local-time-0") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_local_time_0, - [](toml::table&& tbl) // spec-local-time-0 - { - const auto expected = toml::table{ - { R"(lt1)"sv, toml::time{ 7, 32 } }, - { R"(lt2)"sv, toml::time{ 0, 32, 0, 999999000 } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-offset-date-time-0") - { - parsing_should_succeed( - FILE_LINE_ARGS, - spec_offset_date_time_0, - [](toml::table&& tbl) // spec-offset-date-time-0 - { - const auto expected = toml::table{ - { R"(odt1)"sv, toml::date_time{ { 1979, 5, 27 }, { 7, 32 }, { 0, 0 } } }, - { R"(odt2)"sv, toml::date_time{ { 1979, 5, 27 }, { 0, 32 }, { -7, 0 } } }, - { R"(odt3)"sv, toml::date_time{ { 1979, 5, 27 }, { 0, 32, 0, 999999000 }, { -7, 0 } } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-offset-date-time-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_offset_date_time_1, - [](toml::table&& tbl) // spec-offset-date-time-1 - { - const auto expected = toml::table{ - { R"(odt4)"sv, toml::date_time{ { 1979, 5, 27 }, { 7, 32 }, { 0, 0 } } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_1, - [](toml::table&& tbl) // spec-string-1 - { - const auto expected = toml::table{ - { R"(str1)"sv, R"(Roses are red -Violets are blue)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_2, - [](toml::table&& tbl) // spec-string-2 - { - const auto expected = toml::table{ - { R"(str2)"sv, R"(Roses are red -Violets are blue)"sv }, - { R"(str3)"sv, - "Roses are red\r\n" - "Violets are blue"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-3") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_3, - [](toml::table&& tbl) // spec-string-3 - { - const auto expected = toml::table{ - { R"(str1)"sv, R"(The quick brown fox jumps over the lazy dog.)"sv }, - { R"(str2)"sv, R"(The quick brown fox jumps over the lazy dog.)"sv }, - { R"(str3)"sv, R"(The quick brown fox jumps over the lazy dog.)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-4") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_4, - [](toml::table&& tbl) // spec-string-4 - { - const auto expected = toml::table{ - { R"(str4)"sv, R"(Here are two quotation marks: "". Simple enough.)"sv }, - { R"(str5)"sv, R"(Here are three quotation marks: """.)"sv }, - { R"(str6)"sv, R"(Here are fifteen quotation marks: """"""""""""""".)"sv }, - { R"(str7)"sv, R"("This," she said, "is just a pointless statement.")"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-5") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_5, - [](toml::table&& tbl) // spec-string-5 - { - const auto expected = toml::table{ - { R"(quoted)"sv, R"(Tom "Dubs" Preston-Werner)"sv }, - { R"(regex)"sv, R"(<\i\c*\s*>)"sv }, - { R"(winpath)"sv, R"(C:\Users\nodejs\templates)"sv }, - { R"(winpath2)"sv, R"(\\ServerX\admin$\system32\)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-6") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_6, - [](toml::table&& tbl) // spec-string-6 - { - const auto expected = toml::table{ - { R"(lines)"sv, R"(The first newline is -trimmed in raw strings. - All other whitespace - is preserved. -)"sv }, - { R"(regex2)"sv, R"(I [dw]on't need \d{2} apples)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-7") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_7, - [](toml::table&& tbl) // spec-string-7 - { - const auto expected = toml::table{ - { R"(apos15)"sv, R"(Here are fifteen apostrophes: ''''''''''''''')"sv }, - { R"(quot15)"sv, R"(Here are fifteen quotation marks: """"""""""""""")"sv }, - { R"(str)"sv, R"('That,' she said, 'is still pointless.')"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-table-0") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_table_0, - [](toml::table&& tbl) // spec-table-0 - { - const auto expected = toml::table{ - { R"(table)"sv, toml::table{} }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-table-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_table_1, - [](toml::table&& tbl) // spec-table-1 - { - const auto expected = toml::table{ - { R"(table-1)"sv, - toml::table{ - { R"(key1)"sv, R"(some string)"sv }, - { R"(key2)"sv, 123 }, - } }, - { R"(table-2)"sv, - toml::table{ - { R"(key1)"sv, R"(another string)"sv }, - { R"(key2)"sv, 456 }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-table-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_table_2, - [](toml::table&& tbl) // spec-table-2 - { - const auto expected = toml::table{ - { R"(dog)"sv, - toml::table{ - { R"(tater.man)"sv, - toml::table{ - { R"(type)"sv, - toml::table{ - { R"(name)"sv, R"(pug)"sv }, - } }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-table-4") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_table_4, - [](toml::table&& tbl) // spec-table-4 - { - const auto expected = toml::table{ - { R"(x)"sv, - toml::table{ - { R"(y)"sv, - toml::table{ - { R"(z)"sv, - toml::table{ - { R"(w)"sv, toml::table{} }, - } }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-table-5") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_table_5, - [](toml::table&& tbl) // spec-table-5 - { - const auto expected = toml::table{ - { R"(animal)"sv, toml::table{} }, - { R"(fruit)"sv, - toml::table{ - { R"(apple)"sv, toml::table{} }, - { R"(orange)"sv, toml::table{} }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-table-6") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_table_6, - [](toml::table&& tbl) // spec-table-6 - { - const auto expected = toml::table{ - { R"(animal)"sv, toml::table{} }, - { R"(fruit)"sv, - toml::table{ - { R"(apple)"sv, toml::table{} }, - { R"(orange)"sv, toml::table{} }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-table-7") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_table_7, - [](toml::table&& tbl) // spec-table-7 - { - const auto expected = toml::table{ - { R"(breed)"sv, R"(pug)"sv }, - { R"(name)"sv, R"(Fido)"sv }, - { R"(owner)"sv, - toml::table{ - { R"(member_since)"sv, toml::date{ 1999, 8, 4 } }, - { R"(name)"sv, R"(Regina Dogman)"sv }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-table-8") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_table_8, - [](toml::table&& tbl) // spec-table-8 - { - const auto expected = toml::table{ - { R"(fruit)"sv, - toml::table{ - { R"(apple)"sv, - toml::table{ - { R"(color)"sv, R"(red)"sv }, - { R"(taste)"sv, - toml::table{ - { R"(sweet)"sv, true }, - } }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-table-9") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_table_9, - [](toml::table&& tbl) // spec-table-9 - { - const auto expected = toml::table{ - { R"(fruit)"sv, - toml::table{ - { R"(apple)"sv, - toml::table{ - { R"(color)"sv, R"(red)"sv }, - { R"(taste)"sv, - toml::table{ - { R"(sweet)"sv, true }, - } }, - { R"(texture)"sv, - toml::table{ - { R"(smooth)"sv, true }, - } }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-example-1-compact") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_example_1_compact, - [](toml::table&& tbl) // spec-example-1-compact - { - const auto expected = toml::table{ - { R"(clients)"sv, - toml::table{ - { R"(data)"sv, - toml::array{ - toml::array{ - R"(gamma)"sv, - R"(delta)"sv, - }, - toml::array{ - 1, - 2, - }, - } }, - { R"(hosts)"sv, - toml::array{ - R"(alpha)"sv, - R"(omega)"sv, - } }, - } }, - { R"(database)"sv, - toml::table{ - { R"(connection_max)"sv, 5000 }, - { R"(enabled)"sv, true }, - { R"(ports)"sv, - toml::array{ - 8001, - 8001, - 8002, - } }, - { R"(server)"sv, R"(192.168.1.1)"sv }, - } }, - { R"(owner)"sv, - toml::table{ - { R"(dob)"sv, toml::date_time{ { 1979, 5, 27 }, { 7, 32 }, { -8, 0 } } }, - { R"(name)"sv, R"(Lance Uppercut)"sv }, - } }, - { R"(servers)"sv, - toml::table{ - { R"(alpha)"sv, - toml::table{ - { R"(dc)"sv, R"(eqdc10)"sv }, - { R"(ip)"sv, R"(10.0.0.1)"sv }, - } }, - { R"(beta)"sv, - toml::table{ - { R"(dc)"sv, R"(eqdc10)"sv }, - { R"(ip)"sv, R"(10.0.0.2)"sv }, - } }, - } }, - { R"(title)"sv, R"(TOML Example)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-example-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_example_1, - [](toml::table&& tbl) // spec-example-1 - { - const auto expected = toml::table{ - { R"(clients)"sv, - toml::table{ - { R"(data)"sv, - toml::array{ - toml::array{ - R"(gamma)"sv, - R"(delta)"sv, - }, - toml::array{ - 1, - 2, - }, - } }, - { R"(hosts)"sv, - toml::array{ - R"(alpha)"sv, - R"(omega)"sv, - } }, - } }, - { R"(database)"sv, - toml::table{ - { R"(connection_max)"sv, 5000 }, - { R"(enabled)"sv, true }, - { R"(ports)"sv, - toml::array{ - 8001, - 8001, - 8002, - } }, - { R"(server)"sv, R"(192.168.1.1)"sv }, - } }, - { R"(owner)"sv, - toml::table{ - { R"(dob)"sv, toml::date_time{ { 1979, 5, 27 }, { 7, 32 }, { -8, 0 } } }, - { R"(name)"sv, R"(Lance Uppercut)"sv }, - } }, - { R"(servers)"sv, - toml::table{ - { R"(alpha)"sv, - toml::table{ - { R"(dc)"sv, R"(eqdc10)"sv }, - { R"(ip)"sv, R"(10.0.0.1)"sv }, - } }, - { R"(beta)"sv, - toml::table{ - { R"(dc)"sv, R"(eqdc10)"sv }, - { R"(ip)"sv, R"(10.0.0.2)"sv }, - } }, - } }, - { R"(title)"sv, R"(TOML Example)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - -#if UNICODE_LITERALS_OK - - SECTION("spec-keys-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_keys_1, - [](toml::table&& tbl) // spec-keys-1 - { - const auto expected = toml::table{ - { R"(127.0.0.1)"sv, R"(value)"sv }, { R"(character encoding)"sv, R"(value)"sv }, - { R"(key2)"sv, R"(value)"sv }, { R"(quoted "value")"sv, R"(value)"sv }, - { R"(ʎǝʞ)"sv, R"(value)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-0") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_0, - [](toml::table&& tbl) // spec-string-0 - { - const auto expected = toml::table{ - { R"(str)"sv, R"(I'm a string. "You can quote me". Name José -Location SF.)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-table-3") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_table_3, - [](toml::table&& tbl) // spec-table-3 - { - const auto expected = toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, - toml::table{ - { R"(c)"sv, toml::table{} }, - } }, - } }, - { R"(d)"sv, - toml::table{ - { R"(e)"sv, - toml::table{ - { R"(f)"sv, toml::table{} }, - } }, - } }, - { R"(g)"sv, - toml::table{ - { R"(h)"sv, - toml::table{ - { R"(i)"sv, toml::table{} }, - } }, - } }, - { R"(j)"sv, - toml::table{ - { R"(ʞ)"sv, - toml::table{ - { R"(l)"sv, toml::table{} }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - -#endif // UNICODE_LITERALS_OK - - SECTION("string-double-quote-escape") - { - parsing_should_succeed(FILE_LINE_ARGS, - string_double_quote_escape, - [](toml::table&& tbl) // string-double-quote-escape - { - const auto expected = toml::table{ - { R"(test)"sv, R"("one")"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("string-empty") - { - parsing_should_succeed(FILE_LINE_ARGS, - string_empty, - [](toml::table&& tbl) // string-empty - { - const auto expected = toml::table{ - { R"(answer)"sv, ""sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("string-escaped-escape") - { - parsing_should_succeed(FILE_LINE_ARGS, - string_escaped_escape, - [](toml::table&& tbl) // string-escaped-escape - { - const auto expected = toml::table{ - { R"(answer)"sv, R"(\x64)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("string-escapes") - { - parsing_should_succeed( - FILE_LINE_ARGS, - string_escapes, - [](toml::table&& tbl) // string-escapes - { - const auto expected = toml::table{ - { R"(backslash)"sv, R"(This string has a \ backslash character.)"sv }, - { R"(backspace)"sv, "This string has a \x08 backspace character."sv }, - { R"(carriage)"sv, "This string has a \r carriage return character."sv }, - { R"(delete)"sv, "This string has a \x7F delete control code."sv }, - { R"(formfeed)"sv, "This string has a \f form feed character."sv }, - { R"(newline)"sv, R"(This string has a - new line character.)"sv }, - { R"(notunicode1)"sv, R"(This string does not have a unicode \u escape.)"sv }, - { R"(notunicode2)"sv, R"(This string does not have a unicode \u escape.)"sv }, - { R"(notunicode3)"sv, R"(This string does not have a unicode \u0075 escape.)"sv }, - { R"(notunicode4)"sv, R"(This string does not have a unicode \u escape.)"sv }, - { R"(quote)"sv, R"(This string has a " quote character.)"sv }, - { R"(tab)"sv, R"(This string has a tab character.)"sv }, - { R"(unitseparator)"sv, "This string has a \x1F unit separator control code."sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("string-multiline-escaped-crlf") - { - parsing_should_succeed(FILE_LINE_ARGS, - string_multiline_escaped_crlf, - [](toml::table&& tbl) // string-multiline-escaped-crlf - { - const auto expected = toml::table{ - { R"(0)"sv, ""sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("string-multiline-quotes") - { - parsing_should_succeed(FILE_LINE_ARGS, - string_multiline_quotes, - [](toml::table&& tbl) // string-multiline-quotes - { - const auto expected = toml::table{ - { R"(escaped)"sv, R"(lol""")"sv }, - { R"(lit_one)"sv, R"('one quote')"sv }, - { R"(lit_one_space)"sv, R"( 'one quote' )"sv }, - { R"(lit_two)"sv, R"(''two quotes'')"sv }, - { R"(lit_two_space)"sv, R"( ''two quotes'' )"sv }, - { R"(mismatch1)"sv, R"(aaa'''bbb)"sv }, - { R"(mismatch2)"sv, R"(aaa"""bbb)"sv }, - { R"(one)"sv, R"("one quote")"sv }, - { R"(one_space)"sv, R"( "one quote" )"sv }, - { R"(two)"sv, R"(""two quotes"")"sv }, - { R"(two_space)"sv, R"( ""two quotes"" )"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("string-multiline") - { - parsing_should_succeed( - FILE_LINE_ARGS, - string_multiline, - [](toml::table&& tbl) // string-multiline - { - const auto expected = toml::table{ - { R"(equivalent_one)"sv, R"(The quick brown fox jumps over the lazy dog.)"sv }, - { R"(equivalent_three)"sv, R"(The quick brown fox jumps over the lazy dog.)"sv }, - { R"(equivalent_two)"sv, R"(The quick brown fox jumps over the lazy dog.)"sv }, - { R"(escape-bs-1)"sv, R"(a \ -b)"sv }, - { R"(escape-bs-2)"sv, R"(a \b)"sv }, - { R"(escape-bs-3)"sv, R"(a \\ - b)"sv }, - { R"(keep-ws-before)"sv, R"(a b)"sv }, - { R"(multiline_empty_four)"sv, ""sv }, - { R"(multiline_empty_one)"sv, ""sv }, - { R"(multiline_empty_three)"sv, ""sv }, - { R"(multiline_empty_two)"sv, ""sv }, - { R"(no-space)"sv, R"(ab)"sv }, - { R"(whitespace-after-bs)"sv, R"(The quick brown fox jumps over the lazy dog.)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("string-nl") - { - parsing_should_succeed(FILE_LINE_ARGS, - string_nl, - [](toml::table&& tbl) // string-nl - { - const auto expected = toml::table{ - { R"(lit_nl_end)"sv, R"(value\n)"sv }, - { R"(lit_nl_mid)"sv, R"(val\nue)"sv }, - { R"(lit_nl_uni)"sv, R"(val\ue)"sv }, - { R"(nl_end)"sv, R"(value -)"sv }, - { R"(nl_mid)"sv, R"(val -ue)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("string-raw-multiline") - { - parsing_should_succeed(FILE_LINE_ARGS, - string_raw_multiline, - [](toml::table&& tbl) // string-raw-multiline - { - const auto expected = toml::table{ - { R"(firstnl)"sv, R"(This string has a ' quote character.)"sv }, - { R"(multiline)"sv, R"(This string -has ' a quote character -and more than -one newline -in it.)"sv }, - { R"(multiline_with_tab)"sv, R"(First line - Followed by a tab)"sv }, - { R"(oneline)"sv, R"(This string has a ' quote character.)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("string-raw") - { - parsing_should_succeed(FILE_LINE_ARGS, - string_raw, - [](toml::table&& tbl) // string-raw - { - const auto expected = toml::table{ - { R"(backslash)"sv, R"(This string has a \\ backslash character.)"sv }, - { R"(backspace)"sv, R"(This string has a \b backspace character.)"sv }, - { R"(carriage)"sv, R"(This string has a \r carriage return character.)"sv }, - { R"(formfeed)"sv, R"(This string has a \f form feed character.)"sv }, - { R"(newline)"sv, R"(This string has a \n new line character.)"sv }, - { R"(slash)"sv, R"(This string has a \/ slash character.)"sv }, - { R"(tab)"sv, R"(This string has a \t tab character.)"sv }, - { R"(unescaped_tab)"sv, R"(This string has an unescaped tab character.)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("string-simple") - { - parsing_should_succeed(FILE_LINE_ARGS, - string_simple, - [](toml::table&& tbl) // string-simple - { - const auto expected = toml::table{ - { R"(answer)"sv, R"(You are not drinking enough whisky.)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("string-with-pound") - { - parsing_should_succeed(FILE_LINE_ARGS, - string_with_pound, - [](toml::table&& tbl) // string-with-pound - { - const auto expected = toml::table{ - { R"(pound)"sv, R"(We see no # comments here.)"sv }, - { R"(poundcomment)"sv, R"(But there are # some comments here.)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - -#if TOML_LANG_UNRELEASED - - SECTION("string-escape-esc") - { - parsing_should_succeed(FILE_LINE_ARGS, - string_escape_esc, - [](toml::table&& tbl) // string-escape-esc - { - const auto expected = toml::table{ - { R"(esc)"sv, "\x1B There is no escape! \x1B"sv }, - }; - REQUIRE(tbl == expected); - }); - } - -#endif // TOML_LANG_UNRELEASED - -#if UNICODE_LITERALS_OK - - SECTION("string-escape-tricky") - { - parsing_should_succeed(FILE_LINE_ARGS, - string_escape_tricky, - [](toml::table&& tbl) // string-escape-tricky - { - const auto expected = toml::table{ - { R"(end_esc)"sv, R"(String does not end here" but ends here\)"sv }, - { R"(lit_end_esc)"sv, R"(String ends here\)"sv }, - { R"(lit_multiline_end)"sv, R"(There is no escape\)"sv }, - { R"(lit_multiline_not_unicode)"sv, R"(\u007f)"sv }, - { R"(multiline_end_esc)"sv, R"(When will it end? """...""" should be here")"sv }, - { R"(multiline_not_unicode)"sv, R"(\u0041)"sv }, - { R"(multiline_unicode)"sv, R"( )"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("string-quoted-unicode") - { - parsing_should_succeed( - FILE_LINE_ARGS, - string_quoted_unicode, - [](toml::table&& tbl) // string-quoted-unicode - { - const auto expected = toml::table{ - { R"(escaped_string)"sv, "\x00 \x08 \f A \x7F € ÿ ퟿  ￿ 𐀀 􏿿"sv }, - { R"(not_escaped_string)"sv, - R"(\u0000 \u0008 \u000c \U00000041 \u007f \u0080 \u00ff \ud7ff \ue000 \uffff \U00010000 \U0010ffff)"sv }, - { R"(basic_string)"sv, R"(~ € ÿ ퟿  ￿ 𐀀 􏿿)"sv }, - { R"(literal_string)"sv, R"(~ € ÿ ퟿  ￿ 𐀀 􏿿)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("string-unicode-escape") - { - parsing_should_succeed(FILE_LINE_ARGS, - string_unicode_escape, - [](toml::table&& tbl) // string-unicode-escape - { - const auto expected = toml::table{ - { R"(answer4)"sv, R"(δ)"sv }, - { R"(answer8)"sv, R"(δ)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("string-unicode-literal") - { - parsing_should_succeed(FILE_LINE_ARGS, - string_unicode_literal, - [](toml::table&& tbl) // string-unicode-literal - { - const auto expected = toml::table{ - { R"(answer)"sv, R"(δ)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - -#endif // UNICODE_LITERALS_OK - -#if TOML_LANG_UNRELEASED && UNICODE_LITERALS_OK - - SECTION("string-hex-escape") - { - parsing_should_succeed(FILE_LINE_ARGS, - string_hex_escape, - [](toml::table&& tbl) // string-hex-escape - { - const auto expected = toml::table{ - { R"(bs)"sv, "\x7F"sv }, - { R"(hello)"sv, R"(hello -)"sv }, - { R"(higher-than-127)"sv, R"(Sørmirbæren)"sv }, - { R"(literal)"sv, R"(\x20 \x09 \x0d\x0a)"sv }, - { R"(multiline)"sv, - " \x1B \r\n" - "\n" - "\x7F\n" - "\x00\n" - "hello\n" - "\n" - "Sørmirbæren\n" - ""sv }, - { R"(multiline-literal)"sv, R"(\x20 \x09 \x0d\x0a -)"sv }, - { R"(nul)"sv, "\x00"sv }, - { R"(whitespace)"sv, - " \x1B \r\n" - ""sv }, - }; - REQUIRE(tbl == expected); - }); - } - -#endif // TOML_LANG_UNRELEASED && UNICODE_LITERALS_OK - - SECTION("table-array-implicit-and-explicit-after") - { - parsing_should_succeed(FILE_LINE_ARGS, - table_array_implicit_and_explicit_after, - [](toml::table&& tbl) // table-array-implicit-and-explicit-after - { - const auto expected = toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, - toml::array{ - toml::table{ - { R"(x)"sv, 1 }, - }, - } }, - { R"(y)"sv, 2 }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("table-array-implicit") - { - parsing_should_succeed(FILE_LINE_ARGS, - table_array_implicit, - [](toml::table&& tbl) // table-array-implicit - { - const auto expected = toml::table{ - { R"(albums)"sv, - toml::table{ - { R"(songs)"sv, - toml::array{ - toml::table{ - { R"(name)"sv, R"(Glory Days)"sv }, - }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("table-array-many") - { - parsing_should_succeed(FILE_LINE_ARGS, - table_array_many, - [](toml::table&& tbl) // table-array-many - { - const auto expected = toml::table{ - { R"(people)"sv, - toml::array{ - toml::table{ - { R"(first_name)"sv, R"(Bruce)"sv }, - { R"(last_name)"sv, R"(Springsteen)"sv }, - }, - toml::table{ - { R"(first_name)"sv, R"(Eric)"sv }, - { R"(last_name)"sv, R"(Clapton)"sv }, - }, - toml::table{ - { R"(first_name)"sv, R"(Bob)"sv }, - { R"(last_name)"sv, R"(Seger)"sv }, - }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("table-array-nest") - { - parsing_should_succeed(FILE_LINE_ARGS, - table_array_nest, - [](toml::table&& tbl) // table-array-nest - { - const auto expected = toml::table{ - { R"(albums)"sv, - toml::array{ - toml::table{ - { R"(name)"sv, R"(Born to Run)"sv }, - { R"(songs)"sv, - toml::array{ - toml::table{ - { R"(name)"sv, R"(Jungleland)"sv }, - }, - toml::table{ - { R"(name)"sv, R"(Meeting Across the River)"sv }, - }, - } }, - }, - toml::table{ - { R"(name)"sv, R"(Born in the USA)"sv }, - { R"(songs)"sv, - toml::array{ - toml::table{ - { R"(name)"sv, R"(Glory Days)"sv }, - }, - toml::table{ - { R"(name)"sv, R"(Dancing in the Dark)"sv }, - }, - } }, - }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("table-array-one") - { - parsing_should_succeed(FILE_LINE_ARGS, - table_array_one, - [](toml::table&& tbl) // table-array-one - { - const auto expected = toml::table{ - { R"(people)"sv, - toml::array{ - toml::table{ - { R"(first_name)"sv, R"(Bruce)"sv }, - { R"(last_name)"sv, R"(Springsteen)"sv }, - }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("table-array-table-array") - { - parsing_should_succeed(FILE_LINE_ARGS, - table_array_table_array, - [](toml::table&& tbl) // table-array-table-array - { - const auto expected = toml::table{ - { R"(a)"sv, - toml::array{ - toml::table{ - { R"(b)"sv, - toml::array{ - toml::table{ - { R"(c)"sv, - toml::table{ - { R"(d)"sv, R"(val0)"sv }, - } }, - }, - toml::table{ - { R"(c)"sv, - toml::table{ - { R"(d)"sv, R"(val1)"sv }, - } }, - }, - } }, - }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("table-array-within-dotted") - { - parsing_should_succeed(FILE_LINE_ARGS, - table_array_within_dotted, - [](toml::table&& tbl) // table-array-within-dotted - { - const auto expected = toml::table{ - { R"(fruit)"sv, - toml::table{ - { R"(apple)"sv, - toml::table{ - { R"(color)"sv, R"(red)"sv }, - { R"(seeds)"sv, - toml::array{ - toml::table{ - { R"(size)"sv, 2 }, - }, - } }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("table-empty-name") - { - parsing_should_succeed(FILE_LINE_ARGS, - table_empty_name, - [](toml::table&& tbl) // table-empty-name - { - const auto expected = toml::table{ - { ""sv, - toml::table{ - { R"(a)"sv, - toml::table{ - { R"(x)"sv, 2 }, - } }, - { R"(x)"sv, 1 }, - } }, - { R"(a)"sv, - toml::table{ - { ""sv, - toml::table{ - { R"(x)"sv, 3 }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("table-empty") - { - parsing_should_succeed(FILE_LINE_ARGS, - table_empty, - [](toml::table&& tbl) // table-empty - { - const auto expected = toml::table{ - { R"(a)"sv, toml::table{} }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("table-keyword") - { - parsing_should_succeed(FILE_LINE_ARGS, - table_keyword, - [](toml::table&& tbl) // table-keyword - { - const auto expected = toml::table{ - { R"(false)"sv, toml::table{} }, - { R"(inf)"sv, toml::table{} }, - { R"(nan)"sv, toml::table{} }, - { R"(true)"sv, toml::table{} }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("table-no-eol") - { - parsing_should_succeed(FILE_LINE_ARGS, - table_no_eol, - [](toml::table&& tbl) // table-no-eol - { - const auto expected = toml::table{ - { R"(table)"sv, toml::table{} }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("table-sub-empty") - { - parsing_should_succeed(FILE_LINE_ARGS, - table_sub_empty, - [](toml::table&& tbl) // table-sub-empty - { - const auto expected = toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, toml::table{} }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("table-sub") - { - parsing_should_succeed(FILE_LINE_ARGS, - table_sub, - [](toml::table&& tbl) // table-sub - { - const auto expected = toml::table{ - { R"(a)"sv, - toml::table{ - { R"(extend)"sv, - toml::table{ - { R"(key)"sv, 2 }, - { R"(more)"sv, - toml::table{ - { R"(key)"sv, 3 }, - } }, - } }, - { R"(key)"sv, 1 }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("table-whitespace") - { - parsing_should_succeed(FILE_LINE_ARGS, - table_whitespace, - [](toml::table&& tbl) // table-whitespace - { - const auto expected = toml::table{ - { R"(valid key)"sv, toml::table{} }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("table-with-literal-string") - { - parsing_should_succeed(FILE_LINE_ARGS, - table_with_literal_string, - [](toml::table&& tbl) // table-with-literal-string - { - const auto expected = toml::table{ - { R"(a)"sv, - toml::table{ - { R"("b")"sv, - toml::table{ - { R"(c)"sv, - toml::table{ - { R"(answer)"sv, 42 }, - } }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("table-with-pound") - { - parsing_should_succeed(FILE_LINE_ARGS, - table_with_pound, - [](toml::table&& tbl) // table-with-pound - { - const auto expected = toml::table{ - { R"(key#group)"sv, - toml::table{ - { R"(answer)"sv, 42 }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("table-with-single-quotes") - { - parsing_should_succeed(FILE_LINE_ARGS, - table_with_single_quotes, - [](toml::table&& tbl) // table-with-single-quotes - { - const auto expected = toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, - toml::table{ - { R"(c)"sv, - toml::table{ - { R"(answer)"sv, 42 }, - } }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("table-without-super") - { - parsing_should_succeed(FILE_LINE_ARGS, - table_without_super, - [](toml::table&& tbl) // table-without-super - { - const auto expected = toml::table{ - { R"(x)"sv, - toml::table{ - { R"(y)"sv, - toml::table{ - { R"(z)"sv, - toml::table{ - { R"(w)"sv, toml::table{} }, - } }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - -#if UNICODE_LITERALS_OK - - SECTION("table-names") - { - parsing_should_succeed(FILE_LINE_ARGS, - table_names, - [](toml::table&& tbl) // table-names - { - const auto expected = toml::table{ - { R"(a)"sv, - toml::table{ - { R"( x )"sv, toml::table{} }, - { R"(b)"sv, - toml::table{ - { R"(c)"sv, toml::table{} }, - } }, - { R"(b.c)"sv, toml::table{} }, - { R"(d.e)"sv, toml::table{} }, - } }, - { R"(d)"sv, - toml::table{ - { R"(e)"sv, - toml::table{ - { R"(f)"sv, toml::table{} }, - } }, - } }, - { R"(g)"sv, - toml::table{ - { R"(h)"sv, - toml::table{ - { R"(i)"sv, toml::table{} }, - } }, - } }, - { R"(j)"sv, - toml::table{ - { R"(ʞ)"sv, - toml::table{ - { R"(l)"sv, toml::table{} }, - } }, - } }, - { R"(x)"sv, - toml::table{ - { R"(1)"sv, - toml::table{ - { R"(2)"sv, toml::table{} }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - -#endif // UNICODE_LITERALS_OK -} diff --git a/tests/conformance_iarna_invalid.cpp b/tests/conformance_iarna_invalid.cpp deleted file mode 100644 index 28c32b3..0000000 --- a/tests/conformance_iarna_invalid.cpp +++ /dev/null @@ -1,451 +0,0 @@ -// This file is a part of toml++ and is subject to the the terms of the MIT license. -// Copyright (c) Mark Gillard -// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text. -// SPDX-License-Identifier: MIT -//----- -// this file was generated by generate_conformance_tests.py - do not modify it directly - -#include "tests.hpp" - -namespace -{ - static constexpr auto array_of_tables_1 = "# INVALID TOML DOC\r\n" - "fruit = []\r\n" - "\r\n" - "[[fruit]] # Not allowed"sv; - static constexpr auto array_of_tables_2 = "# INVALID TOML DOC\r\n" - "[[fruit]]\r\n" - " name = \"apple\"\r\n" - "\r\n" - " [[fruit.variety]]\r\n" - " name = \"red delicious\"\r\n" - "\r\n" - " # This table conflicts with the previous table\r\n" - " [fruit.variety]\r\n" - " name = \"granny smith\""sv; - - static constexpr auto bare_key_1 = "bare!key = 123"sv; - static constexpr auto bare_key_2 = "barekey\r\n" - " = 123"sv; - static constexpr auto bare_key_3 = R"(barekey =)"sv; - - static constexpr auto comment_control_1 = "a = \"null\" # \x00"sv; - static constexpr auto comment_control_2 = "a = \"ctrl-P\" # \x10"sv; - static constexpr auto comment_control_3 = "a = \"ctrl-_\" # \x1F"sv; - static constexpr auto comment_control_4 = "a = \"0x7f\" # \x7F"sv; - - static constexpr auto inline_table_imutable_1 = "[product]\r\n" - "type = { name = \"Nail\" }\r\n" - "type.edible = false # INVALID"sv; - static constexpr auto inline_table_imutable_2 = "[product]\r\n" - "type.name = \"Nail\"\r\n" - "type = { edible = false } # INVALID"sv; - -#if !TOML_LANG_UNRELEASED - - static constexpr auto inline_table_trailing_comma = "abc = { abc = 123, }"sv; - -#endif // !TOML_LANG_UNRELEASED - - static constexpr auto int_0_padded = "int = 0123"sv; - static constexpr auto int_signed_bin = "bin = +0b10"sv; - static constexpr auto int_signed_hex = "hex = +0xab"sv; - static constexpr auto int_signed_oct = "oct = +0o23"sv; - - static constexpr auto key_value_pair_1 = "key = # INVALID"sv; - static constexpr auto key_value_pair_2 = "first = \"Tom\" last = \"Preston-Werner\" # INVALID"sv; - - static constexpr auto multiple_dot_key = "# THE FOLLOWING IS INVALID\r\n" - "\r\n" - "# This defines the value of fruit.apple to be an integer.\r\n" - "fruit.apple = 1\r\n" - "\r\n" - "# But then this treats fruit.apple like it's a table.\r\n" - "# You can't turn an integer into a table.\r\n" - "fruit.apple.smooth = true"sv; - static constexpr auto multiple_key = "# DO NOT DO THIS\r\n" - "name = \"Tom\"\r\n" - "name = \"Pradyun\""sv; - - static constexpr auto no_key_name = "= \"no key name\" # INVALID"sv; - - static constexpr auto string_basic_control_1 = "a = \"null\x00\""sv; - static constexpr auto string_basic_control_2 = "a = \"ctrl-P\x10\""sv; - static constexpr auto string_basic_control_3 = "a = \"ctrl-_\x1F\""sv; - static constexpr auto string_basic_control_4 = "a = \"0x7f\x7F\""sv; - static constexpr auto string_basic_multiline_control_1 = "a = \"\"\"null\x00\"\"\""sv; - static constexpr auto string_basic_multiline_control_2 = "a = \"\"\"null\x10\"\"\""sv; - static constexpr auto string_basic_multiline_control_3 = "a = \"\"\"null\x1F\"\"\""sv; - static constexpr auto string_basic_multiline_control_4 = "a = \"\"\"null\x7F\"\"\""sv; - static constexpr auto string_basic_multiline_invalid_backslash = "a = \"\"\"\r\n" - " foo \\ \\n\r\n" - " bar\"\"\""sv; - static constexpr auto string_basic_multiline_out_of_range_unicode_escape_1 = "a = \"\"\"\\UFFFFFFFF\"\"\""sv; - static constexpr auto string_basic_multiline_out_of_range_unicode_escape_2 = "a = \"\"\"\\U00D80000\"\"\""sv; - static constexpr auto string_basic_multiline_quotes = - "str5 = \"\"\"Here are three quotation marks: \"\"\".\"\"\""sv; - static constexpr auto string_basic_multiline_unknown_escape = "a = \"\"\"\\@\"\"\""sv; - static constexpr auto string_basic_out_of_range_unicode_escape_1 = "a = \"\\UFFFFFFFF\""sv; - static constexpr auto string_basic_out_of_range_unicode_escape_2 = "a = \"\\U00D80000\""sv; - static constexpr auto string_basic_unknown_escape = "a = \"\\@\""sv; - static constexpr auto string_literal_control_1 = "a = 'null\x00'"sv; - static constexpr auto string_literal_control_2 = "a = 'null\x10'"sv; - static constexpr auto string_literal_control_3 = "a = 'null\x1F'"sv; - static constexpr auto string_literal_control_4 = "a = 'null\x7F'"sv; - static constexpr auto string_literal_multiline_control_1 = "a = '''null\x00'''"sv; - static constexpr auto string_literal_multiline_control_2 = "a = '''null\x10'''"sv; - static constexpr auto string_literal_multiline_control_3 = "a = '''null\x1F'''"sv; - static constexpr auto string_literal_multiline_control_4 = "a = '''null\x7F'''"sv; - static constexpr auto string_literal_multiline_quotes = - "apos15 = '''Here are fifteen apostrophes: '''''''''''''''''' # INVALID"sv; - - static constexpr auto table_1 = "# DO NOT DO THIS\r\n" - "\r\n" - "[fruit]\r\n" - "apple = \"red\"\r\n" - "\r\n" - "[fruit]\r\n" - "orange = \"orange\""sv; - static constexpr auto table_2 = "# DO NOT DO THIS EITHER\r\n" - "\r\n" - "[fruit]\r\n" - "apple = \"red\"\r\n" - "\r\n" - "[fruit.apple]\r\n" - "texture = \"smooth\""sv; - static constexpr auto table_3 = "[fruit]\r\n" - "apple.color = \"red\"\r\n" - "apple.taste.sweet = true\r\n" - "\r\n" - "[fruit.apple] # INVALID"sv; - static constexpr auto table_4 = "[fruit]\r\n" - "apple.color = \"red\"\r\n" - "apple.taste.sweet = true\r\n" - "\r\n" - "[fruit.apple.taste] # INVALID"sv; - static constexpr auto table_invalid_1 = - "[fruit.physical] # subtable, but to which parent element should it belong?\r\n" - " color = \"red\"\r\n" - " shape = \"round\"\r\n" - "\r\n" - "[[fruit]] # parser must throw an error upon discovering that \"fruit\" is\r\n" - " # an array rather than a table\r\n" - " name = \"apple\""sv; - static constexpr auto table_invalid_2 = "# INVALID TOML DOC\r\n" - "fruit = []\r\n" - "\r\n" - "[[fruit]] # Not allowed"sv; - static constexpr auto table_invalid_3 = "# INVALID TOML DOC\r\n" - "[[fruit]]\r\n" - " name = \"apple\"\r\n" - "\r\n" - " [[fruit.variety]]\r\n" - " name = \"red delicious\"\r\n" - "\r\n" - " # INVALID: This table conflicts with the previous array of tables\r\n" - " [fruit.variety]\r\n" - " name = \"granny smith\"\r\n" - "\r\n" - " [fruit.physical]\r\n" - " color = \"red\"\r\n" - " shape = \"round\""sv; - static constexpr auto table_invalid_4 = "# INVALID TOML DOC\r\n" - "[[fruit]]\r\n" - " name = \"apple\"\r\n" - "\r\n" - " [[fruit.variety]]\r\n" - " name = \"red delicious\"\r\n" - "\r\n" - " [fruit.physical]\r\n" - " color = \"red\"\r\n" - " shape = \"round\"\r\n" - "\r\n" - " # INVALID: This array of tables conflicts with the previous table\r\n" - " [[fruit.physical]]\r\n" - " color = \"green\""sv; -} - -TEST_CASE("conformance - iarna/invalid") -{ - SECTION("array-of-tables-1") - { - parsing_should_fail(FILE_LINE_ARGS, array_of_tables_1); // array-of-tables-1 - } - - SECTION("array-of-tables-2") - { - parsing_should_fail(FILE_LINE_ARGS, array_of_tables_2); // array-of-tables-2 - } - - SECTION("bare-key-1") - { - parsing_should_fail(FILE_LINE_ARGS, bare_key_1); // bare-key-1 - } - - SECTION("bare-key-2") - { - parsing_should_fail(FILE_LINE_ARGS, bare_key_2); // bare-key-2 - } - - SECTION("bare-key-3") - { - parsing_should_fail(FILE_LINE_ARGS, bare_key_3); // bare-key-3 - } - - SECTION("comment-control-1") - { - parsing_should_fail(FILE_LINE_ARGS, comment_control_1); // comment-control-1 - } - - SECTION("comment-control-2") - { - parsing_should_fail(FILE_LINE_ARGS, comment_control_2); // comment-control-2 - } - - SECTION("comment-control-3") - { - parsing_should_fail(FILE_LINE_ARGS, comment_control_3); // comment-control-3 - } - - SECTION("comment-control-4") - { - parsing_should_fail(FILE_LINE_ARGS, comment_control_4); // comment-control-4 - } - - SECTION("inline-table-imutable-1") - { - parsing_should_fail(FILE_LINE_ARGS, inline_table_imutable_1); // inline-table-imutable-1 - } - - SECTION("inline-table-imutable-2") - { - parsing_should_fail(FILE_LINE_ARGS, inline_table_imutable_2); // inline-table-imutable-2 - } - -#if !TOML_LANG_UNRELEASED - - SECTION("inline-table-trailing-comma") - { - parsing_should_fail(FILE_LINE_ARGS, inline_table_trailing_comma); // inline-table-trailing-comma - } - -#endif // !TOML_LANG_UNRELEASED - - SECTION("int-0-padded") - { - parsing_should_fail(FILE_LINE_ARGS, int_0_padded); // int-0-padded - } - - SECTION("int-signed-bin") - { - parsing_should_fail(FILE_LINE_ARGS, int_signed_bin); // int-signed-bin - } - - SECTION("int-signed-hex") - { - parsing_should_fail(FILE_LINE_ARGS, int_signed_hex); // int-signed-hex - } - - SECTION("int-signed-oct") - { - parsing_should_fail(FILE_LINE_ARGS, int_signed_oct); // int-signed-oct - } - - SECTION("key-value-pair-1") - { - parsing_should_fail(FILE_LINE_ARGS, key_value_pair_1); // key-value-pair-1 - } - - SECTION("key-value-pair-2") - { - parsing_should_fail(FILE_LINE_ARGS, key_value_pair_2); // key-value-pair-2 - } - - SECTION("multiple-dot-key") - { - parsing_should_fail(FILE_LINE_ARGS, multiple_dot_key); // multiple-dot-key - } - - SECTION("multiple-key") - { - parsing_should_fail(FILE_LINE_ARGS, multiple_key); // multiple-key - } - - SECTION("no-key-name") - { - parsing_should_fail(FILE_LINE_ARGS, no_key_name); // no-key-name - } - - SECTION("string-basic-control-1") - { - parsing_should_fail(FILE_LINE_ARGS, string_basic_control_1); // string-basic-control-1 - } - - SECTION("string-basic-control-2") - { - parsing_should_fail(FILE_LINE_ARGS, string_basic_control_2); // string-basic-control-2 - } - - SECTION("string-basic-control-3") - { - parsing_should_fail(FILE_LINE_ARGS, string_basic_control_3); // string-basic-control-3 - } - - SECTION("string-basic-control-4") - { - parsing_should_fail(FILE_LINE_ARGS, string_basic_control_4); // string-basic-control-4 - } - - SECTION("string-basic-multiline-control-1") - { - parsing_should_fail(FILE_LINE_ARGS, string_basic_multiline_control_1); // string-basic-multiline-control-1 - } - - SECTION("string-basic-multiline-control-2") - { - parsing_should_fail(FILE_LINE_ARGS, string_basic_multiline_control_2); // string-basic-multiline-control-2 - } - - SECTION("string-basic-multiline-control-3") - { - parsing_should_fail(FILE_LINE_ARGS, string_basic_multiline_control_3); // string-basic-multiline-control-3 - } - - SECTION("string-basic-multiline-control-4") - { - parsing_should_fail(FILE_LINE_ARGS, string_basic_multiline_control_4); // string-basic-multiline-control-4 - } - - SECTION("string-basic-multiline-invalid-backslash") - { - parsing_should_fail(FILE_LINE_ARGS, - string_basic_multiline_invalid_backslash); // string-basic-multiline-invalid-backslash - } - - SECTION("string-basic-multiline-out-of-range-unicode-escape-1") - { - parsing_should_fail( - FILE_LINE_ARGS, - string_basic_multiline_out_of_range_unicode_escape_1); // string-basic-multiline-out-of-range-unicode-escape-1 - } - - SECTION("string-basic-multiline-out-of-range-unicode-escape-2") - { - parsing_should_fail( - FILE_LINE_ARGS, - string_basic_multiline_out_of_range_unicode_escape_2); // string-basic-multiline-out-of-range-unicode-escape-2 - } - - SECTION("string-basic-multiline-quotes") - { - parsing_should_fail(FILE_LINE_ARGS, string_basic_multiline_quotes); // string-basic-multiline-quotes - } - - SECTION("string-basic-multiline-unknown-escape") - { - parsing_should_fail(FILE_LINE_ARGS, - string_basic_multiline_unknown_escape); // string-basic-multiline-unknown-escape - } - - SECTION("string-basic-out-of-range-unicode-escape-1") - { - parsing_should_fail(FILE_LINE_ARGS, - string_basic_out_of_range_unicode_escape_1); // string-basic-out-of-range-unicode-escape-1 - } - - SECTION("string-basic-out-of-range-unicode-escape-2") - { - parsing_should_fail(FILE_LINE_ARGS, - string_basic_out_of_range_unicode_escape_2); // string-basic-out-of-range-unicode-escape-2 - } - - SECTION("string-basic-unknown-escape") - { - parsing_should_fail(FILE_LINE_ARGS, string_basic_unknown_escape); // string-basic-unknown-escape - } - - SECTION("string-literal-control-1") - { - parsing_should_fail(FILE_LINE_ARGS, string_literal_control_1); // string-literal-control-1 - } - - SECTION("string-literal-control-2") - { - parsing_should_fail(FILE_LINE_ARGS, string_literal_control_2); // string-literal-control-2 - } - - SECTION("string-literal-control-3") - { - parsing_should_fail(FILE_LINE_ARGS, string_literal_control_3); // string-literal-control-3 - } - - SECTION("string-literal-control-4") - { - parsing_should_fail(FILE_LINE_ARGS, string_literal_control_4); // string-literal-control-4 - } - - SECTION("string-literal-multiline-control-1") - { - parsing_should_fail(FILE_LINE_ARGS, string_literal_multiline_control_1); // string-literal-multiline-control-1 - } - - SECTION("string-literal-multiline-control-2") - { - parsing_should_fail(FILE_LINE_ARGS, string_literal_multiline_control_2); // string-literal-multiline-control-2 - } - - SECTION("string-literal-multiline-control-3") - { - parsing_should_fail(FILE_LINE_ARGS, string_literal_multiline_control_3); // string-literal-multiline-control-3 - } - - SECTION("string-literal-multiline-control-4") - { - parsing_should_fail(FILE_LINE_ARGS, string_literal_multiline_control_4); // string-literal-multiline-control-4 - } - - SECTION("string-literal-multiline-quotes") - { - parsing_should_fail(FILE_LINE_ARGS, string_literal_multiline_quotes); // string-literal-multiline-quotes - } - - SECTION("table-1") - { - parsing_should_fail(FILE_LINE_ARGS, table_1); // table-1 - } - - SECTION("table-2") - { - parsing_should_fail(FILE_LINE_ARGS, table_2); // table-2 - } - - SECTION("table-3") - { - parsing_should_fail(FILE_LINE_ARGS, table_3); // table-3 - } - - SECTION("table-4") - { - parsing_should_fail(FILE_LINE_ARGS, table_4); // table-4 - } - - SECTION("table-invalid-1") - { - parsing_should_fail(FILE_LINE_ARGS, table_invalid_1); // table-invalid-1 - } - - SECTION("table-invalid-2") - { - parsing_should_fail(FILE_LINE_ARGS, table_invalid_2); // table-invalid-2 - } - - SECTION("table-invalid-3") - { - parsing_should_fail(FILE_LINE_ARGS, table_invalid_3); // table-invalid-3 - } - - SECTION("table-invalid-4") - { - parsing_should_fail(FILE_LINE_ARGS, table_invalid_4); // table-invalid-4 - } -} diff --git a/tests/conformance_iarna_valid.cpp b/tests/conformance_iarna_valid.cpp deleted file mode 100644 index 8848906..0000000 --- a/tests/conformance_iarna_valid.cpp +++ /dev/null @@ -1,2210 +0,0 @@ -// This file is a part of toml++ and is subject to the the terms of the MIT license. -// Copyright (c) Mark Gillard -// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text. -// SPDX-License-Identifier: MIT -//----- -// this file was generated by generate_conformance_tests.py - do not modify it directly - -#include "tests.hpp" - -namespace -{ - static constexpr auto spec_array_1 = "integers = [ 1, 2, 3 ]"sv; - static constexpr auto spec_array_2 = "colors = [ \"red\", \"yellow\", \"green\" ]"sv; - static constexpr auto spec_array_3 = "nested_array_of_int = [ [ 1, 2 ], [3, 4, 5] ]"sv; - static constexpr auto spec_array_4 = "string_array = [ \"all\", 'strings', \"\"\"are the same\"\"\", '''type''']"sv; - static constexpr auto spec_array_5 = "nested_mixed_array = [ [ 1, 2 ], [\"a\", \"b\", \"c\"] ]"sv; - static constexpr auto spec_array_7 = "integers2 = [\r\n" - " 1, 2, 3\r\n" - "]"sv; - static constexpr auto spec_array_8 = "integers3 = [\r\n" - " 1,\r\n" - " 2, # this is ok\r\n" - "]"sv; - static constexpr auto spec_array_mixed_number_types = "numbers = [ 0.1, 0.2, 0.5, 1, 2, 5 ]"sv; - static constexpr auto spec_array_more_mixed_types = - "contributors = [\r\n" - " \"Foo Bar \",\r\n" - " { name = \"Baz Qux\", email = \"bazqux@example.com\", url = \"https://example.com/bazqux\" }\r\n" - "]"sv; - static constexpr auto spec_array_of_tables_1 = "[[products]]\r\n" - "name = \"Hammer\"\r\n" - "sku = 738594937\r\n" - "\r\n" - "[[products]]\r\n" - "\r\n" - "[[products]]\r\n" - "name = \"Nail\"\r\n" - "sku = 284758393\r\n" - "color = \"gray\""sv; - static constexpr auto spec_array_of_tables_2 = "[[fruit]]\r\n" - " name = \"apple\"\r\n" - "\r\n" - " [fruit.physical]\r\n" - " color = \"red\"\r\n" - " shape = \"round\"\r\n" - "\r\n" - " [[fruit.variety]]\r\n" - " name = \"red delicious\"\r\n" - "\r\n" - " [[fruit.variety]]\r\n" - " name = \"granny smith\"\r\n" - "\r\n" - "[[fruit]]\r\n" - " name = \"banana\"\r\n" - "\r\n" - " [[fruit.variety]]\r\n" - " name = \"plantain\""sv; - static constexpr auto spec_array_of_tables_3 = "points = [ { x = 1, y = 2, z = 3 },\r\n" - " { x = 7, y = 8, z = 9 },\r\n" - " { x = 2, y = 4, z = 8 } ]"sv; - static constexpr auto spec_boolean_1 = "bool1 = true"sv; - static constexpr auto spec_boolean_2 = "bool1 = false"sv; - static constexpr auto spec_case_sensitive = "# TOML is case sensitive.\r\n" - "abc = 123\r\n" - "ABC = 456"sv; - static constexpr auto spec_comment_mid_array = "# eol commetns can go anywhere\r\n" - "abc = [ # this is valid\r\n" - " 123,#as is this\r\n" - " 456 #so is this\r\n" - " ]# and this\r\n" - "# here too"sv; - static constexpr auto spec_comment_mid_string = "another = \"# This is not a comment\""sv; - static constexpr auto spec_comment_tab = - "# This is a full-line comment with a tab in the middle\r\n" - "key = \"value\" # This is a commen with a tab in the middle at the end of a line"sv; - static constexpr auto spec_comment = "# This is a full-line comment\r\n" - "key = \"value\" # This is a comment at the end of a line"sv; - static constexpr auto spec_date_local_1 = "ld1 = 1979-05-27"sv; - static constexpr auto spec_date_time_1 = "odt1 = 1979-05-27T07:32:00Z"sv; - static constexpr auto spec_date_time_2 = "odt2 = 1979-05-27T00:32:00-07:00"sv; - static constexpr auto spec_date_time_3 = "odt3 = 1979-05-27T00:32:00.999999-07:00"sv; - static constexpr auto spec_date_time_4 = "odt4 = 1979-05-27 07:32:00Z"sv; - static constexpr auto spec_date_time_5 = "odt5 = 1979-05-27T07:32:00.123Z"sv; - static constexpr auto spec_date_time_local_1 = "ldt1 = 1979-05-27T07:32:00"sv; - static constexpr auto spec_dotted_keys_1 = "name = \"Orange\"\r\n" - "physical.color = \"orange\"\r\n" - "physical.shape = \"round\"\r\n" - "site.\"google.com\" = true"sv; - static constexpr auto spec_dotted_keys_2 = "a . b = 23"sv; - static constexpr auto spec_dotted_keys_3 = "a . b = 23"sv; - static constexpr auto spec_empty_key_name_1 = "\"\" = \"blank\" # VALID but discouraged"sv; - static constexpr auto spec_empty_key_name_2 = "'' = \"blank\" # VALID but discouraged"sv; - static constexpr auto spec_extend_dotted_object_1 = "# This makes the key \"fruit\" into a table.\r\n" - "fruit.apple.smooth = true\r\n" - "\r\n" - "# So then you can add to the table \"fruit\" like so:\r\n" - "fruit.orange = 2"sv; - static constexpr auto spec_extend_dotted_object_2 = "# VALID BUT DISCOURAGED\r\n" - "\r\n" - "apple.type = \"fruit\"\r\n" - "orange.type = \"fruit\"\r\n" - "\r\n" - "apple.skin = \"thin\"\r\n" - "orange.skin = \"thick\"\r\n" - "\r\n" - "apple.color = \"red\"\r\n" - "orange.color = \"orange\""sv; - static constexpr auto spec_extend_dotted_object_3 = "# RECOMMENDED\r\n" - "\r\n" - "apple.type = \"fruit\"\r\n" - "apple.skin = \"thin\"\r\n" - "apple.color = \"red\"\r\n" - "\r\n" - "orange.type = \"fruit\"\r\n" - "orange.skin = \"thick\"\r\n" - "orange.color = \"orange\""sv; - static constexpr auto spec_float_1 = "flt1 = +1.0"sv; - static constexpr auto spec_float_10 = "sf1 = inf # positive infinity"sv; - static constexpr auto spec_float_11 = "sf2 = +inf # positive infinity"sv; - static constexpr auto spec_float_12 = "sf2 = -inf # negative infinity"sv; - static constexpr auto spec_float_13 = "sf4 = nan # actual sNaN/qNaN encoding is implementation specific"sv; - static constexpr auto spec_float_14 = "sf5 = +nan # same as `nan`"sv; - static constexpr auto spec_float_15 = "sf6 = -nan # valid, actual encoding is implementation specific"sv; - static constexpr auto spec_float_2 = "flt2 = 3.1415"sv; - static constexpr auto spec_float_3 = "flt3 = -0.01"sv; - static constexpr auto spec_float_4 = "flt4 = 5e+22"sv; - static constexpr auto spec_float_5 = "flt5 = 1e06"sv; - static constexpr auto spec_float_6 = "flt6 = -2E-2"sv; - static constexpr auto spec_float_7 = "flt7 = 6.626e-34"sv; - static constexpr auto spec_float_8 = "flt8 = 224_617.445_991_228"sv; - static constexpr auto spec_float_9 = "flt9 = -0e0"sv; - static constexpr auto spec_int_1 = "int1 = +99"sv; - static constexpr auto spec_int_2 = "int2 = 42"sv; - static constexpr auto spec_int_3 = "int3 = 0"sv; - static constexpr auto spec_int_3a = "int3 = +0"sv; - static constexpr auto spec_int_3b = "int3 = -0"sv; - static constexpr auto spec_int_4 = "int4 = -17"sv; - static constexpr auto spec_int_5 = "int5 = 1_000"sv; - static constexpr auto spec_int_6 = "int6 = 5_349_221"sv; - static constexpr auto spec_int_7 = "int7 = 1_2_3_4_5 # VALID but discouraged"sv; - static constexpr auto spec_int_bin1 = "bin1 = 0b11010110"sv; - static constexpr auto spec_int_hex1 = "hex1 = 0xDEADBEEF"sv; - static constexpr auto spec_int_hex2 = "hex2 = 0xdeadbeef"sv; - static constexpr auto spec_int_hex3 = "hex3 = 0xdead_beef"sv; - static constexpr auto spec_int_max = "max=9_223_372_036_854_775_807"sv; - static constexpr auto spec_int_min = "min=-9_223_372_036_854_775_808"sv; - static constexpr auto spec_int_oct1 = "oct1 = 0o01234567"sv; - static constexpr auto spec_int_oct2 = "oct2 = 0o755 # useful for Unix file permissions"sv; - static constexpr auto spec_key_value_pair_1 = "key = \"value\""sv; - static constexpr auto spec_key_value_pair_2 = "bare_key = \"value\""sv; - static constexpr auto spec_key_value_pair_3 = "bare-key = \"value\""sv; - static constexpr auto spec_key_value_pair_4 = "1234 = \"value\""sv; - static constexpr auto spec_key_value_pair_5 = "1234=\"value\""sv; - static constexpr auto spec_key_value_pair_6 = "-=1"sv; - static constexpr auto spec_key_value_pair_7 = "_=1"sv; - static constexpr auto spec_key_value_pair_8 = "-_-_-_-_-=1"sv; - static constexpr auto spec_key_value_pair_9 = "3.14159 = \"pi\""sv; - static constexpr auto spec_newline_1 = R"(abc = 123 -def = 456)"sv; - static constexpr auto spec_newline_2 = "abc = 123\r\n" - "def = 456"sv; - static constexpr auto spec_newline_3 = "abc = 123\r\n" - "def = 456\n" - "ghi = 789"sv; - static constexpr auto spec_quoted_literal_keys_1 = "'quoted \"value\"' = \"value\""sv; - static constexpr auto spec_readme_example = "# This is a TOML document.\r\n" - "\r\n" - "title = \"TOML Example\"\r\n" - "\r\n" - "[owner]\r\n" - "name = \"Tom Preston-Werner\"\r\n" - "dob = 1979-05-27T07:32:00-08:00 # First class dates\r\n" - "\r\n" - "[database]\r\n" - "server = \"192.168.1.1\"\r\n" - "ports = [ 8001, 8001, 8002 ]\r\n" - "connection_max = 5000\r\n" - "enabled = true\r\n" - "\r\n" - "[servers]\r\n" - "\r\n" - " # Indentation (tabs and/or spaces) is allowed but not required\r\n" - " [servers.alpha]\r\n" - " ip = \"10.0.0.1\"\r\n" - " dc = \"eqdc10\"\r\n" - "\r\n" - " [servers.beta]\r\n" - " ip = \"10.0.0.2\"\r\n" - " dc = \"eqdc10\"\r\n" - "\r\n" - "[clients]\r\n" - "data = [ [\"gamma\", \"delta\"], [1, 2] ]\r\n" - "\r\n" - "# Line breaks are OK when inside arrays\r\n" - "hosts = [\r\n" - " \"alpha\",\r\n" - " \"omega\"\r\n" - "]"sv; - static constexpr auto spec_string_basic_multiline_1 = "str1 = \"\"\"\r\n" - "Roses are red\r\n" - "Violets are blue\"\"\""sv; - static constexpr auto spec_string_basic_multiline_2 = "str = \"\"\"\r\n" - "The quick brown \\\r\n" - "\r\n" - "\r\n" - " fox jumps over \\\r\n" - " the lazy dog.\"\"\""sv; - static constexpr auto spec_string_basic_multiline_3 = "str = \"\"\"\\\r\n" - " The quick brown \\\r\n" - " fox jumps over \\\r\n" - " the lazy dog.\\\r\n" - " \"\"\""sv; - static constexpr auto spec_string_basic_multiline_4 = "a = \"\"\"abc\\ \r\n" - "def\"\"\""sv; - static constexpr auto spec_string_basic_multiline_5 = "ml-escaped-nl = \"\"\"\r\n" - " foo \\\r\n" - " bar \\\\\r\n" - " baz \\\\\\\r\n" - " quux\"\"\""sv; - static constexpr auto spec_string_basic_multiline_6 = - "str4 = \"\"\"Here are two quotation marks: \"\". Simple enough.\"\"\""sv; - static constexpr auto spec_string_basic_multiline_7 = - "str5 = \"\"\"Here are three quotation marks: \"\"\\\".\"\"\""sv; - static constexpr auto spec_string_basic_multiline_8 = - "str6 = \"\"\"Here are fifteen quotation marks: \"\"\\\"\"\"\\\"\"\"\\\"\"\"\\\"\"\"\\\".\"\"\""sv; - static constexpr auto spec_string_basic_multiline_9 = - "str7 = \"\"\"\"This,\" she said, \"is just a pointless statement.\"\"\"\""sv; - static constexpr auto spec_string_basic_tab_multiline = "str = \"\"\"This is a tab\"\"\""sv; - static constexpr auto spec_string_basic_tab = "str = \"This is a tab\""sv; - static constexpr auto spec_string_escape_1 = "a = \"\\b\""sv; - static constexpr auto spec_string_escape_2 = "a = \"\\t\""sv; - static constexpr auto spec_string_escape_3 = "a = \"\\n\""sv; - static constexpr auto spec_string_escape_4 = "a = \"\\f\""sv; - static constexpr auto spec_string_escape_5 = "a = \"\\r\""sv; - static constexpr auto spec_string_escape_6 = "a = \"\\\"\""sv; - static constexpr auto spec_string_escape_7 = "a = \"\\\\\""sv; - static constexpr auto spec_string_escape_8 = "a = \"\\u0000\""sv; - static constexpr auto spec_string_escape_9 = "a = \"\\U00000000\""sv; - static constexpr auto spec_string_literal_1 = "winpath = 'C:\\Users\\nodejs\\templates'"sv; - static constexpr auto spec_string_literal_2 = "winpath2 = '\\\\ServerX\\admin$\\system32\\'"sv; - static constexpr auto spec_string_literal_3 = "quoted = 'Tom \"Dubs\" Preston-Werner'"sv; - static constexpr auto spec_string_literal_4 = "regex = '<\\i\\c*\\s*>'"sv; - static constexpr auto spec_string_literal_multiline_1 = "regex2 = '''I [dw]on't need \\d{2} apples'''"sv; - static constexpr auto spec_string_literal_multiline_2 = "lines = '''\r\n" - "The first newline is\r\n" - "trimmed in raw strings.\r\n" - " All other whitespace\r\n" - " is preserved.\r\n" - "'''"sv; - static constexpr auto spec_string_literal_multiline_3 = - "quot15 = '''Here are fifteen quotation marks: \"\"\"\"\"\"\"\"\"\"\"\"\"\"\"'''"sv; - static constexpr auto spec_string_literal_multiline_4 = "str = ''''That,' she said, 'is still pointless.''''"sv; - static constexpr auto spec_table_1 = "[table-1]\r\n" - "key1 = \"some string\"\r\n" - "key2 = 123\r\n" - "\r\n" - "[table-2]\r\n" - "key1 = \"another string\"\r\n" - "key2 = 456"sv; - static constexpr auto spec_table_2 = "[dog.\"tater.man\"]\r\n" - "type.name = \"pug\""sv; - static constexpr auto spec_table_3 = "[a.b.c]"sv; - static constexpr auto spec_table_4 = "[ d.e.f ] # same as [d.e.f]"sv; - static constexpr auto spec_table_5 = "[ g . h . i ] # same as [g.h.i]"sv; - static constexpr auto spec_table_7 = "# [x] you\r\n" - "# [x.y] don't\r\n" - "# [x.y.z] need these\r\n" - "[x.y.z.w] # for this to work\r\n" - "[x] # defining a super-table afterwards is ok"sv; - static constexpr auto spec_table_8 = "[fruit]\r\n" - "apple.color = \"red\"\r\n" - "apple.taste.sweet = true\r\n" - "\r\n" - "[fruit.apple.texture] # you can add sub-tables\r\n" - "smooth = true"sv; - static constexpr auto spec_table_inline_1 = "name = { first = \"Tom\", last = \"Preston-Werner\" }"sv; - static constexpr auto spec_table_inline_2 = "point = { x = 1, y = 2 }"sv; - static constexpr auto spec_table_inline_3 = "animal = { type.name = \"pug\" } "sv; - static constexpr auto spec_table = "[table]"sv; - static constexpr auto spec_time_1 = "lt1 = 07:32:00"sv; - -#if UNICODE_LITERALS_OK - - static constexpr auto spec_quoted_basic_keys_1 = "\"ʎǝʞ\" = \"value\""sv; - static constexpr auto spec_string_basic = - "str = \"I'm a string. \\\"You can quote me\\\". Name\\tJos\\u00E9\\nLocation\\tSF.\""sv; - static constexpr auto spec_table_6 = "[ j . \"ʞ\" . 'l' ] # same as [j.\"ʞ\".'l']"sv; - -#endif // UNICODE_LITERALS_OK -} - -TEST_CASE("conformance - iarna/valid") -{ - SECTION("spec-array-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_array_1, - [](toml::table&& tbl) // spec-array-1 - { - const auto expected = toml::table{ - { R"(integers)"sv, - toml::array{ - 1, - 2, - 3, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-array-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_array_2, - [](toml::table&& tbl) // spec-array-2 - { - const auto expected = toml::table{ - { R"(colors)"sv, - toml::array{ - R"(red)"sv, - R"(yellow)"sv, - R"(green)"sv, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-array-3") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_array_3, - [](toml::table&& tbl) // spec-array-3 - { - const auto expected = toml::table{ - { R"(nested_array_of_int)"sv, - toml::array{ - toml::array{ - 1, - 2, - }, - toml::array{ - 3, - 4, - 5, - }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-array-4") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_array_4, - [](toml::table&& tbl) // spec-array-4 - { - const auto expected = toml::table{ - { R"(string_array)"sv, - toml::array{ - R"(all)"sv, - R"(strings)"sv, - R"(are the same)"sv, - R"(type)"sv, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-array-5") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_array_5, - [](toml::table&& tbl) // spec-array-5 - { - const auto expected = toml::table{ - { R"(nested_mixed_array)"sv, - toml::array{ - toml::array{ - 1, - 2, - }, - toml::array{ - R"(a)"sv, - R"(b)"sv, - R"(c)"sv, - }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-array-7") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_array_7, - [](toml::table&& tbl) // spec-array-7 - { - const auto expected = toml::table{ - { R"(integers2)"sv, - toml::array{ - 1, - 2, - 3, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-array-8") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_array_8, - [](toml::table&& tbl) // spec-array-8 - { - const auto expected = toml::table{ - { R"(integers3)"sv, - toml::array{ - 1, - 2, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-array-mixed-number-types") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_array_mixed_number_types, - [](toml::table&& tbl) // spec-array-mixed-number-types - { - const auto expected = toml::table{ - { R"(numbers)"sv, - toml::array{ - 0.1, - 0.2, - 0.5, - 1, - 2, - 5, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-array-more-mixed-types") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_array_more_mixed_types, - [](toml::table&& tbl) // spec-array-more-mixed-types - { - const auto expected = toml::table{ - { R"(contributors)"sv, - toml::array{ - R"(Foo Bar )"sv, - toml::table{ - { R"(name)"sv, R"(Baz Qux)"sv }, - { R"(email)"sv, R"(bazqux@example.com)"sv }, - { R"(url)"sv, R"(https://example.com/bazqux)"sv }, - }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-array-of-tables-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_array_of_tables_1, - [](toml::table&& tbl) // spec-array-of-tables-1 - { - const auto expected = toml::table{ - { R"(products)"sv, - toml::array{ - toml::table{ - { R"(name)"sv, R"(Hammer)"sv }, - { R"(sku)"sv, 738594937 }, - }, - toml::table{}, - toml::table{ - { R"(name)"sv, R"(Nail)"sv }, - { R"(sku)"sv, 284758393 }, - { R"(color)"sv, R"(gray)"sv }, - }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-array-of-tables-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_array_of_tables_2, - [](toml::table&& tbl) // spec-array-of-tables-2 - { - const auto expected = toml::table{ - { R"(fruit)"sv, - toml::array{ - toml::table{ - { R"(name)"sv, R"(apple)"sv }, - { R"(physical)"sv, - toml::table{ - { R"(color)"sv, R"(red)"sv }, - { R"(shape)"sv, R"(round)"sv }, - } }, - { R"(variety)"sv, - toml::array{ - toml::table{ - { R"(name)"sv, R"(red delicious)"sv }, - }, - toml::table{ - { R"(name)"sv, R"(granny smith)"sv }, - }, - } }, - }, - toml::table{ - { R"(name)"sv, R"(banana)"sv }, - { R"(variety)"sv, - toml::array{ - toml::table{ - { R"(name)"sv, R"(plantain)"sv }, - }, - } }, - }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-array-of-tables-3") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_array_of_tables_3, - [](toml::table&& tbl) // spec-array-of-tables-3 - { - const auto expected = toml::table{ - { R"(points)"sv, - toml::array{ - toml::table{ - { R"(x)"sv, 1 }, - { R"(y)"sv, 2 }, - { R"(z)"sv, 3 }, - }, - toml::table{ - { R"(x)"sv, 7 }, - { R"(y)"sv, 8 }, - { R"(z)"sv, 9 }, - }, - toml::table{ - { R"(x)"sv, 2 }, - { R"(y)"sv, 4 }, - { R"(z)"sv, 8 }, - }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-boolean-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_boolean_1, - [](toml::table&& tbl) // spec-boolean-1 - { - const auto expected = toml::table{ - { R"(bool1)"sv, true }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-boolean-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_boolean_2, - [](toml::table&& tbl) // spec-boolean-2 - { - const auto expected = toml::table{ - { R"(bool1)"sv, false }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-case-sensitive") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_case_sensitive, - [](toml::table&& tbl) // spec-case-sensitive - { - const auto expected = toml::table{ - { R"(abc)"sv, 123 }, - { R"(ABC)"sv, 456 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-comment-mid-array") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_comment_mid_array, - [](toml::table&& tbl) // spec-comment-mid-array - { - const auto expected = toml::table{ - { R"(abc)"sv, - toml::array{ - 123, - 456, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-comment-mid-string") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_comment_mid_string, - [](toml::table&& tbl) // spec-comment-mid-string - { - const auto expected = toml::table{ - { R"(another)"sv, R"(# This is not a comment)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-comment-tab") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_comment_tab, - [](toml::table&& tbl) // spec-comment-tab - { - const auto expected = toml::table{ - { R"(key)"sv, R"(value)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-comment") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_comment, - [](toml::table&& tbl) // spec-comment - { - const auto expected = toml::table{ - { R"(key)"sv, R"(value)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-date-local-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_date_local_1, - [](toml::table&& tbl) // spec-date-local-1 - { - const auto expected = toml::table{ - { R"(ld1)"sv, toml::date{ 1979, 5, 27 } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-date-time-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_date_time_1, - [](toml::table&& tbl) // spec-date-time-1 - { - const auto expected = toml::table{ - { R"(odt1)"sv, toml::date_time{ { 1979, 5, 27 }, { 7, 32 }, { 0, 0 } } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-date-time-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_date_time_2, - [](toml::table&& tbl) // spec-date-time-2 - { - const auto expected = toml::table{ - { R"(odt2)"sv, toml::date_time{ { 1979, 5, 27 }, { 0, 32 }, { -7, 0 } } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-date-time-3") - { - parsing_should_succeed( - FILE_LINE_ARGS, - spec_date_time_3, - [](toml::table&& tbl) // spec-date-time-3 - { - const auto expected = toml::table{ - { R"(odt3)"sv, toml::date_time{ { 1979, 5, 27 }, { 0, 32, 0, 999999000 }, { -7, 0 } } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-date-time-4") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_date_time_4, - [](toml::table&& tbl) // spec-date-time-4 - { - const auto expected = toml::table{ - { R"(odt4)"sv, toml::date_time{ { 1979, 5, 27 }, { 7, 32 }, { 0, 0 } } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-date-time-5") - { - parsing_should_succeed( - FILE_LINE_ARGS, - spec_date_time_5, - [](toml::table&& tbl) // spec-date-time-5 - { - const auto expected = toml::table{ - { R"(odt5)"sv, toml::date_time{ { 1979, 5, 27 }, { 7, 32, 0, 123000000 }, { 0, 0 } } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-date-time-local-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_date_time_local_1, - [](toml::table&& tbl) // spec-date-time-local-1 - { - const auto expected = toml::table{ - { R"(ldt1)"sv, toml::date_time{ { 1979, 5, 27 }, { 7, 32 } } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-dotted-keys-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_dotted_keys_1, - [](toml::table&& tbl) // spec-dotted-keys-1 - { - const auto expected = toml::table{ - { R"(name)"sv, R"(Orange)"sv }, - { R"(physical)"sv, - toml::table{ - { R"(color)"sv, R"(orange)"sv }, - { R"(shape)"sv, R"(round)"sv }, - } }, - { R"(site)"sv, - toml::table{ - { R"(google.com)"sv, true }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-dotted-keys-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_dotted_keys_2, - [](toml::table&& tbl) // spec-dotted-keys-2 - { - const auto expected = toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, 23 }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-dotted-keys-3") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_dotted_keys_3, - [](toml::table&& tbl) // spec-dotted-keys-3 - { - const auto expected = toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, 23 }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-empty-key-name-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_empty_key_name_1, - [](toml::table&& tbl) // spec-empty-key-name-1 - { - const auto expected = toml::table{ - { ""sv, R"(blank)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-empty-key-name-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_empty_key_name_2, - [](toml::table&& tbl) // spec-empty-key-name-2 - { - const auto expected = toml::table{ - { ""sv, R"(blank)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-extend-dotted-object-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_extend_dotted_object_1, - [](toml::table&& tbl) // spec-extend-dotted-object-1 - { - const auto expected = toml::table{ - { R"(fruit)"sv, - toml::table{ - { R"(apple)"sv, - toml::table{ - { R"(smooth)"sv, true }, - } }, - { R"(orange)"sv, 2 }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-extend-dotted-object-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_extend_dotted_object_2, - [](toml::table&& tbl) // spec-extend-dotted-object-2 - { - const auto expected = toml::table{ - { R"(apple)"sv, - toml::table{ - { R"(type)"sv, R"(fruit)"sv }, - { R"(skin)"sv, R"(thin)"sv }, - { R"(color)"sv, R"(red)"sv }, - } }, - { R"(orange)"sv, - toml::table{ - { R"(type)"sv, R"(fruit)"sv }, - { R"(skin)"sv, R"(thick)"sv }, - { R"(color)"sv, R"(orange)"sv }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-extend-dotted-object-3") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_extend_dotted_object_3, - [](toml::table&& tbl) // spec-extend-dotted-object-3 - { - const auto expected = toml::table{ - { R"(apple)"sv, - toml::table{ - { R"(type)"sv, R"(fruit)"sv }, - { R"(skin)"sv, R"(thin)"sv }, - { R"(color)"sv, R"(red)"sv }, - } }, - { R"(orange)"sv, - toml::table{ - { R"(type)"sv, R"(fruit)"sv }, - { R"(skin)"sv, R"(thick)"sv }, - { R"(color)"sv, R"(orange)"sv }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-float-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_float_1, - [](toml::table&& tbl) // spec-float-1 - { - const auto expected = toml::table{ - { R"(flt1)"sv, 1.0 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-float-10") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_float_10, - [](toml::table&& tbl) // spec-float-10 - { - const auto expected = toml::table{ - { R"(sf1)"sv, std::numeric_limits::infinity() }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-float-11") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_float_11, - [](toml::table&& tbl) // spec-float-11 - { - const auto expected = toml::table{ - { R"(sf2)"sv, std::numeric_limits::infinity() }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-float-12") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_float_12, - [](toml::table&& tbl) // spec-float-12 - { - const auto expected = toml::table{ - { R"(sf2)"sv, -std::numeric_limits::infinity() }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-float-13") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_float_13, - [](toml::table&& tbl) // spec-float-13 - { - const auto expected = toml::table{ - { R"(sf4)"sv, std::numeric_limits::quiet_NaN() }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-float-14") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_float_14, - [](toml::table&& tbl) // spec-float-14 - { - const auto expected = toml::table{ - { R"(sf5)"sv, std::numeric_limits::quiet_NaN() }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-float-15") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_float_15, - [](toml::table&& tbl) // spec-float-15 - { - const auto expected = toml::table{ - { R"(sf6)"sv, std::numeric_limits::quiet_NaN() }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-float-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_float_2, - [](toml::table&& tbl) // spec-float-2 - { - const auto expected = toml::table{ - { R"(flt2)"sv, 3.1415 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-float-3") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_float_3, - [](toml::table&& tbl) // spec-float-3 - { - const auto expected = toml::table{ - { R"(flt3)"sv, -0.01 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-float-4") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_float_4, - [](toml::table&& tbl) // spec-float-4 - { - const auto expected = toml::table{ - { R"(flt4)"sv, 5e+22 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-float-5") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_float_5, - [](toml::table&& tbl) // spec-float-5 - { - const auto expected = toml::table{ - { R"(flt5)"sv, 1000000.0 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-float-6") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_float_6, - [](toml::table&& tbl) // spec-float-6 - { - const auto expected = toml::table{ - { R"(flt6)"sv, -0.02 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-float-7") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_float_7, - [](toml::table&& tbl) // spec-float-7 - { - const auto expected = toml::table{ - { R"(flt7)"sv, 6.626e-34 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-float-8") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_float_8, - [](toml::table&& tbl) // spec-float-8 - { - const auto expected = toml::table{ - { R"(flt8)"sv, 224617.445991228 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-float-9") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_float_9, - [](toml::table&& tbl) // spec-float-9 - { - const auto expected = toml::table{ - { R"(flt9)"sv, -0.0 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-int-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_int_1, - [](toml::table&& tbl) // spec-int-1 - { - const auto expected = toml::table{ - { R"(int1)"sv, 99 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-int-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_int_2, - [](toml::table&& tbl) // spec-int-2 - { - const auto expected = toml::table{ - { R"(int2)"sv, 42 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-int-3") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_int_3, - [](toml::table&& tbl) // spec-int-3 - { - const auto expected = toml::table{ - { R"(int3)"sv, 0 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-int-3a") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_int_3a, - [](toml::table&& tbl) // spec-int-3a - { - const auto expected = toml::table{ - { R"(int3)"sv, 0 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-int-3b") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_int_3b, - [](toml::table&& tbl) // spec-int-3b - { - const auto expected = toml::table{ - { R"(int3)"sv, 0 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-int-4") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_int_4, - [](toml::table&& tbl) // spec-int-4 - { - const auto expected = toml::table{ - { R"(int4)"sv, -17 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-int-5") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_int_5, - [](toml::table&& tbl) // spec-int-5 - { - const auto expected = toml::table{ - { R"(int5)"sv, 1000 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-int-6") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_int_6, - [](toml::table&& tbl) // spec-int-6 - { - const auto expected = toml::table{ - { R"(int6)"sv, 5349221 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-int-7") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_int_7, - [](toml::table&& tbl) // spec-int-7 - { - const auto expected = toml::table{ - { R"(int7)"sv, 12345 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-int-bin1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_int_bin1, - [](toml::table&& tbl) // spec-int-bin1 - { - const auto expected = toml::table{ - { R"(bin1)"sv, 214 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-int-hex1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_int_hex1, - [](toml::table&& tbl) // spec-int-hex1 - { - const auto expected = toml::table{ - { R"(hex1)"sv, 3735928559 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-int-hex2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_int_hex2, - [](toml::table&& tbl) // spec-int-hex2 - { - const auto expected = toml::table{ - { R"(hex2)"sv, 3735928559 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-int-hex3") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_int_hex3, - [](toml::table&& tbl) // spec-int-hex3 - { - const auto expected = toml::table{ - { R"(hex3)"sv, 3735928559 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-int-max") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_int_max, - [](toml::table&& tbl) // spec-int-max - { - const auto expected = toml::table{ - { R"(max)"sv, std::numeric_limits::max() }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-int-min") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_int_min, - [](toml::table&& tbl) // spec-int-min - { - const auto expected = toml::table{ - { R"(min)"sv, std::numeric_limits::min() }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-int-oct1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_int_oct1, - [](toml::table&& tbl) // spec-int-oct1 - { - const auto expected = toml::table{ - { R"(oct1)"sv, 342391 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-int-oct2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_int_oct2, - [](toml::table&& tbl) // spec-int-oct2 - { - const auto expected = toml::table{ - { R"(oct2)"sv, 493 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-key-value-pair-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_key_value_pair_1, - [](toml::table&& tbl) // spec-key-value-pair-1 - { - const auto expected = toml::table{ - { R"(key)"sv, R"(value)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-key-value-pair-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_key_value_pair_2, - [](toml::table&& tbl) // spec-key-value-pair-2 - { - const auto expected = toml::table{ - { R"(bare_key)"sv, R"(value)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-key-value-pair-3") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_key_value_pair_3, - [](toml::table&& tbl) // spec-key-value-pair-3 - { - const auto expected = toml::table{ - { R"(bare-key)"sv, R"(value)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-key-value-pair-4") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_key_value_pair_4, - [](toml::table&& tbl) // spec-key-value-pair-4 - { - const auto expected = toml::table{ - { R"(1234)"sv, R"(value)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-key-value-pair-5") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_key_value_pair_5, - [](toml::table&& tbl) // spec-key-value-pair-5 - { - const auto expected = toml::table{ - { R"(1234)"sv, R"(value)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-key-value-pair-6") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_key_value_pair_6, - [](toml::table&& tbl) // spec-key-value-pair-6 - { - const auto expected = toml::table{ - { R"(-)"sv, 1 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-key-value-pair-7") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_key_value_pair_7, - [](toml::table&& tbl) // spec-key-value-pair-7 - { - const auto expected = toml::table{ - { R"(_)"sv, 1 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-key-value-pair-8") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_key_value_pair_8, - [](toml::table&& tbl) // spec-key-value-pair-8 - { - const auto expected = toml::table{ - { R"(-_-_-_-_-)"sv, 1 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-key-value-pair-9") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_key_value_pair_9, - [](toml::table&& tbl) // spec-key-value-pair-9 - { - const auto expected = toml::table{ - { R"(3)"sv, - toml::table{ - { R"(14159)"sv, R"(pi)"sv }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-newline-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_newline_1, - [](toml::table&& tbl) // spec-newline-1 - { - const auto expected = toml::table{ - { R"(abc)"sv, 123 }, - { R"(def)"sv, 456 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-newline-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_newline_2, - [](toml::table&& tbl) // spec-newline-2 - { - const auto expected = toml::table{ - { R"(abc)"sv, 123 }, - { R"(def)"sv, 456 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-newline-3") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_newline_3, - [](toml::table&& tbl) // spec-newline-3 - { - const auto expected = toml::table{ - { R"(abc)"sv, 123 }, - { R"(def)"sv, 456 }, - { R"(ghi)"sv, 789 }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-quoted-literal-keys-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_quoted_literal_keys_1, - [](toml::table&& tbl) // spec-quoted-literal-keys-1 - { - const auto expected = toml::table{ - { R"(quoted "value")"sv, R"(value)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-readme-example") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_readme_example, - [](toml::table&& tbl) // spec-readme-example - { - const auto expected = toml::table{ - { R"(title)"sv, R"(TOML Example)"sv }, - { R"(owner)"sv, - toml::table{ - { R"(name)"sv, R"(Tom Preston-Werner)"sv }, - { R"(dob)"sv, toml::date_time{ { 1979, 5, 27 }, { 7, 32 }, { -8, 0 } } }, - } }, - { R"(database)"sv, - toml::table{ - { R"(server)"sv, R"(192.168.1.1)"sv }, - { R"(ports)"sv, - toml::array{ - 8001, - 8001, - 8002, - } }, - { R"(connection_max)"sv, 5000 }, - { R"(enabled)"sv, true }, - } }, - { R"(servers)"sv, - toml::table{ - { R"(alpha)"sv, - toml::table{ - { R"(ip)"sv, R"(10.0.0.1)"sv }, - { R"(dc)"sv, R"(eqdc10)"sv }, - } }, - { R"(beta)"sv, - toml::table{ - { R"(ip)"sv, R"(10.0.0.2)"sv }, - { R"(dc)"sv, R"(eqdc10)"sv }, - } }, - } }, - { R"(clients)"sv, - toml::table{ - { R"(data)"sv, - toml::array{ - toml::array{ - R"(gamma)"sv, - R"(delta)"sv, - }, - toml::array{ - 1, - 2, - }, - } }, - { R"(hosts)"sv, - toml::array{ - R"(alpha)"sv, - R"(omega)"sv, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-basic-multiline-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_basic_multiline_1, - [](toml::table&& tbl) // spec-string-basic-multiline-1 - { - const auto expected = toml::table{ - { R"(str1)"sv, R"(Roses are red -Violets are blue)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-basic-multiline-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_basic_multiline_2, - [](toml::table&& tbl) // spec-string-basic-multiline-2 - { - const auto expected = toml::table{ - { R"(str)"sv, R"(The quick brown fox jumps over the lazy dog.)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-basic-multiline-3") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_basic_multiline_3, - [](toml::table&& tbl) // spec-string-basic-multiline-3 - { - const auto expected = toml::table{ - { R"(str)"sv, R"(The quick brown fox jumps over the lazy dog.)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-basic-multiline-4") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_basic_multiline_4, - [](toml::table&& tbl) // spec-string-basic-multiline-4 - { - const auto expected = toml::table{ - { R"(a)"sv, R"(abcdef)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-basic-multiline-5") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_basic_multiline_5, - [](toml::table&& tbl) // spec-string-basic-multiline-5 - { - const auto expected = toml::table{ - { R"(ml-escaped-nl)"sv, R"( foo bar \ - baz \quux)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-basic-multiline-6") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_basic_multiline_6, - [](toml::table&& tbl) // spec-string-basic-multiline-6 - { - const auto expected = toml::table{ - { R"(str4)"sv, R"(Here are two quotation marks: "". Simple enough.)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-basic-multiline-7") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_basic_multiline_7, - [](toml::table&& tbl) // spec-string-basic-multiline-7 - { - const auto expected = toml::table{ - { R"(str5)"sv, R"(Here are three quotation marks: """.)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-basic-multiline-8") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_basic_multiline_8, - [](toml::table&& tbl) // spec-string-basic-multiline-8 - { - const auto expected = toml::table{ - { R"(str6)"sv, R"(Here are fifteen quotation marks: """"""""""""""".)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-basic-multiline-9") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_basic_multiline_9, - [](toml::table&& tbl) // spec-string-basic-multiline-9 - { - const auto expected = toml::table{ - { R"(str7)"sv, R"("This," she said, "is just a pointless statement.")"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-basic-tab-multiline") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_basic_tab_multiline, - [](toml::table&& tbl) // spec-string-basic-tab-multiline - { - const auto expected = toml::table{ - { R"(str)"sv, R"(This is a tab)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-basic-tab") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_basic_tab, - [](toml::table&& tbl) // spec-string-basic-tab - { - const auto expected = toml::table{ - { R"(str)"sv, R"(This is a tab)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-escape-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_escape_1, - [](toml::table&& tbl) // spec-string-escape-1 - { - const auto expected = toml::table{ - { R"(a)"sv, "\x08"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-escape-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_escape_2, - [](toml::table&& tbl) // spec-string-escape-2 - { - const auto expected = toml::table{ - { R"(a)"sv, R"( )"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-escape-3") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_escape_3, - [](toml::table&& tbl) // spec-string-escape-3 - { - const auto expected = toml::table{ - { R"(a)"sv, R"( -)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-escape-4") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_escape_4, - [](toml::table&& tbl) // spec-string-escape-4 - { - const auto expected = toml::table{ - { R"(a)"sv, "\f"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-escape-5") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_escape_5, - [](toml::table&& tbl) // spec-string-escape-5 - { - const auto expected = toml::table{ - { R"(a)"sv, "\r"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-escape-6") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_escape_6, - [](toml::table&& tbl) // spec-string-escape-6 - { - const auto expected = toml::table{ - { R"(a)"sv, R"(")"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-escape-7") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_escape_7, - [](toml::table&& tbl) // spec-string-escape-7 - { - const auto expected = toml::table{ - { R"(a)"sv, R"(\)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-escape-8") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_escape_8, - [](toml::table&& tbl) // spec-string-escape-8 - { - const auto expected = toml::table{ - { R"(a)"sv, "\x00"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-escape-9") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_escape_9, - [](toml::table&& tbl) // spec-string-escape-9 - { - const auto expected = toml::table{ - { R"(a)"sv, "\x00"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-literal-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_literal_1, - [](toml::table&& tbl) // spec-string-literal-1 - { - const auto expected = toml::table{ - { R"(winpath)"sv, R"(C:\Users\nodejs\templates)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-literal-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_literal_2, - [](toml::table&& tbl) // spec-string-literal-2 - { - const auto expected = toml::table{ - { R"(winpath2)"sv, R"(\\ServerX\admin$\system32\)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-literal-3") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_literal_3, - [](toml::table&& tbl) // spec-string-literal-3 - { - const auto expected = toml::table{ - { R"(quoted)"sv, R"(Tom "Dubs" Preston-Werner)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-literal-4") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_literal_4, - [](toml::table&& tbl) // spec-string-literal-4 - { - const auto expected = toml::table{ - { R"(regex)"sv, R"(<\i\c*\s*>)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-literal-multiline-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_literal_multiline_1, - [](toml::table&& tbl) // spec-string-literal-multiline-1 - { - const auto expected = toml::table{ - { R"(regex2)"sv, R"(I [dw]on't need \d{2} apples)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-literal-multiline-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_literal_multiline_2, - [](toml::table&& tbl) // spec-string-literal-multiline-2 - { - const auto expected = toml::table{ - { R"(lines)"sv, R"(The first newline is -trimmed in raw strings. - All other whitespace - is preserved. -)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-literal-multiline-3") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_literal_multiline_3, - [](toml::table&& tbl) // spec-string-literal-multiline-3 - { - const auto expected = toml::table{ - { R"(quot15)"sv, R"(Here are fifteen quotation marks: """"""""""""""")"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-literal-multiline-4") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_literal_multiline_4, - [](toml::table&& tbl) // spec-string-literal-multiline-4 - { - const auto expected = toml::table{ - { R"(str)"sv, R"('That,' she said, 'is still pointless.')"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-table-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_table_1, - [](toml::table&& tbl) // spec-table-1 - { - const auto expected = toml::table{ - { R"(table-1)"sv, - toml::table{ - { R"(key1)"sv, R"(some string)"sv }, - { R"(key2)"sv, 123 }, - } }, - { R"(table-2)"sv, - toml::table{ - { R"(key1)"sv, R"(another string)"sv }, - { R"(key2)"sv, 456 }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-table-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_table_2, - [](toml::table&& tbl) // spec-table-2 - { - const auto expected = toml::table{ - { R"(dog)"sv, - toml::table{ - { R"(tater.man)"sv, - toml::table{ - { R"(type)"sv, - toml::table{ - { R"(name)"sv, R"(pug)"sv }, - } }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-table-3") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_table_3, - [](toml::table&& tbl) // spec-table-3 - { - const auto expected = toml::table{ - { R"(a)"sv, - toml::table{ - { R"(b)"sv, - toml::table{ - { R"(c)"sv, toml::table{} }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-table-4") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_table_4, - [](toml::table&& tbl) // spec-table-4 - { - const auto expected = toml::table{ - { R"(d)"sv, - toml::table{ - { R"(e)"sv, - toml::table{ - { R"(f)"sv, toml::table{} }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-table-5") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_table_5, - [](toml::table&& tbl) // spec-table-5 - { - const auto expected = toml::table{ - { R"(g)"sv, - toml::table{ - { R"(h)"sv, - toml::table{ - { R"(i)"sv, toml::table{} }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-table-7") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_table_7, - [](toml::table&& tbl) // spec-table-7 - { - const auto expected = toml::table{ - { R"(x)"sv, - toml::table{ - { R"(y)"sv, - toml::table{ - { R"(z)"sv, - toml::table{ - { R"(w)"sv, toml::table{} }, - } }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-table-8") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_table_8, - [](toml::table&& tbl) // spec-table-8 - { - const auto expected = toml::table{ - { R"(fruit)"sv, - toml::table{ - { R"(apple)"sv, - toml::table{ - { R"(color)"sv, R"(red)"sv }, - { R"(taste)"sv, - toml::table{ - { R"(sweet)"sv, true }, - } }, - { R"(texture)"sv, - toml::table{ - { R"(smooth)"sv, true }, - } }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-table-inline-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_table_inline_1, - [](toml::table&& tbl) // spec-table-inline-1 - { - const auto expected = toml::table{ - { R"(name)"sv, - toml::table{ - { R"(first)"sv, R"(Tom)"sv }, - { R"(last)"sv, R"(Preston-Werner)"sv }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-table-inline-2") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_table_inline_2, - [](toml::table&& tbl) // spec-table-inline-2 - { - const auto expected = toml::table{ - { R"(point)"sv, - toml::table{ - { R"(x)"sv, 1 }, - { R"(y)"sv, 2 }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-table-inline-3") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_table_inline_3, - [](toml::table&& tbl) // spec-table-inline-3 - { - const auto expected = toml::table{ - { R"(animal)"sv, - toml::table{ - { R"(type)"sv, - toml::table{ - { R"(name)"sv, R"(pug)"sv }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-table") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_table, - [](toml::table&& tbl) // spec-table - { - const auto expected = toml::table{ - { R"(table)"sv, toml::table{} }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-time-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_time_1, - [](toml::table&& tbl) // spec-time-1 - { - const auto expected = toml::table{ - { R"(lt1)"sv, toml::time{ 7, 32 } }, - }; - REQUIRE(tbl == expected); - }); - } - -#if UNICODE_LITERALS_OK - - SECTION("spec-quoted-basic-keys-1") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_quoted_basic_keys_1, - [](toml::table&& tbl) // spec-quoted-basic-keys-1 - { - const auto expected = toml::table{ - { R"(ʎǝʞ)"sv, R"(value)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-string-basic") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_string_basic, - [](toml::table&& tbl) // spec-string-basic - { - const auto expected = toml::table{ - { R"(str)"sv, R"(I'm a string. "You can quote me". Name José -Location SF.)"sv }, - }; - REQUIRE(tbl == expected); - }); - } - - SECTION("spec-table-6") - { - parsing_should_succeed(FILE_LINE_ARGS, - spec_table_6, - [](toml::table&& tbl) // spec-table-6 - { - const auto expected = toml::table{ - { R"(j)"sv, - toml::table{ - { R"(ʞ)"sv, - toml::table{ - { R"(l)"sv, toml::table{} }, - } }, - } }, - }; - REQUIRE(tbl == expected); - }); - } - -#endif // UNICODE_LITERALS_OK -} diff --git a/tests/cpp.hint b/tests/cpp.hint deleted file mode 100644 index 9bb942a..0000000 --- a/tests/cpp.hint +++ /dev/null @@ -1 +0,0 @@ -#define TEST_CASE(...) void func() diff --git a/tests/for_each.cpp b/tests/for_each.cpp deleted file mode 100644 index 6d28581..0000000 --- a/tests/for_each.cpp +++ /dev/null @@ -1,380 +0,0 @@ -// This file is a part of toml++ and is subject to the the terms of the MIT license. -// Copyright (c) Mark Gillard -// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text. -// SPDX-License-Identifier: MIT - -#include "tests.hpp" -TOML_DISABLE_SPAM_WARNINGS; - -TEST_CASE("array::for_each") -{ - toml::array arr{ 0, 1, 2, 3.0, "four", "five", 6 }; - - // check lvalue propagates correctly - static_cast(arr).for_each( - [](auto&& elem, size_t) noexcept - { - using elem_ref_type = decltype(elem); - static_assert(std::is_lvalue_reference_v); - - using elem_type = std::remove_reference_t; - static_assert(!std::is_const_v); - static_assert(!std::is_volatile_v); - }); - static_cast(arr).for_each( - [](size_t, auto&& elem) noexcept - { - using elem_ref_type = decltype(elem); - static_assert(std::is_lvalue_reference_v); - - using elem_type = std::remove_reference_t; - static_assert(!std::is_const_v); - static_assert(!std::is_volatile_v); - }); - static_cast(arr).for_each( - [](auto&& elem) noexcept - { - using elem_ref_type = decltype(elem); - static_assert(std::is_lvalue_reference_v); - - using elem_type = std::remove_reference_t; - static_assert(!std::is_const_v); - static_assert(!std::is_volatile_v); - }); - - // check rvalue propagates correctly - static_cast(arr).for_each( - [](auto&& elem, size_t) noexcept - { - using elem_ref_type = decltype(elem); - static_assert(std::is_rvalue_reference_v); - - using elem_type = std::remove_reference_t; - static_assert(!std::is_const_v); - static_assert(!std::is_volatile_v); - }); - static_cast(arr).for_each( - [](size_t, auto&& elem) noexcept - { - using elem_ref_type = decltype(elem); - static_assert(std::is_rvalue_reference_v); - - using elem_type = std::remove_reference_t; - static_assert(!std::is_const_v); - static_assert(!std::is_volatile_v); - }); - static_cast(arr).for_each( - [](auto&& elem) noexcept - { - using elem_ref_type = decltype(elem); - static_assert(std::is_rvalue_reference_v); - - using elem_type = std::remove_reference_t; - static_assert(!std::is_const_v); - static_assert(!std::is_volatile_v); - }); - - // check const lvalue propagates correctly - static_cast(arr).for_each( - [](auto&& elem, size_t) noexcept - { - using elem_ref_type = decltype(elem); - static_assert(std::is_lvalue_reference_v); - - using elem_type = std::remove_reference_t; - static_assert(std::is_const_v); - static_assert(!std::is_volatile_v); - }); - static_cast(arr).for_each( - [](size_t, auto&& elem) noexcept - { - using elem_ref_type = decltype(elem); - static_assert(std::is_lvalue_reference_v); - - using elem_type = std::remove_reference_t; - static_assert(std::is_const_v); - static_assert(!std::is_volatile_v); - }); - static_cast(arr).for_each( - [](auto&& elem) noexcept - { - using elem_ref_type = decltype(elem); - static_assert(std::is_lvalue_reference_v); - - using elem_type = std::remove_reference_t; - static_assert(std::is_const_v); - static_assert(!std::is_volatile_v); - }); - - // check const rvalue propagates correctly - static_cast(arr).for_each( - [](auto&& elem, size_t) noexcept - { - using elem_ref_type = decltype(elem); - static_assert(std::is_rvalue_reference_v); - - using elem_type = std::remove_reference_t; - static_assert(std::is_const_v); - static_assert(!std::is_volatile_v); - }); - static_cast(arr).for_each( - [](size_t, auto&& elem) noexcept - { - using elem_ref_type = decltype(elem); - static_assert(std::is_rvalue_reference_v); - - using elem_type = std::remove_reference_t; - static_assert(std::is_const_v); - static_assert(!std::is_volatile_v); - }); - static_cast(arr).for_each( - [](auto&& elem) noexcept - { - using elem_ref_type = decltype(elem); - static_assert(std::is_rvalue_reference_v); - - using elem_type = std::remove_reference_t; - static_assert(std::is_const_v); - static_assert(!std::is_volatile_v); - }); - - // check noexcept - func(elem, i) - { - static constexpr auto throwing_visitor = [](auto&&, size_t) noexcept(false) {}; - static constexpr auto non_throwing_visitor = [](auto&&, size_t) noexcept(true) {}; - static_assert(!noexcept(static_cast(arr).for_each(throwing_visitor))); - static_assert(!noexcept(static_cast(arr).for_each(throwing_visitor))); - static_assert(!noexcept(static_cast(arr).for_each(throwing_visitor))); - static_assert(!noexcept(static_cast(arr).for_each(throwing_visitor))); - static_assert(noexcept(static_cast(arr).for_each(non_throwing_visitor))); - static_assert(noexcept(static_cast(arr).for_each(non_throwing_visitor))); - static_assert(noexcept(static_cast(arr).for_each(non_throwing_visitor))); - static_assert(noexcept(static_cast(arr).for_each(non_throwing_visitor))); - } - - // check noexcept - func(i, elem) - { - static constexpr auto throwing_visitor = [](size_t, auto&&) noexcept(false) {}; - static constexpr auto non_throwing_visitor = [](size_t, auto&&) noexcept(true) {}; - static_assert(!noexcept(static_cast(arr).for_each(throwing_visitor))); - static_assert(!noexcept(static_cast(arr).for_each(throwing_visitor))); - static_assert(!noexcept(static_cast(arr).for_each(throwing_visitor))); - static_assert(!noexcept(static_cast(arr).for_each(throwing_visitor))); - static_assert(noexcept(static_cast(arr).for_each(non_throwing_visitor))); - static_assert(noexcept(static_cast(arr).for_each(non_throwing_visitor))); - static_assert(noexcept(static_cast(arr).for_each(non_throwing_visitor))); - static_assert(noexcept(static_cast(arr).for_each(non_throwing_visitor))); - } - - // check noexcept - func(elem) - { - static constexpr auto throwing_visitor = [](auto&&) noexcept(false) {}; - static constexpr auto non_throwing_visitor = [](auto&&) noexcept(true) {}; - static_assert(!noexcept(static_cast(arr).for_each(throwing_visitor))); - static_assert(!noexcept(static_cast(arr).for_each(throwing_visitor))); - static_assert(!noexcept(static_cast(arr).for_each(throwing_visitor))); - static_assert(!noexcept(static_cast(arr).for_each(throwing_visitor))); - static_assert(noexcept(static_cast(arr).for_each(non_throwing_visitor))); - static_assert(noexcept(static_cast(arr).for_each(non_throwing_visitor))); - static_assert(noexcept(static_cast(arr).for_each(non_throwing_visitor))); - static_assert(noexcept(static_cast(arr).for_each(non_throwing_visitor))); - } - - // check that the iteration actually does what it says on the box - { - toml::array arr2; - arr.for_each([&](const auto& val) { arr2.push_back(val); }); - CHECK(arr == arr2); - } - - // check that visitation works for a specific type - { - toml::array arr2; - arr.for_each([&](const toml::value& val) { arr2.push_back(val); }); - CHECK(arr2 == toml::array{ 0, 1, 2, 6 }); - } - -#if !TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN - - // check that early-stopping works - { - toml::array arr2; - arr.for_each( - [&](const auto& val) - { - if constexpr (!toml::is_number) - return false; - else - { - arr2.push_back(val); - return true; - } - }); - CHECK(arr2 == toml::array{ 0, 1, 2, 3.0 }); - } - -#endif -} - -TEST_CASE("table::for_each") -{ - table tbl{ { "zero", 0 }, // - { "one", 1 }, // - { "two", 2 }, // - { "three", 3.0 }, // - { "four", "four" }, // - { "five", "five" }, // - { "six", 6 } }; - - // check lvalue propagates correctly - static_cast(tbl).for_each( - [](const toml::key&, auto&& elem) noexcept - { - using elem_ref_type = decltype(elem); - static_assert(std::is_lvalue_reference_v); - - using elem_type = std::remove_reference_t; - static_assert(!std::is_const_v); - static_assert(!std::is_volatile_v); - }); - static_cast(tbl).for_each( - [](auto&& elem) noexcept - { - using elem_ref_type = decltype(elem); - static_assert(std::is_lvalue_reference_v); - - using elem_type = std::remove_reference_t; - static_assert(!std::is_const_v); - static_assert(!std::is_volatile_v); - }); - - // check rvalue propagates correctly - static_cast(tbl).for_each( - [](const toml::key&, auto&& elem) noexcept - { - using elem_ref_type = decltype(elem); - static_assert(std::is_rvalue_reference_v); - - using elem_type = std::remove_reference_t; - static_assert(!std::is_const_v); - static_assert(!std::is_volatile_v); - }); - static_cast(tbl).for_each( - [](auto&& elem) noexcept - { - using elem_ref_type = decltype(elem); - static_assert(std::is_rvalue_reference_v); - - using elem_type = std::remove_reference_t; - static_assert(!std::is_const_v); - static_assert(!std::is_volatile_v); - }); - - // check const lvalue propagates correctly - static_cast(tbl).for_each( - [](const toml::key&, auto&& elem) noexcept - { - using elem_ref_type = decltype(elem); - static_assert(std::is_lvalue_reference_v); - - using elem_type = std::remove_reference_t; - static_assert(std::is_const_v); - static_assert(!std::is_volatile_v); - }); - static_cast(tbl).for_each( - [](auto&& elem) noexcept - { - using elem_ref_type = decltype(elem); - static_assert(std::is_lvalue_reference_v); - - using elem_type = std::remove_reference_t; - static_assert(std::is_const_v); - static_assert(!std::is_volatile_v); - }); - - // check const rvalue propagates correctly - static_cast(tbl).for_each( - [](const toml::key&, auto&& elem) noexcept - { - using elem_ref_type = decltype(elem); - static_assert(std::is_rvalue_reference_v); - - using elem_type = std::remove_reference_t; - static_assert(std::is_const_v); - static_assert(!std::is_volatile_v); - }); - static_cast(tbl).for_each( - [](auto&& elem) noexcept - { - using elem_ref_type = decltype(elem); - static_assert(std::is_rvalue_reference_v); - - using elem_type = std::remove_reference_t; - static_assert(std::is_const_v); - static_assert(!std::is_volatile_v); - }); - - // check noexcept - func(key, value) - { - static constexpr auto throwing_visitor = [](const toml::key&, auto&&) noexcept(false) {}; - static constexpr auto non_throwing_visitor = [](const toml::key&, auto&&) noexcept(true) {}; - static_assert(!noexcept(static_cast(tbl).for_each(throwing_visitor))); - static_assert(!noexcept(static_cast(tbl).for_each(throwing_visitor))); - static_assert(!noexcept(static_cast(tbl).for_each(throwing_visitor))); - static_assert(!noexcept(static_cast(tbl).for_each(throwing_visitor))); - static_assert(noexcept(static_cast(tbl).for_each(non_throwing_visitor))); - static_assert(noexcept(static_cast(tbl).for_each(non_throwing_visitor))); - static_assert(noexcept(static_cast(tbl).for_each(non_throwing_visitor))); - static_assert(noexcept(static_cast(tbl).for_each(non_throwing_visitor))); - } - - // check noexcept - func(value) - { - static constexpr auto throwing_visitor = [](auto&&) noexcept(false) {}; - static constexpr auto non_throwing_visitor = [](auto&&) noexcept(true) {}; - static_assert(!noexcept(static_cast(tbl).for_each(throwing_visitor))); - static_assert(!noexcept(static_cast(tbl).for_each(throwing_visitor))); - static_assert(!noexcept(static_cast(tbl).for_each(throwing_visitor))); - static_assert(!noexcept(static_cast(tbl).for_each(throwing_visitor))); - static_assert(noexcept(static_cast(tbl).for_each(non_throwing_visitor))); - static_assert(noexcept(static_cast(tbl).for_each(non_throwing_visitor))); - static_assert(noexcept(static_cast(tbl).for_each(non_throwing_visitor))); - static_assert(noexcept(static_cast(tbl).for_each(non_throwing_visitor))); - } - - // check that the iteration actually does what it says on the box - { - toml::table tbl2; - tbl.for_each([&](auto&& key, auto&& val) { tbl2.insert_or_assign(key, val); }); - CHECK(tbl == tbl2); - } - - // check that visitation works for a specific type - { - toml::table tbl2; - tbl.for_each([&](auto&& key, const toml::value& val) { tbl2.insert_or_assign(key, val); }); - CHECK(tbl2 - == table{ { "zero", 0 }, // - { "one", 1 }, // - { "two", 2 }, // - { "six", 6 } }); - } - -#if !TOML_RETURN_BOOL_FROM_FOR_EACH_BROKEN - - // check that early-stopping works - { - toml::table tbl2; - size_t added{}; - tbl.for_each( - [&](auto&& key, const auto& val) - { - tbl2.insert_or_assign(key, val); - added++; - return added < 3u; - }); - CHECK(tbl2.size() == 3u); - } - -#endif -} diff --git a/tests/formatters.cpp b/tests/formatters.cpp deleted file mode 100644 index a0cd35f..0000000 --- a/tests/formatters.cpp +++ /dev/null @@ -1,332 +0,0 @@ -// This file is a part of toml++ and is subject to the the terms of the MIT license. -// Copyright (c) Mark Gillard -// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text. -// SPDX-License-Identifier: MIT - -#include "tests.hpp" - -namespace -{ - template - static auto format_to_string(const T& obj, - format_flags flags = Formatter::default_flags, - format_flags exclude_flags = format_flags::none) - { - std::stringstream ss; - ss << "*****\n" << Formatter{ obj, flags & ~(exclude_flags) } << "\n*****"; - return ss.str(); - } - - struct char32_printer - { - char32_t value; - - friend std::ostream& operator<<(std::ostream& os, const char32_printer& p) - { - if (p.value <= U'\x1F') - return os << '\'' << impl::control_char_escapes[static_cast(p.value)] << '\''; - else if (p.value == U'\x7F') - return os << "'\\u007F'"sv; - else if (p.value < 127u) - return os << '\'' << static_cast(static_cast(p.value)) << '\''; - else - return os << static_cast(p.value); - } - }; - - struct string_difference - { - source_position position; - size_t index; - char32_t a, b; - - friend std::ostream& operator<<(std::ostream& os, const string_difference& diff) - { - if (diff.a && diff.b && diff.a != diff.b) - os << char32_printer{ diff.a } << " vs "sv << char32_printer{ diff.b } << " at "sv; - return os << diff.position << ", index "sv << diff.index; - } - }; - - static optional find_first_difference(std::string_view str_a, std::string_view str_b) noexcept - { - string_difference diff{ { 1u, 1u } }; - impl::utf8_decoder a, b; - - for (size_t i = 0, e = std::min(str_a.length(), str_b.length()); i < e; i++, diff.index++) - { - a(static_cast(str_a[i])); - b(static_cast(str_b[i])); - if (a.has_code_point() != b.has_code_point() || a.error() != b.error()) - return diff; - - if (a.error()) - { - a.reset(); - b.reset(); - continue; - } - - if (!a.has_code_point()) - continue; - - if (a.codepoint != b.codepoint) - { - diff.a = a.codepoint; - diff.b = b.codepoint; - return diff; - } - - if (a.codepoint == U'\n') - { - diff.position.line++; - diff.position.column = 1u; - } - else - diff.position.column++; - } - if (str_a.length() != str_b.length()) - return diff; - return {}; - } -} - -#define CHECK_FORMATTER(formatter, data, expected) \ - do \ - { \ - const auto str = format_to_string(data); \ - const auto diff = find_first_difference(str, expected); \ - if (diff) \ - FORCE_FAIL("string mismatch: "sv << *diff); \ - } \ - while (false) - -TEST_CASE("formatters") -{ - const auto data_date = toml::date{ 2021, 11, 2 }; - const auto data_time = toml::time{ 20, 33, 0 }; - const auto data = toml::table{ - { "integers"sv, - toml::table{ { "zero"sv, 0 }, - { "one"sv, 1 }, - { "dec"sv, 10 }, - { "bin"sv, 10, toml::value_flags::format_as_binary }, - { "oct"sv, 10, toml::value_flags::format_as_octal }, - { "hex"sv, 10, toml::value_flags::format_as_hexadecimal } } }, - { "floats"sv, - toml::table{ { "pos_zero"sv, +0.0 }, - { "neg_zero"sv, -0.0 }, - { "one"sv, 1.0 }, - { "pos_inf"sv, +std::numeric_limits::infinity() }, - { "neg_inf"sv, -std::numeric_limits::infinity() }, - { "pos_nan"sv, +std::numeric_limits::quiet_NaN() }, - { "neg_nan"sv, -std::numeric_limits::quiet_NaN() } - - } }, - - { "dates and times"sv, - toml::table{ - - { "dates"sv, toml::table{ { "val"sv, data_date } } }, - - { "times"sv, toml::table{ { "val"sv, data_time } } }, - - { "date-times"sv, - toml::table{ - - { "local"sv, toml::table{ { "val"sv, toml::date_time{ data_date, data_time } } } }, - { "offset"sv, - toml::table{ - { "val"sv, toml::date_time{ data_date, data_time, toml::time_offset{} } } } } } } } }, - - { "bools"sv, - toml::table{ { "true"sv, true }, // - { "false"sv, false } } }, - - { - "strings"sv, - toml::array{ R"()"sv, - R"(string)"sv, - R"(string with a single quote in it: ')"sv, - R"(string with a double quote in it: ")"sv, - "string with a tab: \t"sv, - R"(a long string to force the array over multiple lines)"sv }, - }, - - { "a"sv, - toml::table{ { "val", true }, - { "b"sv, toml::table{ { "val", true }, { "c"sv, toml::table{ { "val", true } } } } } } } - - }; - - SECTION("toml_formatter") - { - static constexpr auto expected = R"(***** -strings = [ - '', - 'string', - "string with a single quote in it: '", - 'string with a double quote in it: "', - 'string with a tab: ', - 'a long string to force the array over multiple lines' -] - -[a] -val = true - - [a.b] - val = true - - [a.b.c] - val = true - -[bools] -false = false -true = true - -['dates and times'.date-times.local] -val = 2021-11-02T20:33:00 - -['dates and times'.date-times.offset] -val = 2021-11-02T20:33:00Z - -['dates and times'.dates] -val = 2021-11-02 - -['dates and times'.times] -val = 20:33:00 - -[floats] -neg_inf = -inf -neg_nan = nan -neg_zero = -0.0 -one = 1.0 -pos_inf = inf -pos_nan = nan -pos_zero = 0.0 - -[integers] -bin = 0b1010 -dec = 10 -hex = 0xA -oct = 0o12 -one = 1 -zero = 0 -*****)"sv; - - CHECK_FORMATTER(toml_formatter, data, expected); - } - - SECTION("json_formatter") - { - static constexpr auto expected = R"(***** -{ - "a" : { - "b" : { - "c" : { - "val" : true - }, - "val" : true - }, - "val" : true - }, - "bools" : { - "false" : false, - "true" : true - }, - "dates and times" : { - "date-times" : { - "local" : { - "val" : "2021-11-02T20:33:00" - }, - "offset" : { - "val" : "2021-11-02T20:33:00Z" - } - }, - "dates" : { - "val" : "2021-11-02" - }, - "times" : { - "val" : "20:33:00" - } - }, - "floats" : { - "neg_inf" : "-Infinity", - "neg_nan" : "NaN", - "neg_zero" : -0.0, - "one" : 1.0, - "pos_inf" : "Infinity", - "pos_nan" : "NaN", - "pos_zero" : 0.0 - }, - "integers" : { - "bin" : 10, - "dec" : 10, - "hex" : 10, - "oct" : 10, - "one" : 1, - "zero" : 0 - }, - "strings" : [ - "", - "string", - "string with a single quote in it: '", - "string with a double quote in it: \"", - "string with a tab: \t", - "a long string to force the array over multiple lines" - ] -} -*****)"sv; - - CHECK_FORMATTER(json_formatter, data, expected); - } - - SECTION("yaml_formatter") - { - static constexpr auto expected = R"(***** -a: - b: - c: - val: true - val: true - val: true -bools: - false: false - true: true -'dates and times': - date-times: - local: - val: '2021-11-02T20:33:00' - offset: - val: '2021-11-02T20:33:00Z' - dates: - val: '2021-11-02' - times: - val: '20:33:00' -floats: - neg_inf: -.inf - neg_nan: .NAN - neg_zero: -0.0 - one: 1.0 - pos_inf: .inf - pos_nan: .NAN - pos_zero: 0.0 -integers: - bin: 10 - dec: 10 - hex: 0xA - oct: 0o12 - one: 1 - zero: 0 -strings: - - '' - - string - - "string with a single quote in it: '" - - 'string with a double quote in it: "' - - "string with a tab: \t" - - 'a long string to force the array over multiple lines' -*****)"sv; - - CHECK_FORMATTER(yaml_formatter, data, expected); - } -} diff --git a/tests/impl_toml.cpp b/tests/impl_toml.cpp deleted file mode 100644 index bdf23a3..0000000 --- a/tests/impl_toml.cpp +++ /dev/null @@ -1,407 +0,0 @@ -// This file is a part of toml++ and is subject to the the terms of the MIT license. -// Copyright (c) Mark Gillard -// See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text. -// SPDX-License-Identifier: MIT - -#include "settings.hpp" -#if !TOML_HEADER_ONLY && !TOML_SHARED_LIB -#define TOML_IMPLEMENTATION -#endif - -#if USE_SINGLE_HEADER -#include "../toml.hpp" -#else -#include "../include/toml++/toml.hpp" -#endif - -namespace toml -{ - using std::declval; - using std::is_same_v; - -#define CHECK_NODE_TYPE_MAPPING(T, expected) \ - static_assert(impl::node_type_of == expected); \ - static_assert(impl::node_type_of == expected); \ - static_assert(impl::node_type_of == expected); \ - static_assert(impl::node_type_of == expected); \ - static_assert(impl::node_type_of == expected); \ - static_assert(impl::node_type_of == expected); \ - static_assert(impl::node_type_of == expected); \ - static_assert(impl::node_type_of == expected); \ - static_assert(impl::node_type_of == expected); \ - static_assert(impl::node_type_of == expected); \ - static_assert(impl::node_type_of == expected); \ - static_assert(impl::node_type_of == expected) - - CHECK_NODE_TYPE_MAPPING(int64_t, node_type::integer); - CHECK_NODE_TYPE_MAPPING(double, node_type::floating_point); - CHECK_NODE_TYPE_MAPPING(std::string, node_type::string); - CHECK_NODE_TYPE_MAPPING(bool, node_type::boolean); - CHECK_NODE_TYPE_MAPPING(toml::date, node_type::date); - CHECK_NODE_TYPE_MAPPING(toml::time, node_type::time); - CHECK_NODE_TYPE_MAPPING(toml::date_time, node_type::date_time); - CHECK_NODE_TYPE_MAPPING(toml::array, node_type::array); - CHECK_NODE_TYPE_MAPPING(toml::table, node_type::table); - -#define CHECK_CAN_REPRESENT_NATIVE(T, expected) \ - static_assert((impl::value_traits::is_native || impl::value_traits::can_represent_native) == expected) - - CHECK_CAN_REPRESENT_NATIVE(time, true); - CHECK_CAN_REPRESENT_NATIVE(date, true); - CHECK_CAN_REPRESENT_NATIVE(date_time, true); - CHECK_CAN_REPRESENT_NATIVE(bool, true); - CHECK_CAN_REPRESENT_NATIVE(int8_t, false); - CHECK_CAN_REPRESENT_NATIVE(int16_t, false); - CHECK_CAN_REPRESENT_NATIVE(int32_t, false); - CHECK_CAN_REPRESENT_NATIVE(int64_t, true); - CHECK_CAN_REPRESENT_NATIVE(uint8_t, false); - CHECK_CAN_REPRESENT_NATIVE(uint16_t, false); - CHECK_CAN_REPRESENT_NATIVE(uint32_t, false); - CHECK_CAN_REPRESENT_NATIVE(uint64_t, false); - CHECK_CAN_REPRESENT_NATIVE(float, false); - CHECK_CAN_REPRESENT_NATIVE(double, true); -#ifdef TOML_INT128 - CHECK_CAN_REPRESENT_NATIVE(TOML_INT128, true); - CHECK_CAN_REPRESENT_NATIVE(TOML_UINT128, false); -#endif -#if TOML_ENABLE_FLOAT16 - CHECK_CAN_REPRESENT_NATIVE(_Float16, false); -#endif -#ifdef TOML_FLOAT128 - CHECK_CAN_REPRESENT_NATIVE(TOML_FLOAT128, true); -#endif - - CHECK_CAN_REPRESENT_NATIVE(char*, false); - CHECK_CAN_REPRESENT_NATIVE(char* const, false); - CHECK_CAN_REPRESENT_NATIVE(char[2], false); - CHECK_CAN_REPRESENT_NATIVE(const char[2], false); - CHECK_CAN_REPRESENT_NATIVE(char (&)[2], false); - CHECK_CAN_REPRESENT_NATIVE(const char (&)[2], false); - CHECK_CAN_REPRESENT_NATIVE(char (&&)[2], false); - CHECK_CAN_REPRESENT_NATIVE(const char (&&)[2], false); - CHECK_CAN_REPRESENT_NATIVE(const char*, true); - CHECK_CAN_REPRESENT_NATIVE(const char* const, true); - CHECK_CAN_REPRESENT_NATIVE(std::string, true); - CHECK_CAN_REPRESENT_NATIVE(std::string_view, true); -#if TOML_HAS_CHAR8 - CHECK_CAN_REPRESENT_NATIVE(char8_t*, false); - CHECK_CAN_REPRESENT_NATIVE(char8_t* const, false); - CHECK_CAN_REPRESENT_NATIVE(char8_t[2], false); - CHECK_CAN_REPRESENT_NATIVE(const char8_t[2], false); - CHECK_CAN_REPRESENT_NATIVE(char8_t (&)[2], false); - CHECK_CAN_REPRESENT_NATIVE(const char8_t (&)[2], false); - CHECK_CAN_REPRESENT_NATIVE(char (&&)[2], false); - CHECK_CAN_REPRESENT_NATIVE(const char8_t (&&)[2], false); - CHECK_CAN_REPRESENT_NATIVE(const char8_t*, true); - CHECK_CAN_REPRESENT_NATIVE(const char8_t* const, true); - CHECK_CAN_REPRESENT_NATIVE(std::u8string, true); - CHECK_CAN_REPRESENT_NATIVE(std::u8string_view, true); -#endif - CHECK_CAN_REPRESENT_NATIVE(wchar_t*, false); - CHECK_CAN_REPRESENT_NATIVE(wchar_t* const, false); - CHECK_CAN_REPRESENT_NATIVE(wchar_t[2], false); - CHECK_CAN_REPRESENT_NATIVE(const wchar_t[2], false); - CHECK_CAN_REPRESENT_NATIVE(wchar_t (&)[2], false); - CHECK_CAN_REPRESENT_NATIVE(const wchar_t (&)[2], false); - CHECK_CAN_REPRESENT_NATIVE(wchar_t (&&)[2], false); - CHECK_CAN_REPRESENT_NATIVE(const wchar_t (&&)[2], false); - CHECK_CAN_REPRESENT_NATIVE(const wchar_t*, false); - CHECK_CAN_REPRESENT_NATIVE(const wchar_t* const, false); - CHECK_CAN_REPRESENT_NATIVE(std::wstring, !!TOML_ENABLE_WINDOWS_COMPAT); - CHECK_CAN_REPRESENT_NATIVE(std::wstring_view, false); - -#define CHECK_VALUE_EXACT(T, expected) \ - static_assert(is_same_v().value_exact()), optional>); \ - static_assert(is_same_v>().value_exact()), optional>); \ - static_assert(is_same_v>().value_exact()), optional>) - -#define CHECK_VALUE_OR(T, expected) \ - static_assert(is_same_v().value_or(declval())), expected>); \ - static_assert(is_same_v>().value_or(declval())), expected>); \ - static_assert(is_same_v>().value_or(declval())), expected>) - - CHECK_VALUE_EXACT(time, time); - CHECK_VALUE_EXACT(date, date); - CHECK_VALUE_EXACT(date_time, date_time); - CHECK_VALUE_EXACT(bool, bool); - CHECK_VALUE_EXACT(double, double); - CHECK_VALUE_EXACT(int64_t, int64_t); - CHECK_VALUE_EXACT(const char*, const char*); - CHECK_VALUE_EXACT(std::string_view, std::string_view); - CHECK_VALUE_EXACT(std::string, std::string); -#if TOML_HAS_CHAR8 - CHECK_VALUE_EXACT(const char8_t*, const char8_t*); - CHECK_VALUE_EXACT(std::u8string_view, std::u8string_view); - CHECK_VALUE_EXACT(std::u8string, std::u8string); -#endif - - CHECK_VALUE_OR(time, time); - CHECK_VALUE_OR(time&, time); - CHECK_VALUE_OR(time&&, time); - CHECK_VALUE_OR(time const, time); - CHECK_VALUE_OR(date, date); - CHECK_VALUE_OR(date&, date); - CHECK_VALUE_OR(date&&, date); - CHECK_VALUE_OR(date const, date); - CHECK_VALUE_OR(date_time, date_time); - CHECK_VALUE_OR(date_time&, date_time); - CHECK_VALUE_OR(date_time&&, date_time); - CHECK_VALUE_OR(date_time const, date_time); - CHECK_VALUE_OR(bool, bool); - CHECK_VALUE_OR(bool&, bool); - CHECK_VALUE_OR(bool&&, bool); - CHECK_VALUE_OR(bool const, bool); - CHECK_VALUE_OR(int32_t, int32_t); - CHECK_VALUE_OR(int32_t&, int32_t); - CHECK_VALUE_OR(int32_t&&, int32_t); - CHECK_VALUE_OR(int32_t const, int32_t); - CHECK_VALUE_OR(int64_t, int64_t); - CHECK_VALUE_OR(int64_t&, int64_t); - CHECK_VALUE_OR(int64_t&&, int64_t); - CHECK_VALUE_OR(int64_t const, int64_t); -#ifdef TOML_INT128 - CHECK_VALUE_OR(TOML_INT128, TOML_INT128); - CHECK_VALUE_OR(TOML_INT128&, TOML_INT128); - CHECK_VALUE_OR(TOML_INT128&&, TOML_INT128); - CHECK_VALUE_OR(TOML_INT128 const, TOML_INT128); - CHECK_VALUE_OR(TOML_UINT128, TOML_UINT128); - CHECK_VALUE_OR(TOML_UINT128&, TOML_UINT128); - CHECK_VALUE_OR(TOML_UINT128&&, TOML_UINT128); - CHECK_VALUE_OR(TOML_UINT128 const, TOML_UINT128); -#endif - CHECK_VALUE_OR(float, float); - CHECK_VALUE_OR(float&, float); - CHECK_VALUE_OR(float&&, float); - CHECK_VALUE_OR(float const, float); - CHECK_VALUE_OR(double, double); - CHECK_VALUE_OR(double&, double); - CHECK_VALUE_OR(double&&, double); - CHECK_VALUE_OR(double const, double); -#ifdef TOML_FLOAT128 - CHECK_VALUE_OR(TOML_FLOAT128, TOML_FLOAT128); - CHECK_VALUE_OR(TOML_FLOAT128&, TOML_FLOAT128); - CHECK_VALUE_OR(TOML_FLOAT128&&, TOML_FLOAT128); - CHECK_VALUE_OR(TOML_FLOAT128 const, TOML_FLOAT128); -#endif - CHECK_VALUE_OR(char*, const char*); - CHECK_VALUE_OR(char*&, const char*); - CHECK_VALUE_OR(char*&&, const char*); - CHECK_VALUE_OR(char* const, const char*); - CHECK_VALUE_OR(char[2], const char*); - CHECK_VALUE_OR(char (&)[2], const char*); - CHECK_VALUE_OR(char (&&)[2], const char*); - CHECK_VALUE_OR(const char*, const char*); - CHECK_VALUE_OR(const char*&, const char*); - CHECK_VALUE_OR(const char*&&, const char*); - CHECK_VALUE_OR(const char* const, const char*); - CHECK_VALUE_OR(const char[2], const char*); - CHECK_VALUE_OR(const char (&)[2], const char*); - CHECK_VALUE_OR(const char (&&)[2], const char*); - CHECK_VALUE_OR(std::string_view, std::string_view); - CHECK_VALUE_OR(std::string_view&, std::string_view); - CHECK_VALUE_OR(std::string_view&&, std::string_view); - CHECK_VALUE_OR(const std::string_view, std::string_view); - CHECK_VALUE_OR(const std::string_view&, std::string_view); - CHECK_VALUE_OR(const std::string_view&&, std::string_view); - CHECK_VALUE_OR(std::string, std::string); - CHECK_VALUE_OR(std::string&, std::string); - CHECK_VALUE_OR(std::string&&, std::string); - CHECK_VALUE_OR(const std::string, std::string); - CHECK_VALUE_OR(const std::string&, std::string); - CHECK_VALUE_OR(const std::string&&, std::string); -#if TOML_HAS_CHAR8 - CHECK_VALUE_OR(char8_t*, const char8_t*); - CHECK_VALUE_OR(char8_t*&, const char8_t*); - CHECK_VALUE_OR(char8_t*&&, const char8_t*); - CHECK_VALUE_OR(char8_t* const, const char8_t*); - CHECK_VALUE_OR(char8_t[2], const char8_t*); - CHECK_VALUE_OR(char8_t (&)[2], const char8_t*); - CHECK_VALUE_OR(char8_t (&&)[2], const char8_t*); - CHECK_VALUE_OR(const char8_t*, const char8_t*); - CHECK_VALUE_OR(const char8_t*&, const char8_t*); - CHECK_VALUE_OR(const char8_t*&&, const char8_t*); - CHECK_VALUE_OR(const char8_t* const, const char8_t*); - CHECK_VALUE_OR(const char8_t[2], const char8_t*); - CHECK_VALUE_OR(const char8_t (&)[2], const char8_t*); - CHECK_VALUE_OR(const char8_t (&&)[2], const char8_t*); - CHECK_VALUE_OR(std::u8string_view, std::u8string_view); - CHECK_VALUE_OR(std::u8string_view&, std::u8string_view); - CHECK_VALUE_OR(std::u8string_view&&, std::u8string_view); - CHECK_VALUE_OR(const std::u8string_view, std::u8string_view); - CHECK_VALUE_OR(const std::u8string_view&, std::u8string_view); - CHECK_VALUE_OR(const std::u8string_view&&, std::u8string_view); - CHECK_VALUE_OR(std::u8string, std::u8string); - CHECK_VALUE_OR(std::u8string&, std::u8string); - CHECK_VALUE_OR(std::u8string&&, std::u8string); - CHECK_VALUE_OR(const std::u8string, std::u8string); - CHECK_VALUE_OR(const std::u8string&, std::u8string); - CHECK_VALUE_OR(const std::u8string&&, std::u8string); -#endif -#if TOML_ENABLE_WINDOWS_COMPAT - CHECK_VALUE_OR(wchar_t*, std::wstring); - CHECK_VALUE_OR(wchar_t*&, std::wstring); - CHECK_VALUE_OR(wchar_t*&&, std::wstring); - CHECK_VALUE_OR(wchar_t* const, std::wstring); - CHECK_VALUE_OR(wchar_t[2], std::wstring); - CHECK_VALUE_OR(wchar_t (&)[2], std::wstring); - CHECK_VALUE_OR(wchar_t (&&)[2], std::wstring); - CHECK_VALUE_OR(const wchar_t*, std::wstring); - CHECK_VALUE_OR(const wchar_t*&, std::wstring); - CHECK_VALUE_OR(const wchar_t*&&, std::wstring); - CHECK_VALUE_OR(const wchar_t* const, std::wstring); - CHECK_VALUE_OR(const wchar_t[2], std::wstring); - CHECK_VALUE_OR(const wchar_t (&)[2], std::wstring); - CHECK_VALUE_OR(const wchar_t (&&)[2], std::wstring); - CHECK_VALUE_OR(std::wstring_view, std::wstring); - CHECK_VALUE_OR(std::wstring_view&, std::wstring); - CHECK_VALUE_OR(std::wstring_view&&, std::wstring); - CHECK_VALUE_OR(const std::wstring_view, std::wstring); - CHECK_VALUE_OR(const std::wstring_view&, std::wstring); - CHECK_VALUE_OR(const std::wstring_view&&, std::wstring); - CHECK_VALUE_OR(std::wstring, std::wstring); - CHECK_VALUE_OR(std::wstring&, std::wstring); - CHECK_VALUE_OR(std::wstring&&, std::wstring); - CHECK_VALUE_OR(const std::wstring, std::wstring); - CHECK_VALUE_OR(const std::wstring&, std::wstring); - CHECK_VALUE_OR(const std::wstring&&, std::wstring); -#endif - -#define CHECK_INSERTED_AS(T, expected) \ - static_assert(std::is_same_v, expected>); \ - static_assert(std::is_same_v, expected>); \ - static_assert(std::is_same_v, expected>); \ - static_assert(std::is_same_v, expected>); \ - static_assert(std::is_same_v, expected>) - - CHECK_INSERTED_AS(table, table); - CHECK_INSERTED_AS(array, array); - CHECK_INSERTED_AS(node, node); - CHECK_INSERTED_AS(time, value