Files
joe pribele 1366bc3f93 [Core] added support to lowlevel tests validating that ensure and check are executed
added  a tls for an ensure handler callback to let the reporting log of ensures to be overridden

the following macros are supported in lowlevel tests
REQUIRE_ENSURE
CHECK_ENSURE
REQUIRE_CHECK

#rb devin.doucette
#preflight 634827c457048bdb82b43ffe

[CL 22505260 by joe pribele in ue5-main branch]
2022-10-13 11:24:15 -04:00

47 lines
850 B
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Misc/OutputDeviceError.h"
namespace UE::LowLevelTests
{
///@brief Used to replace GError so that errors are capture during execution of tests
class FTestRunnerOutputDeviceError : public FOutputDeviceError
{
public:
explicit FTestRunnerOutputDeviceError(FOutputDeviceError* Error)
: DeviceError(Error)
{
}
FTestRunnerOutputDeviceError()
: DeviceError(nullptr)
{
}
virtual void HandleError() override
{
if (DeviceError)
{
DeviceError->HandleError();
}
}
void Serialize(const TCHAR* V, ELogVerbosity::Type Verbosity, const FName& Category) override;
void SetDeviceError(FOutputDeviceError* Error)
{
DeviceError = Error;
}
FOutputDeviceError* GetDeviceError() const
{
return DeviceError;
}
private:
FOutputDeviceError* DeviceError;
};
}