18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-03 11:15:23 +01:00
Files
jerrrrycho 67a7e3876c fix(files): a new layer isn't made over a file there in another case, and the review's smaller points
- node_layers::create() refuses a name a file is there with in any case: on Linux path() wrote over it.
- A name is marked as logged only once the file is known to be there.
- The log line says the file is on disk in another case; the folders FileOnDiskToWrite() looks up aren't logged.
- The editor start reads the layers, and the heightmap terrain its terrain.yaml and pack files, as they're named on the disk.
- The write test compares the names exactly; a test of the log line once per name, with the lines kept by the test log stub.
2026-12-01 18:24:04 +01:00

26 lines
774 B
C++

#pragma once
#include <string>
#include <vector>
// engine_stubs.cpp: keeps every line logged from now on (true), or stops keeping them and forgets them (false), and
// the lines kept so far
void unit_tests_log_capture(bool Enabled);
std::vector<std::string> unit_tests_logged_lines();
namespace test {
// keeps the lines written to the log while it's alive, so a test can tell what was logged. one at a time
class log_capture {
public:
log_capture() { unit_tests_log_capture(true); }
~log_capture() { unit_tests_log_capture(false); }
log_capture(log_capture const &) = delete;
log_capture &operator=(log_capture const &) = delete;
// the lines written so far
std::vector<std::string> lines() const { return unit_tests_logged_lines(); }
};
} // namespace test