mirror of
https://github.com/znc/znc.git
synced 2026-08-07 09:22:55 +02:00
Combine test of buildmod to single file.
This commit is contained in:
+25
-12
@@ -45,10 +45,6 @@
|
||||
#define ZNC_BIN_DIR ""
|
||||
#endif
|
||||
|
||||
#ifndef ZNC_SRC_DIR
|
||||
#define ZNC_SRC_DIR ""
|
||||
#endif
|
||||
|
||||
using testing::AnyOf;
|
||||
using testing::Eq;
|
||||
using testing::HasSubstr;
|
||||
@@ -1848,25 +1844,42 @@ TEST_F(ZNCTest, BuildMod) {
|
||||
Z;
|
||||
auto client = LoginClient();
|
||||
Z;
|
||||
QTemporaryDir srcd;
|
||||
QDir srcdir(srcd.path());
|
||||
QFile file(srcdir.filePath("testmod.cpp"));
|
||||
ASSERT_TRUE(file.open(QIODevice::WriteOnly | QIODevice::Text));
|
||||
QTextStream out(&file);
|
||||
out << R"(
|
||||
#include <znc/Modules.h>
|
||||
class TestModule : public CModule {
|
||||
public:
|
||||
MODCONSTRUCTOR(TestModule) {}
|
||||
void OnModCommand(const CString& sLine) override {
|
||||
PutModule("Lorem ipsum");
|
||||
}
|
||||
};
|
||||
MODULEDEFS(TestModule, "Test")
|
||||
)";
|
||||
file.close();
|
||||
QDir dir(m_dir.path());
|
||||
EXPECT_TRUE(dir.mkdir("modules"));
|
||||
EXPECT_TRUE(dir.cd("modules"));
|
||||
{
|
||||
Process p(ZNC_BIN_DIR "/znc-buildmod",
|
||||
QStringList() << ZNC_SRC_DIR "/test/file-not-found.cpp",
|
||||
QStringList() << srcdir.filePath("file-not-found.cpp"),
|
||||
[&](QProcess* proc) {
|
||||
proc->setWorkingDirectory(dir.absolutePath());
|
||||
proc->setProcessChannelMode(QProcess::ForwardedChannels);
|
||||
});
|
||||
proc->setWorkingDirectory(dir.absolutePath());
|
||||
proc->setProcessChannelMode(QProcess::ForwardedChannels);
|
||||
});
|
||||
p.ShouldFinishItself(1);
|
||||
}
|
||||
{
|
||||
Process p(ZNC_BIN_DIR "/znc-buildmod",
|
||||
QStringList() << ZNC_SRC_DIR "/test/testmod.cpp",
|
||||
QStringList() << srcdir.filePath("testmod.cpp"),
|
||||
[&](QProcess* proc) {
|
||||
proc->setWorkingDirectory(dir.absolutePath());
|
||||
proc->setProcessChannelMode(QProcess::ForwardedChannels);
|
||||
});
|
||||
proc->setWorkingDirectory(dir.absolutePath());
|
||||
proc->setProcessChannelMode(QProcess::ForwardedChannels);
|
||||
});
|
||||
p.ShouldFinishItself();
|
||||
}
|
||||
client.Write("znc loadmod testmod");
|
||||
|
||||
Reference in New Issue
Block a user