Skip to content

Commit

Permalink
- B Fixed bug in InlineApprovals where spaces prevented a function fr…
Browse files Browse the repository at this point in the history
…om being found
  • Loading branch information
ScottBob committed Mar 7, 2024
1 parent 6b7638b commit 2b66e65
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ public void testyMctest() {
""\";
Approvals.verify("", Options.inline(expected));
}
""","""
@Test
public void testyMctest () {
var expected = ""\"
Hello World***
""\";
Approvals.verify("", Options.inline(expected));
}
""", """
\t@Test
\tpublic void testyMctest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,25 @@ Becomes:
Approvals.verify("", Options.inline(expected));
}

******
@Test
public void testyMctest () {
var expected = """
Hello World***
""";
Approvals.verify("", Options.inline(expected));
}

Becomes:
@Test
public void testyMctest () {
var expected = """
1
2
""";
Approvals.verify("", Options.inline(expected));
}

******
@Test
public void testyMctest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public static CodeParts splitCode(String text, String methodName)
String line = lines[i];
if (start == 0)
{
if (line.contains("void " + methodName + "("))
// Do a regex search to check if a line contains the text "void"

if (line.matches(".*void\\s+" + methodName + "\\s*\\(.*"))
{
start = i;
codeParts.tab = extractLeadingWhitespace(line);
Expand Down

0 comments on commit 2b66e65

Please sign in to comment.