Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-111014

QTest backslash escape issue

    XMLWordPrintable

Details

    • af4cd4763 (dev), 2d26b07ff (6.5)

    Description

       QTest::newRow("test_name") << url.search << "?a=\\"; 

      has an issue with escaping bashslashes.

      The last string contains two backslashes where the first one escapes the second one. I would expect the bytes of the string to be ['?', 'a', '=', '\\', '\0'] but instead the returned value is

      "?a=\\"

      When taking a look at the first few function calls it seems the string is parsed properly with only one backslash. It is deeper inside the QTest machinery that something goes wrong. The position of the (doubled) backslash does not seem to matter.

      Here is a complete example:

      void tst_urlobject::urlObject_search_data()
      {   
          QTest::addColumn<QString>("test");
          QTest::addColumn<QString>("expected");
      	QTest::newRow("Question mark")
                  << url.search
                  << "?a=\\";
      }
      

      (The reporter's description is in the attached bugreport.txt file as the backslashes mess with the interface and make things very confusing. The above is Eddy's best effort at working round Jira's eccentricities.)

      The printed output for the expected column:

      Attachments

        1. bugreport.txt
          0.8 kB
        2. file2.txt
          0.9 kB
        3. image-2023-02-08-09-58-54-413.png
          image-2023-02-08-09-58-54-413.png
          3 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtqmlteam Qt Qml Team User
            olivier.decanniere Olivier De Cannière
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes