Files
dusk/test/save/savetestfixture.h
T
YourWishesandClaude Sonnet 5 fdfdfa3a66 Fix the build after archiving rpg/ui/scene: drop their last live dependents
rpg/ui/scene moved to archive/ earlier left a handful of otherwise-generic
systems with dead references into them:
- asset/loader/chunk existed solely to load rpg overworld map chunks
  (tile_t, worldpos_t) - deleted outright, along with its
  ASSET_LOADER_TYPE_CHUNK entry in assetloader.c/h.
- save/slot wrapped party_t/storyflagval_t/map-name/cutscene-path, which is
  100% rpg save data - deleted outright (save.c/h, savedevice.c/h and the
  Linux save backend keep their generic settings/device-discovery logic,
  just lose the slot read/write pieces that only existed for it).
- locale/localemanager.c and test/CMakeLists.txt/test/save/* had a few
  stray includes and test cases that only existed for the now-gone code.

Also restores assets/locale/en_US.po (copied back from archive/assets/) -
locale init still needs a real locale file to boot into, even with the
asset-moving/archiving done separately.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
2026-10-15 09:08:02 -05:00

38 lines
1.4 KiB
C

/**
* Copyright (c) 2026 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "save/save.h"
/**
* Points $HOME at a fresh, empty temporary directory and resets the global
* SAVE state via the real saveInit(). Save tests run against the real Linux
* filesystem backend (there is no fake/mockable platform layer to swap in -
* the platform hooks are compile-time macros, not function pointers), so
* this sandboxing is what keeps tests from touching the real user's
* $HOME/.dusk/saves. Matches cmocka's CMUnitTestSetup signature - pass
* directly to cmocka_unit_test_setup_teardown.
*/
int saveTestFixtureSetup(void **state);
/**
* Recursively removes the temporary $HOME directory tree created by
* saveTestFixtureSetup and restores the real $HOME. Matches cmocka's
* CMUnitTestTeardown signature - pass directly to
* cmocka_unit_test_setup_teardown.
*/
int saveTestFixtureTeardown(void **state);
/**
* Places a regular file where the ".dusk" directory needs to go, so a
* subsequent availability check's mkdirp() call fails with ENOTDIR instead
* of succeeding. Used to deterministically exercise the "device unavailable
* because its directory couldn't be created" path without relying on real
* filesystem permission tricks. Must be called after saveTestFixtureSetup.
*/
void saveTestFixtureBlockSaveDirectory(void);