Updated the unit tests for the Json Serialization array fix
This commit is contained in:
@@ -102,17 +102,6 @@ namespace AZ
|
||||
return context.Report(retVal, "Processing of basic container was halted.");
|
||||
}
|
||||
|
||||
// If each container element was 'DefaultsUsed', then the result code will be 'DefaultsUsed'
|
||||
// But this is wrong if the container has at least one element, because a container with
|
||||
// at least one element is certainly not the default container value.
|
||||
// Basically, the following are different objects:
|
||||
// [ {} ] // The container which has only default elements, but is not the empty container
|
||||
// {} // The default container, which is empty
|
||||
if (index > 0)
|
||||
{
|
||||
retVal.Combine(JSR::ResultCode(JSR::Tasks::WriteValue, JSR::Outcomes::Success));
|
||||
}
|
||||
|
||||
if (context.ShouldKeepDefaults())
|
||||
{
|
||||
outputValue = AZStd::move(array);
|
||||
@@ -134,6 +123,10 @@ namespace AZ
|
||||
{
|
||||
if (retVal.HasDoneWork())
|
||||
{
|
||||
// If at least one value was written, even if it has all defaults, then the array has
|
||||
// a value written to it and is therefore not in a default state anymore.
|
||||
retVal.Combine(JSR::ResultCode(JSR::Tasks::WriteValue, JSR::Outcomes::Success));
|
||||
|
||||
outputValue = AZStd::move(array);
|
||||
return context.Report(retVal, "Content written to basic container.");
|
||||
}
|
||||
|
||||
@@ -301,7 +301,7 @@ namespace JsonSerializationTests
|
||||
|
||||
ResultCode result = m_serializer->Store(*m_jsonDocument, &instance, &instance, azrtti_typeid(&instance), *m_jsonSerializationContext);
|
||||
EXPECT_EQ(Processing::Completed, result.GetProcessing());
|
||||
EXPECT_EQ(Outcomes::DefaultsUsed, result.GetOutcome());
|
||||
EXPECT_EQ(Outcomes::PartialDefaults, result.GetOutcome());
|
||||
Expect_DocStrEq("[{}]");
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ namespace JsonSerializationTests
|
||||
|
||||
ResultCode result = m_serializer->Store(*m_jsonDocument, &instance, nullptr, azrtti_typeid(&instance), *m_jsonSerializationContext);
|
||||
EXPECT_EQ(Processing::Completed, result.GetProcessing());
|
||||
EXPECT_EQ(Outcomes::DefaultsUsed, result.GetOutcome());
|
||||
EXPECT_EQ(Outcomes::PartialDefaults, result.GetOutcome());
|
||||
Expect_DocStrEq("[{},{}]");
|
||||
}
|
||||
|
||||
@@ -330,7 +330,6 @@ namespace JsonSerializationTests
|
||||
ResultCode result = m_serializer->Store(*m_jsonDocument, &instance, nullptr, azrtti_typeid(&instance), *m_jsonSerializationContext);
|
||||
EXPECT_EQ(Processing::Completed, result.GetProcessing());
|
||||
EXPECT_EQ(Outcomes::PartialDefaults, result.GetOutcome());
|
||||
EXPECT_NE(Outcomes::DefaultsUsed, result.GetOutcome());
|
||||
Expect_DocStrEq(R"([{"$type": "SimpleInheritence"},{"$type": "SimpleInheritence"}])");
|
||||
}
|
||||
|
||||
|
||||
@@ -636,7 +636,7 @@ namespace JsonSerializationTests
|
||||
azrtti_typeid(&values), *m_jsonSerializationContext);
|
||||
|
||||
EXPECT_EQ(Processing::Completed, result.GetProcessing());
|
||||
EXPECT_EQ(Outcomes::DefaultsUsed, result.GetOutcome());
|
||||
EXPECT_EQ(Outcomes::PartialDefaults, result.GetOutcome());
|
||||
Expect_DocStrEq(R"(
|
||||
{
|
||||
"{}": {}
|
||||
@@ -654,7 +654,7 @@ namespace JsonSerializationTests
|
||||
azrtti_typeid(&values), *m_jsonSerializationContext);
|
||||
|
||||
EXPECT_EQ(Processing::Completed, result.GetProcessing());
|
||||
EXPECT_EQ(Outcomes::DefaultsUsed, result.GetOutcome());
|
||||
EXPECT_EQ(Outcomes::PartialDefaults, result.GetOutcome());
|
||||
Expect_DocStrEq(R"(
|
||||
{
|
||||
"{}": {}
|
||||
|
||||
Reference in New Issue
Block a user