]> git.localhorst.tv Git - blank.git/blobdiff - tst/integration/TestServer.cpp
test for invoking with unknown argument
[blank.git] / tst / integration / TestServer.cpp
diff --git a/tst/integration/TestServer.cpp b/tst/integration/TestServer.cpp
deleted file mode 100644 (file)
index cb5819d..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-#include "TestServer.hpp"
-
-#include <iostream>
-
-
-namespace blank {
-namespace test {
-
-TestServer::TestServer()
-: dir()
-, proc(
-       "./blank" BLANK_SUFFIX,
-       { "blank", "--server", "--save-path", dir.Path(), "--cmd-port", "12354" },
-       { })
-, conn()
-, serv_buf()
-, sock_buf() {
-       // wait for command service startup
-       // TODO: timeouts for reading from process
-       WaitOutputLine("listening on TCP port 12354");
-       // connect to command service
-       conn = tcp::Socket("localhost", 12354);
-}
-
-TestServer::~TestServer() {
-       proc.Terminate();
-}
-
-
-void TestServer::WaitOutputLine(const std::string &expected) {
-       std::string line;
-       while (true) {
-               if (!serv_buf.Extract(line)) {
-                       // buffer exhausted, fetch more data
-                       serv_buf.Update(proc.ReadOut(serv_buf.WriteHead(), serv_buf.Remain()));
-                       continue;
-               }
-               if (line == expected) {
-                       return;
-               } else {
-                       std::cerr << "ignoring line: " << line << std::endl;
-               }
-       }
-}
-
-void TestServer::WaitCommandMessage(const std::string &line) {
-       WaitCommandLine(" > " + line);
-}
-
-void TestServer::WaitCommandError(const std::string &line) {
-       WaitCommandLine(" ! " + line);
-}
-
-void TestServer::WaitCommandBroadcast(const std::string &line) {
-       WaitCommandLine(" @ " + line);
-}
-
-void TestServer::WaitCommandLine(const std::string &expected) {
-       std::string line;
-       while (true) {
-               if (!serv_buf.Extract(line)) {
-                       // buffer exhausted, fetch more data
-                       serv_buf.Update(conn.Recv(serv_buf.WriteHead(), serv_buf.Remain()));
-                       continue;
-               }
-               if (line == expected) {
-                       return;
-               }
-       }
-}
-
-}
-}