[+] Add cmd test

[*] Don't run gtest if there are no gtests available
[*] Update runtime
This commit is contained in:
Reece Wilson 2022-02-20 17:55:13 +00:00
parent 52338d1e3f
commit 0ea0669f4a
4 changed files with 48 additions and 2 deletions

@ -1 +1 @@
Subproject commit 786496647819719a93030e235b6a8535a74b0a64
Subproject commit 191f5df2a13e959e67114de9e8f97cf2f1d7d6ff

View File

@ -12,6 +12,7 @@
#include "gtest/gtest.h"
#include "test.hpp"
#include "unit.hpp"
#include "console.hpp"
using namespace Aurora::UnitTesting;
@ -23,7 +24,10 @@ int main(int argsc, const char ** argsv)
Aurora::UnitTesting::Console::Init();
RunTests();
::testing::InitGoogleTest(&argsc, (char **)argsv);
RUN_ALL_TESTS();
if (::testing::UnitTest::GetInstance()->total_test_count())
{
UnitAssert(RUN_ALL_TESTS() == 0, "gtest failed");
}
if (Aurora::RuntimeHasStarted())
{
Aurora::RuntimeShutdown();

0
Tests/Private/.keepme Normal file
View File

View File

@ -0,0 +1,42 @@
/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: Main.cpp
Date: 2022-2-18
Author: Reece
***/
#include <AuroraRuntime.hpp>
static void PrintAll()
{
const auto &flags = AuCmdLine::GetFlags();
AuLogInfo("Flags: {}", flags.size());
for (const auto &flag : flags)
{
AuLogInfo(" {}", flag);
}
const auto &values = AuCmdLine::GetValues();
AuLogInfo("Values: {}", values.size());
for (const auto &key : values)
{
AuLogInfo(" {}={}", key, AuCmdLine::GetValue(key, "error"));
}
}
void RunTests()
{
Aurora::RuntimeStartInfo info;
info.console.fio.enableLogging = false;
info.console.forceToolKitWindow = false;
Aurora::RuntimeStart(info);
PrintAll();
// Different command line interfaces will parse execv or generate the process command line string differently
// For instance, the flag 'hello world' looks like this across different platforms
//
// Powershell: & '.\3. Hello Command Line.Stage.Win32.x86_64.exe' Hello` World
// CMD : "3. Hello Command Line.Stage.Win32.x86_64.exe" "Hello World"
// Linux : ./3.\ Hello\ Command\ Line.Stage.Linux.x86_64 Hello\ World
}