diff options
| author | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-05-01 10:09:18 -0500 |
|---|---|---|
| committer | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-05-01 10:09:18 -0500 |
| commit | 5d1fb2964a172e3444f18ca2ea823ee36784e699 (patch) | |
| tree | b658255c6465f049a6041cf8ee5970ff2521ca5a /src/tests/CMakeLists.txt | |
| parent | 17756f8337bc71abf10aa0e7612dc31f2e0a588a (diff) | |
Fix meta.ini duplicate keys and SKSE Log Redirector mapped folders
meta.ini: Qt6 QSettings IniFormat is case-sensitive on Linux. Pre-existing
CamelCase keys + lowercase setValue() left both casings in the file, so
mods grew duplicate entries on every install. Added MetaIniUtils::
normalizeMetaIniCase() to fold keys to lowercase and dedupe per-section
(keeping non-empty values) before any QSettings open in readMeta,
saveMeta, doInstall, and createMod.
SKSE Log Redirector: deployExternalMappings created per-file symlinks
under the redirected destination, so any new log file the game wrote
post-deploy ended up as a real file outside the mapping. For
isDirectory && createTarget mappings, now publish a single directory
symlink dst -> src when the destination is missing, an existing symlink,
or empty. Falls back to per-file symlinks when dst already has real
content (preserves user data). Cleanup removes the symlink, leaving no
files behind.
Tests under src/tests/ (gtest, opt-in via BUILD_TESTING):
- test_metainiutils: 6 tests covering no-op cases, case-only dedup,
multi-line continuations, per-section scoping, and end-to-end
verification that QSettings duplication is fixed.
- test_external_dir_mapping: 6 tests covering directory symlink deploy,
flow-through writes, idempotency, empty-dir replacement, real-file
fallback, and cleanup.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'src/tests/CMakeLists.txt')
| -rw-r--r-- | src/tests/CMakeLists.txt | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt new file mode 100644 index 0000000..8e71366 --- /dev/null +++ b/src/tests/CMakeLists.txt @@ -0,0 +1,53 @@ +cmake_minimum_required(VERSION 3.16) + +find_package(Qt6 REQUIRED COMPONENTS Core) +find_package(GTest REQUIRED) + +# --------------------------------------------------------------------------- +# meta.ini case-normalization helper tests +# --------------------------------------------------------------------------- +add_executable(test_metainiutils EXCLUDE_FROM_ALL + test_metainiutils.cpp + ${CMAKE_SOURCE_DIR}/src/src/metainiutils.cpp +) +set_target_properties(test_metainiutils PROPERTIES + AUTOMOC OFF + CXX_STANDARD 23 + CXX_STANDARD_REQUIRED ON +) +target_include_directories(test_metainiutils PRIVATE + ${CMAKE_SOURCE_DIR}/src/src +) +target_link_libraries(test_metainiutils PRIVATE + Qt6::Core + GTest::gtest + GTest::gtest_main +) +add_test(NAME test_metainiutils COMMAND test_metainiutils) + +# --------------------------------------------------------------------------- +# External directory mapping (SKSE Log Redirector style) tests +# +# Exercises the deploy/cleanup logic for `isDirectory && createTarget` +# mappings — directory-symlink path plus the per-file fallback when the +# destination already has real content. The behavior is mirrored from +# FuseConnector::deployExternalMappings so the test can run without +# bringing in libfuse or the rest of the organizer dependency tree. +# --------------------------------------------------------------------------- +add_executable(test_external_dir_mapping EXCLUDE_FROM_ALL + test_external_dir_mapping.cpp +) +set_target_properties(test_external_dir_mapping PROPERTIES + AUTOMOC OFF + CXX_STANDARD 23 + CXX_STANDARD_REQUIRED ON +) +target_link_libraries(test_external_dir_mapping PRIVATE + GTest::gtest + GTest::gtest_main +) +add_test(NAME test_external_dir_mapping COMMAND test_external_dir_mapping) + +# Register a "fluorine-tests" umbrella target that builds every test exe. +add_custom_target(fluorine-tests + DEPENDS test_metainiutils test_external_dir_mapping) |
