diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 19ebb4e2..af017e1c 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -71,7 +71,7 @@ jobs: if: matrix.os == 'ubuntu-latest' - name: Test on Windows - run: dotnet test -a "%UserProfile%\.nuget\packages\nunit3testadapter\4.5.0\build\net462" --no-restore --no-build -p:ParallelizeAssembly=false --configuration Release -- RunConfiguration.FailWhenNoTestsFound=true + run: dotnet test --test-adapter-path "%UserProfile%\.nuget\packages\nunit3testadapter\4.5.0\build\net462" --no-restore --no-build -p:ParallelizeAssembly=false --configuration Release -- RunConfiguration.FailWhenNoTestsFound=true if: matrix.os != 'ubuntu-latest' - name: Package diff --git a/src/SIL.LCModel.FixData/HomographFixer.cs b/src/SIL.LCModel.FixData/HomographFixer.cs index b2549edf..73edd925 100644 --- a/src/SIL.LCModel.FixData/HomographFixer.cs +++ b/src/SIL.LCModel.FixData/HomographFixer.cs @@ -78,10 +78,7 @@ internal override void InspectElement(XElement rt) var citationForm = rt.Element("CitationForm"); if (citationForm != null) { - if (citationForm.Elements("AUni").Any(e => e.Attribute("ws")?.Value == m_homographWs)) - { - entriesWithCitationForm.Add(guid, citationForm); - } + entriesWithCitationForm.Add(guid, citationForm); } break; case "LangProject": @@ -103,6 +100,10 @@ internal override void FinalFixerInitialization(Dictionary owners, H { base.FinalFixerInitialization(owners, guids, parentToOwnedObjsur, rtElementsToDelete); // Sets base class member variables + // Filter the entriesWithCitationForm to only include those that match the homograph writing system. + var relevantCitationEntries = entriesWithCitationForm.Where(kvp => + kvp.Value.Elements("AUni").Any(e => e.Attribute("ws")?.Value == m_homographWs)).ToDictionary(kv => kv.Key, kv => kv.Value); + // Create a dictionary with the Form and MorphType guid as the key and a list of ownerguid's as the value. This // will show us which LexEntries should have homograph numbers. If the list of ownerguids has only one entry then // it's homograph number should be zero. If the list of owerguids has more than one guid then the LexEntries @@ -116,10 +117,10 @@ internal override void FinalFixerInitialization(Dictionary owners, H if (!m_firstAllomorphs.Contains(morphGuid)) continue; string rtFormText; - if (entriesWithCitationForm.Keys.Contains(owners[morphGuid])) + if (relevantCitationEntries.Keys.Contains(owners[morphGuid])) { var entryGuid = owners[morphGuid]; - var cfElement = entriesWithCitationForm[entryGuid]; + var cfElement = relevantCitationEntries[entryGuid]; rtFormText = GetStringInHomographWritingSystem(cfElement); if (string.IsNullOrWhiteSpace(rtFormText)) continue; diff --git a/tests/SIL.LCModel.FixData.Tests/TestData/HomographDrops/Test.fwdata b/tests/SIL.LCModel.FixData.Tests/TestData/HomographDrops/Test.fwdata index 74f4adde..8fb1c582 100644 --- a/tests/SIL.LCModel.FixData.Tests/TestData/HomographDrops/Test.fwdata +++ b/tests/SIL.LCModel.FixData.Tests/TestData/HomographDrops/Test.fwdata @@ -1,36 +1,5 @@  - - -enh - - -en ru enh-x-source en-x-ref en-x-geo enh - - -en ru enh-x-source en-x-ref en-x-geo enh - - -enh - - -enh enh-x-source - - - - -enh - - - - - -%proj%\LinkedFiles - - -enh enh-x-source - - + @@ -154,4 +123,29 @@ Dictionary + + +en ru enh-x-source en-x-ref en-x-geo enh + + +en ru enh-x-source en-x-ref en-x-geo enh + + +enh + + +enh enh-x-source + + + + +enh + + + + + +enh enh-x-source + + \ No newline at end of file