I was writing a test today and QtTest told me:

   Actual   (s) : ?12???
   Expected (s2): ?12???

So I went, "duh, ok, it looks the same to me but what's behind those question 
marks".

After a bit of changes [https://codereview.qt-project.org/76100], it now 
prints:

   Actual   (s) : \u221212\u20A0\uD800\uDC00
   Expected (s2): \u221212\u20AC\uD800\uDC00

Which tells me what I got wrong.

Ok to submit this change then? It will make all toString(QString) print

 - all backslashes as \\
 - the following characters as their escape sequences: \r, \n, \t, \b, \f
 - all other control characters (including 0x7f) as \u00XX
 - all other characters with \uXXXX, including text otherwise readable in the 
   terminal in the locale

One major advantage of this is that it does not depend on the locale codec 
being set up or even working, as the previous code did. So we get consistent 
results even if there's a bug in that.

Is this ok?

Should I also print quotes as \" ? And should I surround the string with 
quotes?

Should I also do the same for QByteArray? Reading hex dumps isn't very nice.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to