set_fsio_expression issues reported by Jimmy lunztel
This commit is contained in:
parent
99bb149a1c
commit
e25b6639bd
|
@ -119,7 +119,7 @@ public class AnyCommand {
|
||||||
try {
|
try {
|
||||||
if (rawCommand.startsWith("eval ")) {
|
if (rawCommand.startsWith("eval ")) {
|
||||||
return prepareEvalCommand(rawCommand);
|
return prepareEvalCommand(rawCommand);
|
||||||
} else if (rawCommand.startsWith("set_fsio_expression ")) {
|
} else if (rawCommand.toLowerCase().startsWith("set_fsio_expression ")) {
|
||||||
return prepareSetFsioCommand(rawCommand);
|
return prepareSetFsioCommand(rawCommand);
|
||||||
} else {
|
} else {
|
||||||
return rawCommand;
|
return rawCommand;
|
||||||
|
@ -154,7 +154,7 @@ public class AnyCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String unquote(String quoted) {
|
public static String unquote(String quoted) {
|
||||||
quoted = quoted.trim();
|
quoted = quoted.trim().replace('“', '"').replace('”', '"');
|
||||||
if (quoted.charAt(0) == '"')
|
if (quoted.charAt(0) == '"')
|
||||||
return quoted.substring(1, quoted.length() - 1);
|
return quoted.substring(1, quoted.length() - 1);
|
||||||
return quoted; // ignoring invalid input
|
return quoted; // ignoring invalid input
|
||||||
|
|
|
@ -25,4 +25,13 @@ public class AnyCommandTest {
|
||||||
// todo: parameter order needs to be in postfix form
|
// 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\""));
|
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