From 16c52b68c8a65dc6823aa9b128644753d0e4ea04 Mon Sep 17 00:00:00 2001 From: rusefi Date: Fri, 10 Apr 2020 17:05:33 -0400 Subject: [PATCH] set_fsio_expression issues reported by Jimmy lunztel --- .../ui/src/com/rusefi/ui/widgets/AnyCommand.java | 4 ++-- .../src/com/rusefi/ui/widgets/test/AnyCommandTest.java | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/java_console/ui/src/com/rusefi/ui/widgets/AnyCommand.java b/java_console/ui/src/com/rusefi/ui/widgets/AnyCommand.java index 1e00820836..53ef69f4e7 100644 --- a/java_console/ui/src/com/rusefi/ui/widgets/AnyCommand.java +++ b/java_console/ui/src/com/rusefi/ui/widgets/AnyCommand.java @@ -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 diff --git a/java_console/ui/src/com/rusefi/ui/widgets/test/AnyCommandTest.java b/java_console/ui/src/com/rusefi/ui/widgets/test/AnyCommandTest.java index 29b97a4e07..869c6f0454 100644 --- a/java_console/ui/src/com/rusefi/ui/widgets/test/AnyCommandTest.java +++ b/java_console/ui/src/com/rusefi/ui/widgets/test/AnyCommandTest.java @@ -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”")); + } }