Skip to content

Commit

Permalink
- r prepare to replace tab
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsEckart committed Nov 20, 2023
1 parent 0954b61 commit 87223db
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public String createReceived(String actual)
}
public static String createNewReceivedFileText(String text, String actual, String methodName)
{
String tab = "\t";
text = text.replaceAll("\r\n", "\n");
int start = text.indexOf("void " + methodName + "(");
start = text.indexOf("{", start);
Expand All @@ -57,17 +58,17 @@ public static String createNewReceivedFileText(String text, String actual, Strin
{
part2 = text.substring(next + 1);
}
String fullText = String.format("%s\n\t\tvar expected = \"\"\"\n%s\t\t\"\"\";\n%s", part1, indent(actual),
part2);
String fullText = String.format("%s\n%s%svar expected = \"\"\"\n%s%s%s\"\"\";\n%s", part1, tab, tab,
indent(actual, tab), tab, tab, part2);
return fullText;
}
public static String indent(String actual)
public static String indent(String actual, String tab)
{
String[] split = actual.split("\n");
String output = "";
for (String line : split)
{
output += "\t\t" + line + "\n";
output += tab + tab + line + "\n";
}
return output;
}
Expand Down

0 comments on commit 87223db

Please sign in to comment.