Guard PIConnection, thread primitives, PICodeParser and other feature code behind PIP_HAS_THREADS/PIP_HAS_FILESYSTEM. In CMake generate the feature flags summary from the single PIP_HAS_FLAGS list (used by the add_definitions loop as well), default ICU to OFF and make introspection also require PIP_HAS_SOCKET. Build system/thread test suites only when the corresponding feature flags are enabled.
16 lines
363 B
C++
16 lines
363 B
C++
#ifdef PIP_HAS_FILESYSTEM
|
|
# include "pifile.h"
|
|
|
|
# include "gtest/gtest.h"
|
|
|
|
TEST(PIFile_Test, openTemporary) {
|
|
const auto ba = PIByteArray::fromHex("AABBCC");
|
|
PIFile f;
|
|
ASSERT_TRUE(f.openTemporary());
|
|
ASSERT_TRUE(f.path().isNotEmpty());
|
|
ASSERT_EQ(ba.size(), f.write(ba));
|
|
ASSERT_EQ(ba, f.readAll());
|
|
ASSERT_TRUE(f.close());
|
|
}
|
|
#endif // PIP_HAS_FILESYSTEM
|