blob: 09ab49b956471b6b8a2520f66328c94f28aa5e22 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#include <filesystem>
#include <fstream>
#include <gtest/gtest.h>
#include <starshatter/foundation/data.h>
namespace data = starshatter::foundation::data;
namespace fs = std::filesystem;
TEST(FoundationEx, OpenRelativePathOnFilesystem)
{
fs::current_path(fs::temp_directory_path());
{
std::fstream tmp("sample", tmp.out | tmp.binary);
tmp << "Hello, there!\n";
}
data::toggle_filesystem(true);
auto file = data::open("sample");
ASSERT_TRUE(file.valid());
ASSERT_LT(0, file.available());
const auto text = file.more();
ASSERT_STREQ("Hello, there!\n", text);
}
|