set_fsio_expression issues reported by Jimmy lunztel

This commit is contained in:
rusefi 2020-04-10 17:05:33 -04:00
parent 99bb149a1c
commit e25b6639bd
2 changed files with 11 additions and 2 deletions

View File

@ -119,7 +119,7 @@ public class AnyCommand {
try {
if (rawCommand.startsWith("eval ")) {
return prepareEvalCommand(rawCommand);
} else if (rawCommand.startsWith("set_fsio_expression ")) {
} else if (rawCommand.toLowerCase().startsWith("set_fsio_expression ")) {
return prepareSetFsioCommand(rawCommand);
} else {
return rawCommand;
@ -154,7 +154,7 @@ public class AnyCommand {
}
public static String unquote(String quoted) {
quoted = quoted.trim();
quoted = quoted.trim().replace('“', '"').replace('”', '"');
if (quoted.charAt(0) == '"')
return quoted.substring(1, quoted.length() - 1);
return quoted; // ignoring invalid input

View File

@ -25,4 +25,13 @@ public class AnyCommandTest {
// todo: parameter order needs to be in postfix form
assertEquals("set_rpn_expression 1 \"rpm fsio_setting 0 >\"", AnyCommand.prepareCommand("set_fsio_expression 1 \"rpm > fsio_setting 0\""));
}
@Test
public void testSetFSIOexpressionWithFunnyQuotes() {
assertEquals("tps > 10", AnyCommand.unquote("\"tps > 10\""));
assertEquals("tps > 10", AnyCommand.unquote("“tps > 10”"));
assertEquals("set_rpn_expression 1 \"tps 10 >\"", AnyCommand.prepareCommand("Set_fsio_expression 1 “tps > 10”"));
}
}