Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for empty string #226

Merged
merged 2 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading