From dba7108832e9783e4b6b914ff95d6674caeef5f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 3 Sep 2020 21:43:26 +0200 Subject: [PATCH] Remove test-clang-import for now so I can fix that --- test/cli/test-clang-import.py | 53 ----------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 test/cli/test-clang-import.py diff --git a/test/cli/test-clang-import.py b/test/cli/test-clang-import.py deleted file mode 100644 index 0af676a4e..000000000 --- a/test/cli/test-clang-import.py +++ /dev/null @@ -1,53 +0,0 @@ - -# python -m pytest test-clang-import.py - -import os -import re -import subprocess -from testutils import create_gui_project_file, cppcheck - - -def get_debug_section(title, stdout): - s = re.sub(r'0x[0-9a-fA-F]+', '0x12345678', stdout) - s = re.sub(r'nestedIn: Struct', 'nestedIn: Class', s) - s = re.sub(r'classDef: struct', 'classDef: class', s) - s = re.sub(r'isInline: [a-z]+', 'isInline: ---', s) - s = re.sub(r'definedType: .*', 'definedType: ---', s) - s = re.sub(r'needInitialization: .*', 'needInitialization: ---', s) - s = re.sub(r'functionOf: .*', 'functionOf: ---', s) - s = re.sub(r'0x12345678 Struct', '0x12345678 Class', s) - pos1 = s.find(title) - assert pos1 > 0 - pos1 = s.find('\n', pos1) + 1 - assert pos1 > 0 - pos2 = s.find("\n##", pos1) - if pos2 < 0: - return s[pos1:] - return s[pos1:pos2-1] - - -def check_symbol_database(code): - # Only compare symboldatabases if clang is found in PATH - try: - subprocess.call(['clang', '--version']) - except OSError: - return - - testfile = 'test.cpp' - with open(testfile, 'w+t') as f: - f.write(code) - ret1, stdout1, stderr1 = cppcheck(['--clang', '--std=c++11', '--debug', '-v', testfile]) - ret2, stdout2, stderr2 = cppcheck(['--std=c++11', '--debug', '-v', testfile]) - os.remove(testfile) - assert get_debug_section('### Symbol database', stdout1) == get_debug_section('### Symbol database', stdout2) - - -def test1(): - check_symbol_database('int main(){return 0;}') - -def test2(): - code = 'struct Foo { void f(); }; void Foo::f() {}' - check_symbol_database(code) - - -