function testForUnwantedRegExpChanges(testFunc) {
  regExpProperties.forEach(function (property) {
    RegExp[property] = regExpPropertiesDefaultValues[property];
  });
  testFunc();
  regExpProperties.forEach(function (property) {
    if (RegExp[property] !== regExpPropertiesDefaultValues[property]) {
      $ERROR("RegExp has unexpected property " + property + " with value " +
        RegExp[property] + ".");
    }
  });
}
Tests that executing the provided function (which may use regular expressions
in its implementation) does not create or modify unwanted properties on the
RegExp constructor.