From 838d10a319d0c35ed71fcd3e14d2a830883dbbbd Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Sun, 7 Mar 2021 19:28:18 -0500 Subject: [PATCH] Correctly handle missing/null values with ~<> operator. (That's case-insensitive non-equal.) Fixes https://github.com/wixtoolset/issues/issues/5372 --- src/engine/condition.cpp | 2 +- src/test/BurnUnitTest/VariableTest.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/engine/condition.cpp b/src/engine/condition.cpp index 316224d..56fe76c 100644 --- a/src/engine/condition.cpp +++ b/src/engine/condition.cpp @@ -896,7 +896,7 @@ static HRESULT CompareOperands( else { // not a combination that can be compared - *pfResult = (BURN_SYMBOL_TYPE_NE == comparison); + *pfResult = (BURN_SYMBOL_TYPE_NE == comparison || BURN_SYMBOL_TYPE_NE_I == comparison); } LExit: diff --git a/src/test/BurnUnitTest/VariableTest.cpp b/src/test/BurnUnitTest/VariableTest.cpp index 676c134..ab45a73 100644 --- a/src/test/BurnUnitTest/VariableTest.cpp +++ b/src/test/BurnUnitTest/VariableTest.cpp @@ -258,7 +258,10 @@ namespace Bootstrapper Assert::True(EvaluateConditionHelper(&variables, L"PROP1 = \"VAL1\"")); Assert::False(EvaluateConditionHelper(&variables, L"NONE = \"NOT\"")); Assert::False(EvaluateConditionHelper(&variables, L"PROP1 <> \"VAL1\"")); + Assert::False(EvaluateConditionHelper(&variables, L"PROP1 ~<> \"VAL1\"")); + Assert::False(EvaluateConditionHelper(&variables, L"PROP1 ~<> \"Val1\"")); Assert::True(EvaluateConditionHelper(&variables, L"NONE <> \"NOT\"")); + Assert::True(EvaluateConditionHelper(&variables, L"NONE ~<> \"NOT\"")); Assert::True(EvaluateConditionHelper(&variables, L"PROP1 ~= \"val1\"")); Assert::False(EvaluateConditionHelper(&variables, L"PROP1 = \"val1\""));