From f967e1a6cc974c215050931440c5381f41bf64e7 Mon Sep 17 00:00:00 2001 From: Claudio Benghi Date: Wed, 6 Mar 2024 22:35:29 +0000 Subject: [PATCH] Fix for #28 - Added test case, - Correctly considered error status from the check. --- ids-lib/IdsSchema/XsNodes/XsRestriction.cs | 2 +- .../Issue 28 - Empty restriction.ids | 30 +++++++++++++++++++ ids-tool.tests/IssueTests.cs | 9 +++++- ids-tool.tests/ids-tool.tests.csproj | 3 ++ 4 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 ids-tool.tests/IssueFiles/Issue 28 - Empty restriction.ids diff --git a/ids-lib/IdsSchema/XsNodes/XsRestriction.cs b/ids-lib/IdsSchema/XsNodes/XsRestriction.cs index 54b0435..1b4842d 100644 --- a/ids-lib/IdsSchema/XsNodes/XsRestriction.cs +++ b/ids-lib/IdsSchema/XsNodes/XsRestriction.cs @@ -131,7 +131,7 @@ protected internal override Audit.Status PerformAudit(AuditStateInformation stat if (Base == BaseTypes.Invalid) ret |= IdsErrorMessages.Report303RestrictionBadType(logger, this, BaseAsString); if (!Children.Any()) - IdsErrorMessages.Report304RestrictionEmptyContent(logger, this); + ret |= IdsErrorMessages.Report304RestrictionEmptyContent(logger, this); return ret; } } diff --git a/ids-tool.tests/IssueFiles/Issue 28 - Empty restriction.ids b/ids-tool.tests/IssueFiles/Issue 28 - Empty restriction.ids new file mode 100644 index 0000000..eb044eb --- /dev/null +++ b/ids-tool.tests/IssueFiles/Issue 28 - Empty restriction.ids @@ -0,0 +1,30 @@ + + + + New ids file2 + jhnkjn3333 + + + + + + + IFCACTUATOR + + + + + asca + + + + + + w + + + + + + + \ No newline at end of file diff --git a/ids-tool.tests/IssueTests.cs b/ids-tool.tests/IssueTests.cs index 22ea5b8..c6eb3ff 100644 --- a/ids-tool.tests/IssueTests.cs +++ b/ids-tool.tests/IssueTests.cs @@ -40,10 +40,17 @@ public void Issue11_IfcLogicalIsValidDatatype() } [Fact] - public void Issue11_IfcPropertySetFound() + public void Issue25_IfcPropertySetFound() { var f = new FileInfo("IssueFiles/Issue 25 - Pset_ConstructionOccurence.ids"); LoggerAndAuditHelpers.FullAudit(f, XunitOutputHelper, IdsLib.Audit.Status.Ok); } + + [Fact] + public void Issue_28_EmptyRestriction() + { + var f = new FileInfo("IssueFiles/Issue 28 - Empty restriction.ids"); + LoggerAndAuditHelpers.FullAudit(f, XunitOutputHelper, IdsLib.Audit.Status.IdsContentError, 1); + } } } diff --git a/ids-tool.tests/ids-tool.tests.csproj b/ids-tool.tests/ids-tool.tests.csproj index a3f14c2..5de1694 100644 --- a/ids-tool.tests/ids-tool.tests.csproj +++ b/ids-tool.tests/ids-tool.tests.csproj @@ -174,6 +174,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest