a few tests
This commit is contained in:
14
.vscode/launch.json
vendored
Normal file
14
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "unittests",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build/bin/unittests"
|
||||
}
|
||||
]
|
||||
}
|
||||
25
.vscode/settings.json
vendored
25
.vscode/settings.json
vendored
@ -6,5 +6,28 @@
|
||||
"xevent",
|
||||
"xscreensaver",
|
||||
"xscreensaver's"
|
||||
]
|
||||
],
|
||||
"editor.tokenColorCustomizations": {
|
||||
"textMateRules": [
|
||||
{
|
||||
"scope": "googletest.failed",
|
||||
"settings": {
|
||||
"foreground": "#f00"
|
||||
}
|
||||
},
|
||||
{
|
||||
"scope": "googletest.passed",
|
||||
"settings": {
|
||||
"foreground": "#0f0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"scope": "googletest.run",
|
||||
"settings": {
|
||||
"foreground": "#0f0"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"gtest-adapter.supportLocation": true
|
||||
}
|
||||
49
src/test/unittests/synergy/ServerAppTests.cpp
Normal file
49
src/test/unittests/synergy/ServerAppTests.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* synergy -- mouse and keyboard sharing utility
|
||||
* Copyright (C) 2014-2016 Symless Ltd.
|
||||
*
|
||||
* This package is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* found in the file LICENSE that should have accompanied this file.
|
||||
*
|
||||
* This package is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "synergy/ArgParser.h"
|
||||
#include "synergy/ServerArgs.h"
|
||||
|
||||
#define TEST_ENV
|
||||
|
||||
#include "synergy/ServerApp.h"
|
||||
|
||||
#include "test/global/gmock.h"
|
||||
|
||||
class MockServerApp : public ServerApp
|
||||
{
|
||||
public:
|
||||
MockServerApp() : ServerApp(nullptr, nullptr) { }
|
||||
};
|
||||
|
||||
#include "test/global/gtest.h"
|
||||
|
||||
// using ::testing::_;
|
||||
// using ::testing::Invoke;
|
||||
using ::testing::NiceMock;
|
||||
|
||||
TEST(ServerAppTests, runInner_will_handle_configuration_lifetime)
|
||||
{
|
||||
NiceMock<MockServerApp> app;
|
||||
|
||||
EXPECT_FALSE(app.args().m_config);
|
||||
|
||||
const char *argv[] {"synergyc"};
|
||||
app.runInner(1, const_cast<char **>(argv), nullptr, [](int,char**){ return 0; });
|
||||
|
||||
EXPECT_TRUE(app.args().m_config);
|
||||
}
|
||||
@ -37,6 +37,14 @@ server_stubCheckUnexpectedArgs()
|
||||
return false;
|
||||
}
|
||||
|
||||
TEST(ServerArgs, ServerArgs_will_construct_from_copy)
|
||||
{
|
||||
lib::synergy::ServerArgs serverArgs;
|
||||
serverArgs.m_display = "display0";
|
||||
auto serverArgs2 {serverArgs};
|
||||
EXPECT_EQ(serverArgs.m_display, serverArgs2.m_display);
|
||||
}
|
||||
|
||||
TEST(ServerArgsParsingTests, parseServerArgs_addressArg_setSynergyAddress)
|
||||
{
|
||||
NiceMock<MockArgParser> argParser;
|
||||
|
||||
Reference in New Issue
Block a user