set_fsio_expression issues reported by Jimmy lunztel
This commit is contained in:
parent
1bea04a2ed
commit
16c52b68c8
|
@ -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
|
||||
|
|
|
@ -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”"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue