mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Fixed bug in StringReplacer
This commit is contained in:
29
app/test/processing/app/helpers/StringReplacerTest.java
Normal file
29
app/test/processing/app/helpers/StringReplacerTest.java
Normal file
@ -0,0 +1,29 @@
|
||||
package processing.app.helpers;
|
||||
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class StringReplacerTest {
|
||||
|
||||
@Test
|
||||
public void quotingCheck() throws Exception {
|
||||
String in = "a\"bc ab'c 'abc abc' ";
|
||||
in += "\"abc abc\" '\"abc abc\"' ";
|
||||
in += "\"'abc abc'\"";
|
||||
String[] res = StringReplacer.quotedSplit(in, "\"'", false);
|
||||
assertArrayEquals(res, new String[] { "a\"bc", "ab'c", "abc abc",
|
||||
"abc abc", "\"abc abc\"", "'abc abc'" });
|
||||
}
|
||||
|
||||
@Test
|
||||
public void quotingCheckWithEmptyStringsAccepted() throws Exception {
|
||||
String in = "a\"bc ab'c 'abc abc' ";
|
||||
in += "\"abc abc\" '\"abc abc\"' ";
|
||||
in += "\"'abc abc'\"";
|
||||
String[] res = StringReplacer.quotedSplit(in, "\"'", true);
|
||||
assertArrayEquals(res, new String[] { "a\"bc", "ab'c", "", "", "abc abc",
|
||||
"abc abc", "\"abc abc\"", "'abc abc'" });
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user