Skip to content

Commit b19367a

Browse files
committed
fix(tests): clean NUnit 3->4 conversion from release/9.3 baseline
Re-checkout all 261 test files from origin/release/9.3 and run scripts/tests/convert_nunit.py with corrected comparison logic. This fixes swapped argument order in Greater/Less assertions that were introduced during the SDK migration rebase (43d1fd5). The previous conversion incorrectly produced: Assert.That(0, Is.GreaterThan(value)) // WRONG - always false Now correctly produces: Assert.That(value, Is.GreaterThan(0)) // CORRECT Also restores 3 test files that were unintentionally deleted during the SDK migration: - Lib/src/ScrChecks/ScrChecksTests/SentenceFinalPunctCapitalizationCheckUnitTest.cs - Src/Common/ViewsInterfaces/ViewsInterfacesTests/ExtraComInterfacesTests.cs - Src/FwCoreDlgs/FwCoreDlgsTests/FwWritingSystemSetupDlgTests.cs
1 parent 21361d0 commit b19367a

58 files changed

Lines changed: 4468 additions & 6426 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Lib/src/ScrChecks/ScrChecksTests/ChapterVerseTests.cs‎

Lines changed: 866 additions & 1638 deletions
Large diffs are not rendered by default.

‎Lib/src/ScrChecks/ScrChecksTests/RepeatedWordsCheckUnitTest.cs‎

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
usingSystem;
66
usingSystem.Collections.Generic;
7-
usingSystem.Diagnostics;
87
usingNUnit.Framework;
9-
usingSIL.FieldWorks.Common.FwUtils;
8+
usingSystem.Diagnostics;
109
usingSILUBS.ScriptureChecks;
10+
usingSILUBS.SharedScrUtils;
1111

1212
namespaceSILUBS.ScriptureChecks
1313
{
@@ -18,7 +18,9 @@ public class RepeatedWordsCheckUnitTest
1818
UnitTestChecksDataSourcesource=newUnitTestChecksDataSource();
1919

2020
[SetUp]
21-
publicvoidRunBeforeEachTest(){}
21+
publicvoidRunBeforeEachTest()
22+
{
23+
}
2224

2325
voidTest(string[]result,stringtext)
2426
{
@@ -30,20 +32,13 @@ void Test(string[] result, string text, string desiredKey)
3032
source.Text=text;
3133

3234
RepeatedWordsCheckcheck=newRepeatedWordsCheck(source);
33-
List<TextTokenSubstring>tts=check.GetReferences(source.TextTokens(),desiredKey);
35+
List<TextTokenSubstring>tts=
36+
check.GetReferences(source.TextTokens(),desiredKey);
3437

35-
Assert.That(
36-
tts.Count,
37-
Is.EqualTo(result.GetUpperBound(0)+1),
38-
"A different number of results was returned than what was expected."
39-
);
38+
Assert.That(tts.Count,Is.EqualTo(result.GetUpperBound(0)+1),"A different number of results was returned than what was expected.");
4039

4140
for(inti=0;i<=result.GetUpperBound(0);++i)
42-
Assert.That(
43-
tts[i].InventoryText,
44-
Is.EqualTo(result[i]),
45-
"Result number: "+i.ToString()
46-
);
41+
Assert.That(tts[i].InventoryText,Is.EqualTo(result[i]),"Result number: "+i.ToString());
4742
}
4843

4944
[Test]
@@ -68,21 +63,16 @@ public void DifferentCase()
6863
[Ignore("Text needs to be normalized to NFC (or maybe NFD) before check is run.")]
6964
publicvoidDifferentNormalization()
7065
{
71-
Test(
72-
newstring[]{"B\u00E3r","B\u00E3r"},
73-
"\\p \\v 1 B\u00E3r Ba\u0303r and Ba\u0303r B\u00E3r "
74-
);
66+
Test(newstring[]{"B\u00E3r","B\u00E3r"},
67+
"\\p \\v 1 B\u00E3r Ba\u0303r and Ba\u0303r B\u00E3r ");
7568
}
7669

7770
[Test]
7871
[Ignore("Text needs to be normalized to NFC (or maybe NFD) before check is run.")]
7972
publicvoidFindingDifferentNormalization()
8073
{
81-
Test(
82-
newstring[]{"B\u00E3r","B\u00E3r"},
83-
"\\p \\v 1 B\u00E3r Ba\u0303r and and Ba\u0303r B\u00E3r ",
84-
"B\u00E3r"
85-
);
74+
Test(newstring[]{"B\u00E3r","B\u00E3r"},
75+
"\\p \\v 1 B\u00E3r Ba\u0303r and and Ba\u0303r B\u00E3r ","B\u00E3r");
8676
}
8777

8878
[Test]
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
// Copyright (c) 2015 SIL International
2+
// This software is licensed under the LGPL, version 2.1 or later
3+
// (http://www.gnu.org/licenses/lgpl-2.1.html)
4+
5+
usingSystem;
6+
usingSystem.Collections.Generic;
7+
usingSystem.Text;
8+
usingNUnit.Framework;
9+
usingSystem.Diagnostics;
10+
usingSystem.IO;
11+
usingSILUBS.SharedScrUtils;
12+
13+
namespaceSILUBS.ScriptureChecks
14+
{
15+
#if DEBUG
16+
[TestFixture]
17+
publicclassSentenceFinalPunctCapitalizationCheckUnitTest
18+
{
19+
UnitTestChecksDataSourcesource=newUnitTestChecksDataSource();
20+
21+
[SetUp]
22+
publicvoidRunBeforeEachTest()
23+
{
24+
source.SetParameterValue("ValidPunctuation","._ !_ ?_");
25+
}
26+
27+
voidTest(string[]result,stringtext)
28+
{
29+
source.Text=text;
30+
31+
SentenceFinalPunctCapitalizationCheckcheck=newSentenceFinalPunctCapitalizationCheck(source);
32+
List<TextTokenSubstring>tts=
33+
check.GetReferences(source.TextTokens(),"");
34+
35+
Assert.That(tts.Count,Is.EqualTo(result.GetUpperBound(0)+1),"A different number of results was returned than what was expected.");
36+
37+
for(inti=0;i<=result.GetUpperBound(0);++i)
38+
Assert.That(tts[i].InventoryText,Is.EqualTo(result[i]),"Result number: "+i.ToString());
39+
}
40+
41+
[Test]
42+
publicvoidUpperCase()
43+
{
44+
Test(newstring[]{},@"\p \v 1 Foo. Bar");
45+
}
46+
47+
[Test]
48+
publicvoidLowerCase()
49+
{
50+
Test(newstring[]{"."},@"\p \v 1 Foo. bar");
51+
}
52+
53+
[Test]
54+
publicvoidNoCaseNonRoman()
55+
{
56+
Test(newstring[]{},"\\p \\v 1 Foo. \u0E01");
57+
}
58+
59+
[Test]
60+
publicvoidNoCasePUA()
61+
{
62+
Test(newstring[]{},"\\p \\v 1 Foo. \uEE00");
63+
}
64+
65+
[Test]
66+
publicvoidTitleCase()
67+
{
68+
Test(newstring[]{},"\\p \\v 1 Foo. \u01C5");
69+
}
70+
71+
[Test]
72+
publicvoidMultipleUpperCase()
73+
{
74+
Test(newstring[]{},@"\p \v 1 Foo. Bar! Baz");
75+
}
76+
77+
[Test]
78+
publicvoidMultipleLowerCase()
79+
{
80+
Test(newstring[]{".","!"},@"\p \v 1 Foo. bar! baz");
81+
}
82+
83+
[Test]
84+
publicvoidMultipleMixedCase()
85+
{
86+
Test(newstring[]{"!"},@"\p \v 1 Foo. Bar! baz");
87+
}
88+
89+
[Test]
90+
publicvoidMultiplePunctUpperCase()
91+
{
92+
Test(newstring[]{},@"\p \v 1 Foo!? Bar");
93+
}
94+
95+
[Test]
96+
publicvoidMultiplePunctLowerCase()
97+
{
98+
Test(newstring[]{"!","?"},@"\p \v 1 Foo!? bar");
99+
}
100+
101+
[Test]
102+
publicvoidQuotes()
103+
{
104+
Test(newstring[]{"!"},"\\p \\v 1 \u201CFoo!\u201D bar");
105+
}
106+
107+
[Test]
108+
publicvoidDigits()
109+
{
110+
Test(newstring[]{},@"\p \v 1 Foo 1.2 bar");
111+
}
112+
113+
[Test]
114+
publicvoidAbbreviationError()
115+
{
116+
Test(newstring[]{"."},@"\p \v 1 The E.U. headquarters.");
117+
}
118+
119+
[Test]
120+
publicvoidAbbreviationOK()
121+
{
122+
source.SetParameterValue("Abbreviations","E.U.");
123+
Test(newstring[]{},@"\p \v 1 The E.U. headquarters.");
124+
}
125+
}
126+
#endif
127+
}

‎Src/CacheLight/CacheLightTests/RealDataCacheTests.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ public void AllMultiStringPropTest()
586586
SilDataAccess.SetMultiStringAlt(hvo,tag,2,tss);
587587

588588
vartsms=SilDataAccess.get_MultiStringProp(hvo,tag);
589-
Assert.That(2,Is.EqualTo(tsms.StringCount));
589+
Assert.That(tsms.StringCount,Is.EqualTo(2));
590590
}
591591

592592
/// <summary>

‎Src/Common/Controls/DetailControls/DetailControlsTests/DataTreeTests.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public void LabelAbbreviations()
178178
// are abbreviated by being truncated to 4 characters.
179179
Assert.That((m_dtree.Controls[0]asSlice).Label,Is.EqualTo("CitationForm"));
180180
stringabbr1=StringTable.Table.GetString((m_dtree.Controls[0]asSlice).Label,"LabelAbbreviations");
181-
Assert.That("*"+(m_dtree.Controls[0]asSlice).Label+"*",Is.EqualTo(abbr1));// verify it's not in the table.
181+
Assert.That(abbr1,Is.EqualTo("*"+(m_dtree.Controls[0]asSlice).Label+"*"));// verify it's not in the table.
182182
Assert.That((m_dtree.Controls[0]asSlice).Abbreviation,Is.EqualTo("Cita"));// verify truncation took place.
183183
// 2) Test that a label in "LabelAbbreviations" defaults to its string table entry.
184184
Assert.That((m_dtree.Controls[1]asSlice).Label,Is.EqualTo("Citation Form"));
@@ -187,7 +187,7 @@ public void LabelAbbreviations()
187187
Assert.That((m_dtree.Controls[1]asSlice).Abbreviation,Is.EqualTo(abbr2));// should be identical
188188
// 3) Test that a label with an "abbr" attribute overrides default abbreviation.
189189
Assert.That((m_dtree.Controls[2]asSlice).Label,Is.EqualTo("Citation Form"));
190-
Assert.That("!?",Is.EqualTo((m_dtree.Controls[2]asSlice).Abbreviation));
190+
Assert.That((m_dtree.Controls[2]asSlice).Abbreviation,Is.EqualTo("!?"));
191191
Assert.That(abbr2==(m_dtree.Controls[2]asSlice).Abbreviation,Is.False);
192192
}
193193

0 commit comments

Comments
 (0)