Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 24bf3eb

Browse files
committedJun 19, 2020
Fixed SerialTest on Windows
It looks like that on Windows string builders use a default encoding that is different from UTF-8.
1 parent 720b7a9 commit 24bf3eb

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed
 

‎app/test/processing/app/SerialTest.java

+11-3
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,16 @@ protected void message(char[] chars, int length) {
5151
public void testSerialUTF8Decoder() throws Exception {
5252
NullSerial s = new NullSerial();
5353
// https://github.com/arduino/Arduino/issues/9808
54-
String testdata = "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789°0123456789";
55-
s.processSerialEvent(testdata.getBytes());
56-
assertEquals(s.output, testdata);
54+
byte testData[] = { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51,
55+
52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49,
56+
50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
57+
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55,
58+
56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53,
59+
54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48, 49, 50, 51,
60+
52, 53, 54, 55, 56, 57, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, //
61+
-62, -80, // UTF8 char
62+
48, 49, 50, 51, 52, 53, 54, 55, 56, 57 };
63+
s.processSerialEvent(testData);
64+
assertEquals(new String(testData, "UTF-8"), s.output);
5765
}
5866
}

0 commit comments

Comments
 (0)
Please sign in to comment.