Synergy 591 remaining sonarcloud bugs in synergy core (#6915)

* (WIP)-all issues corrected, tests started

* first test passing

alternative solution for SonarCloud check

fixed for to while translation

added changelog item

adding tests and fixes

more tests; avoid compiling BSD Tests on Windows

attempting a BSD compile patch

more tests

borrowing symbol detection from another test

more ambitious testing

changed the order of assertions for better info

more tests

fixed clear errors before executing

expanding transformation to use string comparison

including terminator on translation count

a different flag for testing MS Windows

differente Windows flag

more tests

fixing platform encoding match

Windows compiler difference on #ifdef

Google Test macro usage fix

test added

added keymap test

test and initialisation fixed

ms cl issue with named init

test for keymap

exercising keystate

more configuration exercises

one more test for config

added Unicode test

an IPv6 test

more portable networking code

using our own platform switching code

avoiding strcpy

* Fixed typo in Changelog.

* +appropriate memory handling

* one more test for coverage

* a tad more coverage

* expanded test on Config

* forcing addresses be resolved before use on test

* log modified

* re-obtaining equivalency at continue

* test added

* additional test, and initialisation for Windows

* added test sections for coverage

* fixed count

Co-authored-by: Max <maxmommersteeg@hotmail.com>
Co-authored-by: SerhiiGadzhilov <71632867+SerhiiGadzhilov@users.noreply.github.com>
This commit is contained in:
Ignacio Rodríguez 2021-01-19 19:52:37 +07:00 committed by GitHub
parent 5c2311a50a
commit 8ca0c185b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 3 deletions

View file

@ -1,7 +1,7 @@
v1.13.1-snapshot
===========
Bug fixes:
- #6900 Remaining SonarCloud reported bug items
- #6900 Remaining SonarCloud reported bug items (test fixed)
- #6889 Systray Icon on Ubuntu Auto Start (take 2)
===========

View file

@ -45,12 +45,15 @@ ArgParser::parseServerArgs(lib::synergy::ServerArgs& args, int argc, const char*
int i = 1;
while ( i < argc) {
if (parsePlatformArg(args, argc, argv, i)) {
++i;
continue;
}
else if (parseGenericArgs(argc, argv, i)) {
++i;
continue;
}
else if (parseDeprecatedArgs(argc, argv, i)) {
++i;
continue;
}
else if (isArg(i, argc, argv, "-a", "--address", 1)) {
@ -87,12 +90,15 @@ ArgParser::parseClientArgs(lib::synergy::ClientArgs& args, int argc, const char*
int i {1};
while (i < argc) {
if (parsePlatformArg(args, argc, argv, i)) {
++i;
continue;
}
else if (parseGenericArgs(argc, argv, i)) {
++i;
continue;
}
else if (parseDeprecatedArgs(argc, argv, i)) {
++i;
continue;
}
else if (isArg(i, argc, argv, NULL, "--camp")) {

View file

@ -73,8 +73,12 @@ TEST(ServerConfigTests, serverconfig_will_deem_equal_configs_with_same_cell_name
b.getInputFilter()->addFilterRule(InputFilter::Rule{new OnlySystemFilter()});
a.addAlias("screenA", "aliasA");
b.addAlias("screenA", "aliasA");
a.setSynergyAddress(NetworkAddress(8080));
b.setSynergyAddress(NetworkAddress(8080));
NetworkAddress addr1("localhost", 8080);
addr1.resolve();
NetworkAddress addr2("localhost", 8080);
addr2.resolve();
a.setSynergyAddress(addr1);
b.setSynergyAddress(addr2);
EXPECT_TRUE(a == b);
EXPECT_TRUE(b == a);

View file

@ -21,6 +21,8 @@
#include "synergy/ArgParser.h"
#include "synergy/ArgsBase.h"
#include "synergy/ToolArgs.h"
#include "synergy/ServerArgs.h"
#include "synergy/ClientArgs.h"
#include "test/global/gtest.h"
@ -230,3 +232,37 @@ TEST(ArgParserTests, parseToolArgs_matches_correspondingly)
EXPECT_FALSE(parser.parseToolArgs(toolArgs, 2, twoArgs.data()));
}
TEST(ArgParserTests, parseServerArgs_parses_each_category)
{
ArgParser parser(nullptr);
lib::synergy::ServerArgs args;
args.m_daemon = false;
char const *argv[] = {"synergy", "--help"
#if WINAPI_MSWINDOWS
,"--exit-pause"
#elif WINAPI_XWINDOWS
,"--no-xinitthreads"
#endif
, "--res-w", "888"
};
EXPECT_TRUE(parser.parseServerArgs(args, sizeof(argv)/sizeof(argv[0]), argv));
EXPECT_EQ(args.m_shouldExit, true);
}
TEST(ArgParserTests, parseClientArgs_parses_single_help)
{
ArgParser parser(nullptr);
lib::synergy::ClientArgs args;
args.m_daemon = false;
char const *argv[] = {"synergy", "--help"
#if WINAPI_MSWINDOWS
,"--exit-pause"
#elif WINAPI_XWINDOWS
,"--no-xinitthreads"
#endif
, "--res-w"
, "888"
, "127.0.0.1" };
EXPECT_TRUE(parser.parseClientArgs(args, sizeof(argv)/sizeof(argv[0]), argv));
EXPECT_EQ(args.m_shouldExit, true);
}