remove compile_fsio_file fix #3866
This commit is contained in:
parent
87930f540f
commit
f3a2a9c6cb
|
@ -32,8 +32,6 @@ import java.util.function.Function;
|
|||
public class AnyCommand {
|
||||
private final static ThreadFactory THREAD_FACTORY = new NamedThreadFactory("AnyCommand");
|
||||
public static final String KEY = "last_value";
|
||||
// todo: kill while killing FSIO
|
||||
private static final String DECODE_RPN = "decode_rpn";
|
||||
|
||||
private final UIContext uiContext;
|
||||
private final JTextComponent text;
|
||||
|
@ -175,17 +173,6 @@ public class AnyCommand {
|
|||
}).start();
|
||||
}
|
||||
|
||||
private static String quote(String s) {
|
||||
return "\"" + s + "\"";
|
||||
}
|
||||
|
||||
public static String unquote(String quoted) {
|
||||
quoted = quoted.trim().replace('\u201C', '"').replace('\u201D', '"');
|
||||
if (quoted.charAt(0) == '"')
|
||||
return quoted.substring(1, quoted.length() - 1);
|
||||
return quoted; // ignoring invalid input
|
||||
}
|
||||
|
||||
private static boolean isValidInput(String text) {
|
||||
boolean isOk = true;
|
||||
for (char c : text.toCharArray()) {
|
||||
|
@ -233,12 +220,7 @@ public class AnyCommand {
|
|||
});
|
||||
|
||||
final AtomicInteger index = new AtomicInteger();
|
||||
command.listener = new Listener() {
|
||||
@Override
|
||||
public void onSend() {
|
||||
index.set(0);
|
||||
}
|
||||
};
|
||||
command.listener = () -> index.set(0);
|
||||
|
||||
text.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
package com.rusefi.ui.widgets.test;
|
||||
|
||||
import com.rusefi.ui.widgets.AnyCommand;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Andrey Belomutskiy, (c) 2013-2020
|
||||
* 3/9/2017.
|
||||
*/
|
||||
public class AnyCommandTest {
|
||||
private static String prepareCommand(String rawCommand) {
|
||||
return AnyCommand.prepareCommand(rawCommand, null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoExceptionIsThrown() {
|
||||
assertEquals("eval \"2 2 +\"", AnyCommand.prepareEvalCommand("eval \"2 2 +\""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnquote() {
|
||||
assertEquals("1 2 3", AnyCommand.unquote(" \"1 2 3\" "));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrepareEvalCommand() {
|
||||
assertEquals("rpn_eval \"2 3 +\"", prepareCommand("eval \"2 + 3\" "));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetFSIOexpression() {
|
||||
// todo: parameter order needs to be in postfix form
|
||||
assertEquals("set_rpn_expression 1 \"rpm fsio_setting 0 >\"", 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("\u201Ctps > 10\u201D"));
|
||||
|
||||
|
||||
assertEquals("set_rpn_expression 1 \"tps 10 >\"", prepareCommand("Set_fsio_expression 1 \u201Ctps > 10\u201D"));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue