diff --git a/.github/fedora/contour.spec b/.github/fedora/contour.spec index bc93d1a99a..4483a08e63 100644 --- a/.github/fedora/contour.spec +++ b/.github/fedora/contour.spec @@ -53,6 +53,7 @@ cmake . \ -DCONTOUR_QT_VERSION=6 \ -DPEDANTIC_COMPILER=ON \ -DPEDANTIC_COMPILER_WERROR=ON \ + -DCONTOUR_TESTING=ON \ -B build \ -GNinja cd build diff --git a/.github/ubuntu18/Dockerfile b/.github/ubuntu18/Dockerfile index 6743dc4192..48778bc91b 100644 --- a/.github/ubuntu18/Dockerfile +++ b/.github/ubuntu18/Dockerfile @@ -39,6 +39,7 @@ RUN g++-10 --version RUN cmake -S . -B build -G Ninja \ -D CMAKE_CXX_STANDARD=20 \ -D CONTOUR_QT_VERSION=5 \ + -D CONTOUR_TESTING=ON \ -D CMAKE_CXX_COMPILER=g++-10 RUN cmake --build build -- -j3 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5cc9240c6c..3aee91fa23 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -285,6 +285,7 @@ jobs: QTVER=${{ steps.set_vars.outputs.QTVER }} cmake . \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCONTOUR_TESTING=ON \ -DQt${QTVER}_DIR="$(brew --prefix qt@${QTVER})/lib/cmake/Qt${QTVER}" \ -DCONTOUR_QT_VERSION=${QTVER} \ -B build/ @@ -351,7 +352,7 @@ jobs: New-Item -ItemType Directory -Force -Path build } - name: "Generate build files" - run: cmake -DCMAKE_BUILD_TYPE=Release -DCONTOUR_QT_VERSION=6 -DLIBTERMINAL_BUILD_BENCH_HEADLESS=ON -DCMAKE_CXX_STANDARD=20 -DCMAKE_TOOLCHAIN_FILE="${{ runner.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows -DLIBTERMINAL_TESTING=ON -DLIBUNICODE_TESTING=ON -B build . + run: cmake -DCMAKE_BUILD_TYPE=Release -DCONTOUR_TESTING=ON -DCONTOUR_QT_VERSION=6 -DLIBTERMINAL_BUILD_BENCH_HEADLESS=ON -DCMAKE_CXX_STANDARD=20 -DCMAKE_TOOLCHAIN_FILE="${{ runner.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows -DLIBTERMINAL_TESTING=ON -DLIBUNICODE_TESTING=ON -B build . - name: "Build" run: cmake --build build/ --config Release - name: "test: crispy" diff --git a/CMakeLists.txt b/CMakeLists.txt index 5478fed4e5..715c3d3d45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,13 @@ if(NOT("${ADDR2LINE}" STREQUAL "")) endif() message(STATUS "addr2line: ${ADDR2LINE}") -option(CONTOUR_TESTING "Enables building of unittests for libterminal [default: ON" ON) +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(MAINTAINER_MODE ON) +else() + set(MAINTAINER_MODE OFF) +endif() + +option(CONTOUR_TESTING "Enables building of unittests for libterminal [default: ${MAINTAINER_MODE}]" ${MAINTAINER_MODE}) option(CONTOUR_FRONTEND_GUI "Enables GUI frontend." ON) option(CONTOUR_COVERAGE "Builds with codecov [default: OFF]" OFF) option(CONTOUR_SANITIZE "Builds with Address sanitizer enabled [default: OFF]" "OFF") diff --git a/cmake/ContourThirdParties.cmake b/cmake/ContourThirdParties.cmake index 5463ef387f..ba7cf99f35 100644 --- a/cmake/ContourThirdParties.cmake +++ b/cmake/ContourThirdParties.cmake @@ -45,11 +45,13 @@ endmacro() # Now, conditionally find all dependencies that were not included above # via find_package, usually system installed packages. -if (TARGET Catch2::Catch2) - set(THIRDPARTY_BUILTIN_Catch2 "embedded") -else() - find_package(Catch2 REQUIRED) - set(THIRDPARTY_BUILTIN_Catch2 "system package") +if(CONTOUR_TESTING) + if(TARGET Catch2::Catch2WithMain) + set(THIRDPARTY_BUILTIN_Catch2 "embedded") + else() + find_package(Catch2 REQUIRED) + set(THIRDPARTY_BUILTIN_Catch2 "system package") + endif() endif() if(TARGET fmt) @@ -102,17 +104,10 @@ endif() find_package(libunicode) if(libunicode_FOUND) - set(THIRDPARTY_BUILTIN_unicode_core "system package") - set(LIBUNICODE_LIBS unicode::unicode) + set(THIRDPARTY_BUILTIN_unicode_core "system package (${libunicode_VERSION})") else() ContourThirdParties_Embed_libunicode() - if (TARGET unicode::core) - set(THIRDPARTY_BUILTIN_unicode_core "embedded") - set(LIBUNICODE_LIBS unicode::core) - elseif(TARGET unicode::unicode) - set(THIRDPARTY_BUILTIN_unicode_core "system package (pre-provided)") - set(LIBUNICODE_LIBS unicode::unicode) - endif() + set(THIRDPARTY_BUILTIN_unicode_core "embedded") endif() if(LIBTERMINAL_BUILD_BENCH_HEADLESS) @@ -146,7 +141,7 @@ macro(ContourThirdPartiesSummary2) message(STATUS "harfbuzz ${THIRDPARTY_BUILTIN_harfbuzz}") message(STATUS "range-v3 ${THIRDPARTY_BUILTIN_range_v3}") message(STATUS "termbench-pro ${THIRDPARTY_BUILTIN_termbench}") - message(STATUS "libunicode ${THIRDPARTY_BUILTIN_unicode_core} (${LIBUNICODE_LIBS})") + message(STATUS "libunicode ${THIRDPARTY_BUILTIN_unicode_core}") message(STATUS "yaml-cpp ${THIRDPARTY_BUILTIN_yaml_cpp}") message(STATUS "boxed-cpp ${THIRDPARTY_BUILTIN_boxed_cpp}") message(STATUS "------------------------------------------------------------------------------") diff --git a/scripts/ci-prepare-contour.sh b/scripts/ci-prepare-contour.sh index 3414a14c3b..44531369d5 100755 --- a/scripts/ci-prepare-contour.sh +++ b/scripts/ci-prepare-contour.sh @@ -9,6 +9,7 @@ prepare_build_ubuntu() { cmake \ -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \ + -DCONTOUR_TESTING=ON \ -S . -B ${BUILD_DIR} \ ${EXTRA_CMAKE_FLAGS} } diff --git a/scripts/install-deps.ps1 b/scripts/install-deps.ps1 index 18a566abb4..1c487410e5 100755 --- a/scripts/install-deps.ps1 +++ b/scripts/install-deps.ps1 @@ -20,15 +20,15 @@ $ThirdParties = Macro = "" }; [ThirdParty]@{ - Folder = "Catch2-2.13.10"; - Archive = "Catch2-2.13.10.zip"; - URI = "https://github.com/catchorg/Catch2/archive/refs/tags/v2.13.10.zip"; + Folder = "Catch2-3.4.0"; + Archive = "Catch2-3.4.0.zip"; + URI = "https://github.com/catchorg/Catch2/archive/refs/tags/v3.4.0.zip"; Macro = "" }; [ThirdParty]@{ - Folder = "libunicode-b1b017c466038655872e1968acfc6a9880cf5d9f"; - Archive = "libunicode-b1b017c466038655872e1968acfc6a9880cf5d9f.zip"; - URI = "https://github.com/contour-terminal/libunicode/archive/b1b017c466038655872e1968acfc6a9880cf5d9f.zip"; + Folder = "libunicode-c1474ddc3a90366629d61863628b8d41cd764fa8"; + Archive = "libunicode-c1474ddc3a90366629d61863628b8d41cd764fa8.zip"; + URI = "https://github.com/contour-terminal/libunicode/archive/c1474ddc3a90366629d61863628b8d41cd764fa8.zip"; Macro = "libunicode" }; [ThirdParty]@{ diff --git a/scripts/install-deps.sh b/scripts/install-deps.sh index c2cad0287d..3edff67892 100755 --- a/scripts/install-deps.sh +++ b/scripts/install-deps.sh @@ -76,9 +76,9 @@ fetch_and_unpack() fetch_and_unpack_Catch2() { fetch_and_unpack \ - Catch2-2.13.10 \ - Catch2-2.13.10.tar.gz \ - https://github.com/catchorg/Catch2/archive/refs/tags/v2.13.10.tar.gz + Catch2-3.4.0 \ + Catch2-3.4.0.tar.gz \ + https://github.com/catchorg/Catch2/archive/refs/tags/v3.4.0.tar.gz } fetch_and_unpack_fmtlib() @@ -121,7 +121,7 @@ fetch_and_unpack_boxed() fetch_and_unpack_libunicode() { if test x$LIBUNICODE_SRC_DIR = x; then - local libunicode_git_sha="b1b017c466038655872e1968acfc6a9880cf5d9f" + local libunicode_git_sha="c1474ddc3a90366629d61863628b8d41cd764fa8" fetch_and_unpack \ libunicode-$libunicode_git_sha \ libunicode-$libunicode_git_sha.tar.gz \ diff --git a/src/crispy/BufferObject_test.cpp b/src/crispy/BufferObject_test.cpp index 5167b8badf..48d064c28c 100644 --- a/src/crispy/BufferObject_test.cpp +++ b/src/crispy/BufferObject_test.cpp @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include +#include TEST_CASE("buffer_object", "[buffer_object]") { diff --git a/src/crispy/CLI_test.cpp b/src/crispy/CLI_test.cpp index 0a1b5df83c..7c980b3a0c 100644 --- a/src/crispy/CLI_test.cpp +++ b/src/crispy/CLI_test.cpp @@ -3,7 +3,7 @@ #include -#include +#include // TODO API / impl: // diff --git a/src/crispy/CMakeLists.txt b/src/crispy/CMakeLists.txt index 95d890c4d8..29b402b4a1 100644 --- a/src/crispy/CMakeLists.txt +++ b/src/crispy/CMakeLists.txt @@ -45,7 +45,7 @@ if(MSVC) target_compile_definitions(crispy-core PUBLIC NOMINMAX) endif() -set(CRISPY_CORE_LIBS range-v3::range-v3 fmt::fmt-header-only unicode Microsoft.GSL::GSL boxed-cpp::boxed-cpp) +set(CRISPY_CORE_LIBS range-v3::range-v3 fmt::fmt-header-only unicode::unicode Microsoft.GSL::GSL boxed-cpp::boxed-cpp) if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL AMD64) target_compile_options(crispy-core PUBLIC -maes) @@ -127,10 +127,9 @@ if(CRISPY_TESTING) utils_test.cpp ring_test.cpp sort_test.cpp - test_main.cpp times_test.cpp ) - target_link_libraries(crispy_test fmt::fmt-header-only range-v3::range-v3 Catch2::Catch2 crispy::core) +target_link_libraries(crispy_test fmt::fmt-header-only range-v3::range-v3 Catch2::Catch2WithMain crispy::core) add_test(crispy_test ./crispy_test) endif() message(STATUS "[crispy] Compile unit tests: ${CRISPY_TESTING}") diff --git a/src/crispy/LRUCache_test.cpp b/src/crispy/LRUCache_test.cpp index 918e69c2e5..e0eb8a001a 100644 --- a/src/crispy/LRUCache_test.cpp +++ b/src/crispy/LRUCache_test.cpp @@ -3,7 +3,7 @@ #include -#include +#include #include #include diff --git a/src/crispy/Size_test.cpp b/src/crispy/Size_test.cpp index 3c5098cded..47d683b080 100644 --- a/src/crispy/Size_test.cpp +++ b/src/crispy/Size_test.cpp @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include +#include #include #include diff --git a/src/crispy/StrongLRUCache_test.cpp b/src/crispy/StrongLRUCache_test.cpp index 00775179be..7af39841d5 100644 --- a/src/crispy/StrongLRUCache_test.cpp +++ b/src/crispy/StrongLRUCache_test.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include diff --git a/src/crispy/StrongLRUHashtable_test.cpp b/src/crispy/StrongLRUHashtable_test.cpp index f39df693ac..b9f8309d11 100644 --- a/src/crispy/StrongLRUHashtable_test.cpp +++ b/src/crispy/StrongLRUHashtable_test.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include @@ -406,7 +406,7 @@ TEST_CASE("strong_lru_hashtable.peek", "") for (int i = 1; i <= 4; ++i) { - INFO(fmt::format("i: {}", i)) + INFO(fmt::format("i: {}", i)); REQUIRE(cache.peek(h(1)) == 2); REQUIRE(joinHumanReadable(cache.hashes()) == sh(4, 3, 2, 1)); } diff --git a/src/crispy/TrieMap_test.cpp b/src/crispy/TrieMap_test.cpp index e86d6a9a00..817c53aa32 100644 --- a/src/crispy/TrieMap_test.cpp +++ b/src/crispy/TrieMap_test.cpp @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include +#include #include #include diff --git a/src/crispy/base64_test.cpp b/src/crispy/base64_test.cpp index 8b2632ffce..7d99e3efc1 100644 --- a/src/crispy/base64_test.cpp +++ b/src/crispy/base64_test.cpp @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include +#include using namespace crispy; diff --git a/src/crispy/compose_test.cpp b/src/crispy/compose_test.cpp index 673a49ac1f..f8182cf365 100644 --- a/src/crispy/compose_test.cpp +++ b/src/crispy/compose_test.cpp @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include +#include TEST_CASE("compose.simple") { diff --git a/src/crispy/indexed_test.cpp b/src/crispy/indexed_test.cpp index 0fe952de20..c9c37f348c 100644 --- a/src/crispy/indexed_test.cpp +++ b/src/crispy/indexed_test.cpp @@ -3,7 +3,7 @@ #include -#include +#include #include #include diff --git a/src/crispy/ring_test.cpp b/src/crispy/ring_test.cpp index 5bd5e1cc2d..af8be5291a 100644 --- a/src/crispy/ring_test.cpp +++ b/src/crispy/ring_test.cpp @@ -3,7 +3,7 @@ #include -#include +#include #include diff --git a/src/crispy/sort_test.cpp b/src/crispy/sort_test.cpp index 0393dad326..69842ec359 100644 --- a/src/crispy/sort_test.cpp +++ b/src/crispy/sort_test.cpp @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include +#include #include diff --git a/src/crispy/test_main.cpp b/src/crispy/test_main.cpp index 79b89d3ea7..de2c1034a2 100644 --- a/src/crispy/test_main.cpp +++ b/src/crispy/test_main.cpp @@ -1,6 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 #define CATCH_CONFIG_RUNNER -#include +#include int main(int argc, char const* argv[]) { diff --git a/src/crispy/times_test.cpp b/src/crispy/times_test.cpp index 21f5350441..1130563ff5 100644 --- a/src/crispy/times_test.cpp +++ b/src/crispy/times_test.cpp @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include +#include TEST_CASE("times.count-simple") { diff --git a/src/crispy/utils_test.cpp b/src/crispy/utils_test.cpp index 0c2a978623..75840aa2da 100644 --- a/src/crispy/utils_test.cpp +++ b/src/crispy/utils_test.cpp @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include +#include using std::string; using std::string_view; diff --git a/src/text_shaper/CMakeLists.txt b/src/text_shaper/CMakeLists.txt index e179f35a77..341e84305d 100644 --- a/src/text_shaper/CMakeLists.txt +++ b/src/text_shaper/CMakeLists.txt @@ -21,7 +21,7 @@ endif() add_library(text_shaper STATIC ${text_shaper_SRC}) set_target_properties(text_shaper PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXE}") -set(TEXT_SHAPER_LIBS unicode boxed-cpp::boxed-cpp) +set(TEXT_SHAPER_LIBS unicode::unicode boxed-cpp::boxed-cpp) list(APPEND TEXT_SHAPER_LIBS fmt::fmt-header-only) list(APPEND TEXT_SHAPER_LIBS range-v3::range-v3) list(APPEND TEXT_SHAPER_LIBS Microsoft.GSL::GSL) diff --git a/src/vtbackend/CMakeLists.txt b/src/vtbackend/CMakeLists.txt index 834e73b56a..8b6bc2210c 100644 --- a/src/vtbackend/CMakeLists.txt +++ b/src/vtbackend/CMakeLists.txt @@ -100,7 +100,7 @@ target_link_libraries(vtbackend PUBLIC crispy::core fmt::fmt-header-only range-v3::range-v3 - ${LIBUNICODE_LIBS} + unicode::unicode vtparser vtpty ) @@ -123,7 +123,6 @@ endif() if(LIBTERMINAL_TESTING) enable_testing() add_executable(vtbackend_test - test_main.cpp Capabilities_test.cpp Color_test.cpp InputGenerator_test.cpp @@ -137,7 +136,7 @@ if(LIBTERMINAL_TESTING) SixelParser_test.cpp ViCommands_test.cpp ) - target_link_libraries(vtbackend_test fmt::fmt-header-only Catch2::Catch2 vtbackend) + target_link_libraries(vtbackend_test fmt::fmt-header-only Catch2::Catch2WithMain vtbackend) add_test(vtbackend_test ./vtbackend_test) if (LIBTERMINAL_BUILD_BENCH_HEADLESS) diff --git a/src/vtbackend/Capabilities_test.cpp b/src/vtbackend/Capabilities_test.cpp index 3efc6b1a98..c8ffa681fc 100644 --- a/src/vtbackend/Capabilities_test.cpp +++ b/src/vtbackend/Capabilities_test.cpp @@ -5,7 +5,7 @@ #include -#include +#include using namespace std::string_view_literals; using crispy::fromHexString; diff --git a/src/vtbackend/Color_test.cpp b/src/vtbackend/Color_test.cpp index ea5bad7b83..a03d5b51b6 100644 --- a/src/vtbackend/Color_test.cpp +++ b/src/vtbackend/Color_test.cpp @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include +#include using namespace vtbackend; diff --git a/src/vtbackend/Functions_test.cpp b/src/vtbackend/Functions_test.cpp index f53aba211a..09b438152a 100644 --- a/src/vtbackend/Functions_test.cpp +++ b/src/vtbackend/Functions_test.cpp @@ -3,7 +3,7 @@ #include -#include +#include namespace vtbackend { diff --git a/src/vtbackend/Grid_test.cpp b/src/vtbackend/Grid_test.cpp index 4cf0fd2dfe..2853d05fc5 100644 --- a/src/vtbackend/Grid_test.cpp +++ b/src/vtbackend/Grid_test.cpp @@ -7,7 +7,7 @@ #include -#include +#include using namespace vtbackend; using namespace std::string_literals; diff --git a/src/vtbackend/InputGenerator_test.cpp b/src/vtbackend/InputGenerator_test.cpp index 9798e1a187..993687c568 100644 --- a/src/vtbackend/InputGenerator_test.cpp +++ b/src/vtbackend/InputGenerator_test.cpp @@ -5,7 +5,7 @@ #include -#include +#include #include diff --git a/src/vtbackend/Line_test.cpp b/src/vtbackend/Line_test.cpp index fea18cd81a..84b2cd37e6 100644 --- a/src/vtbackend/Line_test.cpp +++ b/src/vtbackend/Line_test.cpp @@ -4,7 +4,7 @@ #include -#include +#include using namespace std; diff --git a/src/vtbackend/Screen_test.cpp b/src/vtbackend/Screen_test.cpp index 303574e85d..ec2ff904d5 100644 --- a/src/vtbackend/Screen_test.cpp +++ b/src/vtbackend/Screen_test.cpp @@ -13,7 +13,7 @@ #include -#include +#include #include @@ -3589,9 +3589,9 @@ TEST_CASE("Sixel.simple", "[screen]") auto fragment = cell.imageFragment(); REQUIRE(fragment); if ((column.value + line.value) % 2) - REQUIRE_THAT(white10x10, Catch::Matchers::Equals(fragment->data())); + REQUIRE(fragment->data() == white10x10); else - REQUIRE_THAT(black10x10, Catch::Matchers::Equals(fragment->data())); + REQUIRE(fragment->data() == black10x10); CHECK(fragment->offset().line == line); CHECK(fragment->offset().column == column); @@ -3630,9 +3630,9 @@ TEST_CASE("Sixel.AutoScroll-1", "[screen]") auto fragment = cell.imageFragment(); REQUIRE(fragment); if ((column.value + line.value) % 2) - REQUIRE_THAT(black10x10, Catch::Matchers::Equals(fragment->data())); + REQUIRE(fragment->data() == black10x10); else - REQUIRE_THAT(white10x10, Catch::Matchers::Equals(fragment->data())); + REQUIRE(fragment->data() == white10x10); CHECK(fragment->offset().line == line + 1); CHECK(fragment->offset().column == column); CHECK(!fragment->data().empty()); @@ -3669,9 +3669,9 @@ TEST_CASE("Sixel.status_line", "[screen]") auto fragment = cell.imageFragment(); REQUIRE(fragment); if ((column.value + line.value) % 2) - REQUIRE_THAT(white10x10, Catch::Matchers::Equals(fragment->data())); + REQUIRE(fragment->data() == white10x10); else - REQUIRE_THAT(black10x10, Catch::Matchers::Equals(fragment->data())); + REQUIRE(fragment->data() == black10x10); CHECK(fragment->offset().line == line + 6); CHECK(fragment->offset().column == column); diff --git a/src/vtbackend/Selector_test.cpp b/src/vtbackend/Selector_test.cpp index abd1987097..3fc715b718 100644 --- a/src/vtbackend/Selector_test.cpp +++ b/src/vtbackend/Selector_test.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include using crispy::size; using namespace std; diff --git a/src/vtbackend/Sequence_test.cpp b/src/vtbackend/Sequence_test.cpp index f36a080fef..a4a4b53b87 100644 --- a/src/vtbackend/Sequence_test.cpp +++ b/src/vtbackend/Sequence_test.cpp @@ -1,7 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 #include -#include +#include #include diff --git a/src/vtbackend/SixelParser_test.cpp b/src/vtbackend/SixelParser_test.cpp index 4ca199653a..97dcc4f54f 100644 --- a/src/vtbackend/SixelParser_test.cpp +++ b/src/vtbackend/SixelParser_test.cpp @@ -3,7 +3,7 @@ #include -#include +#include #include #include diff --git a/src/vtbackend/Terminal_test.cpp b/src/vtbackend/Terminal_test.cpp index b078d9bb36..3f669cf579 100644 --- a/src/vtbackend/Terminal_test.cpp +++ b/src/vtbackend/Terminal_test.cpp @@ -11,7 +11,7 @@ #include -#include +#include #include #include diff --git a/src/vtbackend/ViCommands_test.cpp b/src/vtbackend/ViCommands_test.cpp index 53054cdbde..5ea8d75692 100644 --- a/src/vtbackend/ViCommands_test.cpp +++ b/src/vtbackend/ViCommands_test.cpp @@ -5,7 +5,7 @@ #include -#include +#include // Checklist // ========= diff --git a/src/vtbackend/test_helpers.h b/src/vtbackend/test_helpers.h index 806a155a42..06767fc9e9 100644 --- a/src/vtbackend/test_helpers.h +++ b/src/vtbackend/test_helpers.h @@ -7,7 +7,7 @@ #include -#include +#include #include #include diff --git a/src/vtbackend/test_main.cpp b/src/vtbackend/test_main.cpp index c1a56c1190..c8431f2b10 100644 --- a/src/vtbackend/test_main.cpp +++ b/src/vtbackend/test_main.cpp @@ -3,7 +3,7 @@ #include #define CATCH_CONFIG_RUNNER -#include +#include int main(int argc, char const* argv[]) { diff --git a/src/vtparser/CMakeLists.txt b/src/vtparser/CMakeLists.txt index b366543bd5..0208e2adb2 100644 --- a/src/vtparser/CMakeLists.txt +++ b/src/vtparser/CMakeLists.txt @@ -8,7 +8,7 @@ add_library(vtparser STATIC ParserEvents.h ) set_target_properties(vtparser PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXE}") -target_link_libraries(vtparser PUBLIC crispy::core fmt::fmt-header-only Microsoft.GSL::GSL) +target_link_libraries(vtparser PUBLIC crispy::core unicode::unicode fmt::fmt-header-only Microsoft.GSL::GSL) target_include_directories(vtparser PUBLIC $ $ @@ -18,9 +18,8 @@ option(VTPARSER_TESTING "Enables building of unittests for vtparser [default: ON if(VTPARSER_TESTING) enable_testing() add_executable(vtparser_test - test_main.cpp Parser_test.cpp ) - target_link_libraries(vtparser_test vtparser Catch2::Catch2) + target_link_libraries(vtparser_test vtparser Catch2::Catch2WithMain) add_test(vtparser_test ./vtparser_test) endif() diff --git a/src/vtparser/Parser-impl.h b/src/vtparser/Parser-impl.h index 6d4fdae6d8..ac2d56f64c 100644 --- a/src/vtparser/Parser-impl.h +++ b/src/vtparser/Parser-impl.h @@ -380,10 +380,11 @@ auto Parser::parseBulkText(char const* begin, if (!maxCharCount) return { ProcessKind::FallbackToFSM, 0 }; + _scanState.next = nullptr; auto const chunk = std::string_view(input, static_cast(std::distance(input, end))); - auto const [cellCount, next, subStart, subEnd] = unicode::scan_text(_scanState, chunk, maxCharCount); + auto const [cellCount, subStart, subEnd] = unicode::scan_text(_scanState, chunk, maxCharCount); - if (next == input) + if (_scanState.next == input) return { ProcessKind::FallbackToFSM, 0 }; // We do not test on cellCount>0 because the scan could contain only a ZWJ (zero width @@ -396,7 +397,7 @@ auto Parser::parseBulkText(char const* begin, assert(cellCount <= maxCharCount); assert(subEnd <= chunk.data() + chunk.size()); - assert(next <= chunk.data() + chunk.size()); + assert(_scanState.next <= chunk.data() + chunk.size()); #if defined(LIBTERMINAL_LOG_TRACE) if (vtTraceParserLog) @@ -425,7 +426,7 @@ auto Parser::parseBulkText(char const* begin, _eventListener.execute(*input++); } - auto const count = static_cast(std::distance(input, next)); + auto const count = static_cast(std::distance(input, _scanState.next)); return { ProcessKind::ContinueBulk, count }; } diff --git a/src/vtparser/Parser_test.cpp b/src/vtparser/Parser_test.cpp index 3578e7d27d..bcb3555398 100644 --- a/src/vtparser/Parser_test.cpp +++ b/src/vtparser/Parser_test.cpp @@ -4,7 +4,7 @@ #include -#include +#include using namespace std; diff --git a/src/vtparser/test_main.cpp b/src/vtparser/test_main.cpp index c1a56c1190..c8431f2b10 100644 --- a/src/vtparser/test_main.cpp +++ b/src/vtparser/test_main.cpp @@ -3,7 +3,7 @@ #include #define CATCH_CONFIG_RUNNER -#include +#include int main(int argc, char const* argv[]) {