Possible bug in string and char concatenation using Arduino 1.8.10 Linux. But if you replace the chars with strings the aoutput is OK.
For instance, you could try the piece of code:
#line 2 "concat.ino"
#include <ArduinoUnit.h>
test(concat){
byte n = 3;
char col[n] = {'R','G','B'};
char tag[n] = {'r','s','t'};
String strChar = "";
//String and char concatenation, possible bug
for (byte i=0; i<n; i++) {
strChar += '\n'+col[i]+"= "+tag[i];
}
//Serial.println(strChar);
//String concatenation is OK
String colStr[n] = {"R","G","B"};
String tagStr[n] = {"r","s","t"};
String str = "";
for (byte i=0; i<n; i++) {
str += '\n'+colStr[i]+"= "+tagStr[i];
}
//Serial.println(str);
assertEqual(strChar, str);
}
void setup(){
Serial.begin(9600);
while(!Serial) {} // Portability for Leonardo/Micro
}
void loop(){
Test::run();
}
I get the output:
Assertion failed: (strChar=.) == (str=
R= r
G= s
B= t), file concat.ino, line 24.
Test concat failed
Test summary: 0 passed, 1 failed, 0 skipped, out of 1 test(s).
Best regards.