Skip to content

Commit ef0cf2f

Browse files
authored
Merge pull request #116 from aarondandy/issue-114-b
Fix casing issue from suggest early exit
2 parents 12ac2da + 57e9814 commit ef0cf2f

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

WeCantSpell.Hunspell.Tests/Issue106Tests.cs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,36 @@ public async ValueTask DisposeAsync() { }
2626
public void can_suggest_fr_designation()
2727
{
2828
var given = "Designation";
29-
var actual = _wordListFr.Suggest(given, TestContext.Current.CancellationToken);
30-
actual.ShouldContain("Désignation");
29+
var actual = _wordListFr.Suggest(
30+
given,
31+
new QueryOptions()
32+
{
33+
TimeLimitSuggestStep = TimeSpan.FromSeconds(1),
34+
TimeLimitCompoundCheck = TimeSpan.FromSeconds(1),
35+
TimeLimitCompoundSuggest = TimeSpan.FromSeconds(1),
36+
TimeLimitSuggestGlobal = TimeSpan.FromSeconds(10),
37+
},
38+
TestContext.Current.CancellationToken);
39+
actual.ShouldContain("Désignation", StringComparer.Ordinal);
3140
}
3241

3342
[Fact]
3443
public void can_suggest_es_descripcion()
3544
{
3645
var given = "Descripcion";
37-
var actual = _wordListEs.Suggest(given, TestContext.Current.CancellationToken);
46+
var actual = _wordListEs.Suggest(
47+
given,
48+
new QueryOptions()
49+
{
50+
TimeLimitSuggestStep = TimeSpan.FromSeconds(1),
51+
TimeLimitCompoundCheck = TimeSpan.FromSeconds(1),
52+
TimeLimitCompoundSuggest = TimeSpan.FromSeconds(1),
53+
TimeLimitSuggestGlobal = TimeSpan.FromSeconds(10),
54+
},
55+
TestContext.Current.CancellationToken);
3856
// I don't know why but net48 randomly changes the case of the first letter.
3957
// It's probably worth investingating further and creating a new test for that
4058
// when the issue there is understood.
41-
actual.ShouldContain("Descripción", StringComparer.InvariantCultureIgnoreCase);
59+
actual.ShouldContain("Descripción", StringComparer.Ordinal);
4260
}
4361
}

WeCantSpell.Hunspell/WordList.QuerySuggest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,8 @@ static void removeFromIndexThenInsertAtFront(List<string> list, int removeIndex,
498498
}
499499
}
500500

501+
result:
502+
501503
// word reversing wrapper for complex prefixes
502504
if (Affix.ComplexPrefixes)
503505
{
@@ -567,7 +569,6 @@ static void removeFromIndexThenInsertAtFront(List<string> list, int removeIndex,
567569
// output conversion
568570
Affix.OutputConversions.ConvertAll(slst);
569571

570-
result:
571572
return slst;
572573
}
573574

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## 6.0.4 - 2025-11
6+
7+
- Fix for suggest capitalization after early exit
8+
59
## 6.0.3 - 2025-09
610

711
- Improves overall performance a tiny bit

0 commit comments

Comments
 (0)