Tests: Ensure tests use a fixture that inits app

This commit is contained in:
Chris Hennes
2025-07-23 16:56:36 -05:00
parent 1805e17427
commit 216900bd5d
10 changed files with 207 additions and 86 deletions

View File

@@ -2,41 +2,54 @@
#define FC_OS_MACOSX 1
#include "App/ProgramOptionsUtilities.h"
#include <src/App/InitApplication.h>
using namespace App::Util;
using Spr = std::pair<std::string, std::string>;
TEST(ApplicationTest, fCustomSyntaxLookup)
class ApplicationTest: public ::testing::Test
{
protected:
static void SetUpTestSuite()
{
tests::initApplication();
}
};
TEST_F(ApplicationTest, fCustomSyntaxLookup)
{
Spr res {customSyntax("-display")};
Spr exp {"display", "null"};
EXPECT_EQ(res, exp);
};
TEST(ApplicationTest, fCustomSyntaxMac)
TEST_F(ApplicationTest, fCustomSyntaxMac)
{
Spr res {customSyntax("-psn_stuff")};
Spr exp {"psn", "stuff"};
EXPECT_EQ(res, exp);
};
TEST(ApplicationTest, fCustomSyntaxWidgetCount)
TEST_F(ApplicationTest, fCustomSyntaxWidgetCount)
{
Spr res {customSyntax("-widgetcount")};
Spr exp {"widgetcount", ""};
EXPECT_EQ(res, exp);
}
TEST(ApplicationTest, fCustomSyntaxNotFound)
TEST_F(ApplicationTest, fCustomSyntaxNotFound)
{
Spr res {customSyntax("-displayx")};
Spr exp {"", ""};
EXPECT_EQ(res, exp);
};
TEST(ApplicationTest, fCustomSyntaxAmpersand)
TEST_F(ApplicationTest, fCustomSyntaxAmpersand)
{
Spr res {customSyntax("@freddie")};
Spr exp {"response-file", "freddie"};
EXPECT_EQ(res, exp);
};
TEST(ApplicationTest, fCustomSyntaxEmptyIn)
TEST_F(ApplicationTest, fCustomSyntaxEmptyIn)
{
Spr res {customSyntax("")};
Spr exp {"", ""};