Skip to content

Commit

Permalink
Check for empty string (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
Enkidu93 authored Jul 16, 2024
1 parent 39df17e commit 554447f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/SIL.Machine/Scripture/ScriptureRangeParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ public Dictionary<string, List<int>> GetChapters(string chapterSelections)
Dictionary<string, List<int>> chaptersPerBook = new Dictionary<string, List<int>>();
chapterSelections = chapterSelections.Trim();

if (chapterSelections.Length == 0)
{
return chaptersPerBook;
}

char delimiter = ';';
if (chapterSelections.Contains(';'))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ public static IEnumerable<TestCaseData> GetCases()
new Dictionary<string, List<int>> { { "JHN", new List<int>() } },
false
);
yield return new TestCaseData("", new Dictionary<string, List<int>>(), false);

//*Throw exceptions
yield return new TestCaseData("MAT3-1", new Dictionary<string, List<int>>(), true);
Expand All @@ -185,7 +186,6 @@ public static IEnumerable<TestCaseData> GetCases()
yield return new TestCaseData("MAT0-10", new Dictionary<string, List<int>>(), true);
yield return new TestCaseData("MAT-FLUM", new Dictionary<string, List<int>>(), true);
yield return new TestCaseData("-MAT-FLUM", new Dictionary<string, List<int>>(), true);
yield return new TestCaseData("", new Dictionary<string, List<int>>(), true);
yield return new TestCaseData("ABC", new Dictionary<string, List<int>>(), true);
yield return new TestCaseData("MAT-ABC", new Dictionary<string, List<int>>(), true);
yield return new TestCaseData("NT;-ABC-LUK", new Dictionary<string, List<int>>(), true);
Expand Down

0 comments on commit 554447f

Please sign in to comment.