TS Config comments trim at first new-line fix #4927
This commit is contained in:
parent
e9691a26bc
commit
ba2484759d
Binary file not shown.
|
@ -19,6 +19,9 @@ import static org.abego.treelayout.internal.util.java.lang.string.StringUtil.quo
|
|||
* @see SdCardFieldsConsumer
|
||||
*/
|
||||
public class DataLogConsumer implements ConfigurationConsumer {
|
||||
// https://github.com/rusefi/web_backend/issues/166
|
||||
private static final int MSQ_LENGTH_LIMIT = 34;
|
||||
|
||||
public static final String UNUSED = ConfigStructure.UNUSED_ANYTHING_PREFIX;
|
||||
private final String fileName;
|
||||
private final StringBuilder tsWriter = new StringBuilder();
|
||||
|
@ -91,6 +94,8 @@ public class DataLogConsumer implements ConfigurationConsumer {
|
|||
*/
|
||||
comment = prefix + unquote(configField.getName());
|
||||
}
|
||||
if (comment.length() > MSQ_LENGTH_LIMIT)
|
||||
throw new IllegalStateException("[" + comment + "] is too long for log files at " + comment.length());
|
||||
|
||||
if (comment.charAt(0) != '"')
|
||||
comment = quote(comment);
|
||||
|
|
|
@ -17,8 +17,6 @@ import static com.rusefi.output.JavaSensorsConsumer.quote;
|
|||
*/
|
||||
@SuppressWarnings({"StringConcatenationInsideStringBufferAppend", "DanglingJavadoc"})
|
||||
public class TsOutput {
|
||||
// https://github.com/rusefi/web_backend/issues/166
|
||||
private static final int MSQ_LENGTH_LIMIT = 34;
|
||||
private final StringBuilder settingContextHelp = new StringBuilder();
|
||||
private final boolean isConstantsSection;
|
||||
private final StringBuilder tsHeader = new StringBuilder();
|
||||
|
@ -71,13 +69,6 @@ public class TsOutput {
|
|||
if (configField.getComment() != null && configField.getComment().trim().length() > 0 && cs == null) {
|
||||
String commentContent = configField.getCommentTemplated();
|
||||
commentContent = ConfigField.unquote(commentContent);
|
||||
int newLineIndex = commentContent.indexOf("\\n");
|
||||
if (newLineIndex != -1) {
|
||||
// we might have detailed long comment for header javadoc but need a short field name for logs/rusEFI online
|
||||
commentContent = commentContent.substring(0, newLineIndex);
|
||||
}
|
||||
if (!isConstantsSection && commentContent.length() > MSQ_LENGTH_LIMIT)
|
||||
throw new IllegalStateException("[" + commentContent + "] is too long for rusEFI online at " + commentContent.length());
|
||||
settingContextHelp.append("\t" + nameWithPrefix + " = " + quote(commentContent) + EOL);
|
||||
}
|
||||
|
||||
|
|
|
@ -191,7 +191,7 @@ public class OutputsTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testLongIterate() {
|
||||
public void testLongTooltipsIterate() {
|
||||
ReaderState state = new ReaderState();
|
||||
String test = "struct total\n" +
|
||||
"\tint[3 iterate] triggerSimulatorPins;Each rusEFI piece can provide synthetic trigger signal for external ECU. Sometimes these wires are routed back into trigger inputs of the same rusEFI board.\\nSee also directSelfStimulation which is different.\n" +
|
||||
|
@ -199,9 +199,9 @@ public class OutputsTest {
|
|||
TestTSProjectConsumer tsProjectConsumer = new TestTSProjectConsumer("", state);
|
||||
state.readBufferedReader(test, tsProjectConsumer);
|
||||
assertEquals(
|
||||
"\ttriggerSimulatorPins1 = \"Each rusEFI piece can provide synthetic trigger signal for external ECU. Sometimes these wires are routed back into trigger inputs of the same rusEFI board.\"\n" +
|
||||
"\ttriggerSimulatorPins2 = \"Each rusEFI piece can provide synthetic trigger signal for external ECU. Sometimes these wires are routed back into trigger inputs of the same rusEFI board.\"\n" +
|
||||
"\ttriggerSimulatorPins3 = \"Each rusEFI piece can provide synthetic trigger signal for external ECU. Sometimes these wires are routed back into trigger inputs of the same rusEFI board.\"\n", tsProjectConsumer.getSettingContextHelpForUnitTest());
|
||||
"\ttriggerSimulatorPins1 = \"Each rusEFI piece can provide synthetic trigger signal for external ECU. Sometimes these wires are routed back into trigger inputs of the same rusEFI board.\\nSee also directSelfStimulation which is different. 1\"\n" +
|
||||
"\ttriggerSimulatorPins2 = \"Each rusEFI piece can provide synthetic trigger signal for external ECU. Sometimes these wires are routed back into trigger inputs of the same rusEFI board.\\nSee also directSelfStimulation which is different. 2\"\n" +
|
||||
"\ttriggerSimulatorPins3 = \"Each rusEFI piece can provide synthetic trigger signal for external ECU. Sometimes these wires are routed back into trigger inputs of the same rusEFI board.\\nSee also directSelfStimulation which is different. 3\"\n", tsProjectConsumer.getSettingContextHelpForUnitTest());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
|
|
Loading…
Reference in New Issue