Skip to content

Commit 6601d97

Browse files
authored
Improve LogAnalysis tests (#1696)
I noticed that a lot of the community solutions to the SubstringBetween where simply accidentally correct, doing s.Substring(s.IndexOf(first) + first.Length, s.IndexOf(last) - last.Length); i.e. thinking that the length of the last delimiter is relevant, which looks symmetrical to the handling of the first Substring parameter, and just happens to be correct on the provided string.
1 parent ef7343b commit 6601d97

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

exercises/concept/log-analysis/LogAnalysisTests.cs

+6
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ public void SubstringBetween()
2222
Assert.Equal("INFO", "[INFO]: File Deleted.".SubstringBetween("[", "]"));
2323
}
2424

25+
[Fact(Skip = "Remove this Skip property to run this test")]
26+
public void SubstringBetweenLongerDelimiters()
27+
{
28+
Assert.Equal("SOMETHING", "FIND >>> SOMETHING <===< HERE".SubstringBetween(">>> ", " <===<"));
29+
}
30+
2531
[Fact(Skip = "Remove this Skip property to run this test")]
2632
public void Message()
2733
{

0 commit comments

Comments
 (0)