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

Regex does return null every second time it is executed

    XMLWordPrintable

Details

    Description

      The following unit test shows a bug in regexp execution in QML. The first time the regexp is executed it matches and returns the matches. The second time null is returned.

      import QtQuick 2.0 
      import QtTest 1.0
      
      TestCase {
          name: "Regexp"
      
      
      
          function test_match() {
              var regexp = /CC_(\d+)/g;
              var data = "O__131458;OC_131444;C__131426;CC_131428;";
      
              verify(regexp.exec(data) !== null, "test regexp1");
              verify(regexp.exec(data) !== null, "test regexp2");
              verify(regexp.exec(data) !== null, "test regexp3");
              verify(regexp.exec(data) !== null, "test regexp4");
              verify(regexp.exec(data) !== null, "test regexp5");
          }
      }

       

      ********* Start testing of qmltest *********
      Config: Using QtTest library 5.6.2, Qt 5.6.2 (i386-little_endian-ilp32 shared (dynamic) debug build; by MSVC 2013)
      PASS   : qmltest::Regexp::initTestCase()
      FAIL!  : qmltest::Regexp::test_match() 'test regexp2' returned FALSE. ()
      C:\projects\gitRS\PROG-5.00\kratos\kratos\build-src-Desktop_Qt_5_6_2_MSVC2013_32bit-Debug\external_build\test\QmlTest\Debug\qml\test\general\tst_Regexp.qml(14) : failure location
      PASS   : qmltest::Regexp::cleanupTestCase()
      Totals: 2 passed, 1 failed, 0 skipped, 0 blacklisted
      ********* Finished testing of qmltest *********
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              shausman Simon Hausmann
              linux_fan_dave David Feurle
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes