From dc558da002794cc07013e8376f3c55c73391aa0e Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sun, 12 Jul 2020 17:07:55 +1000 Subject: Update Dutil_TraceErrorSource to filter based on the report level. --- src/test/DUtilUnitTest/DUtilTests.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/test/DUtilUnitTest/DUtilTests.cpp (limited to 'src/test/DUtilUnitTest/DUtilTests.cpp') diff --git a/src/test/DUtilUnitTest/DUtilTests.cpp b/src/test/DUtilUnitTest/DUtilTests.cpp new file mode 100644 index 00000000..55e81d46 --- /dev/null +++ b/src/test/DUtilUnitTest/DUtilTests.cpp @@ -0,0 +1,35 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. + +#include "precomp.h" + +using namespace System; +using namespace Xunit; +using namespace WixBuildTools::TestSupport; + +namespace DutilTests +{ + public ref class DUtil + { + public: + [Fact] + void DUtilTraceErrorSourceFiltersOnTraceLevel() + { + DutilInitialize(&DutilTestTraceError); + + CallDutilTraceErrorSource(); + + Dutil_TraceSetLevel(REPORT_DEBUG, FALSE); + + Action^ action = gcnew Action(this, &DUtil::CallDutilTraceErrorSource); + Assert::Throws(action); + + DutilUninitialize(); + } + + private: + void CallDutilTraceErrorSource() + { + Dutil_TraceErrorSource(__FILE__, __LINE__, REPORT_DEBUG, DUTIL_SOURCE_EXTERNAL, E_FAIL, "Error message"); + } + }; +} -- cgit v1.2.3-55-g6feb