Quelle check-missing-export-asserts.py
Sprache: Python
#!/usr/bin/env python3
# This file is part of the LibreOffice project. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/.
import re import os from subprocess import Popen, DEVNULL, PIPE import logging import sys
if line.startswith('DECLARE'): try:
testName = re.findall('"([^"]*)"', line)[0] except Exception: #check in the next line when line is broken into 2 lines
testName = re.findall('"([^"]*)"', lines[i + 1])[0]
if testName in results:
results[testName]['index'] = i
elif'getPages'in line: if testName in results:
results[testName]['checkPages'] = True elif'getShapes'in line: if testName in results:
results[testName]['checkShapes'] = True
total = 0 for i in results.values(): ifnot i['checkPages'] and int(i['pages']) >= 1:
total += 1
lines.insert(i['index'] + 2, " CPPUNIT_ASSERT_EQUAL(" + str(i['pages']) + ", getPages());\n")
ifnot i['checkShapes'] and int(i['shapes']) >= 1:
total += 1
lines.insert(i['index'] + 2, " CPPUNIT_ASSERT_EQUAL(" + str(i['shapes']) + ", getShapes());\n")
logger.info(str(total) + ' missing asserts added in ' + fileName)
addText = False # Add code to check import and export pages for i in range(len(modelTestLines)):
line = modelTestLines[i] if line.strip().startswith('void'): if'executeLoadVerifyReloadVerify'in line or \ 'executeLoadReloadVerify'in line:
addText = True else:
addText = False
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.