2019-05-03 20:19:28 +02:00
|
|
|
|
|
|
|
# python -m pytest test-inline-suppress.py
|
|
|
|
|
|
|
|
import os
|
|
|
|
import re
|
|
|
|
from testutils import cppcheck
|
|
|
|
|
|
|
|
def test1():
|
2020-09-11 18:29:42 +02:00
|
|
|
ret, stdout, stderr = cppcheck(['--inline-suppr', 'proj-inline-suppress'])
|
2019-05-03 20:19:28 +02:00
|
|
|
assert ret == 0
|
2020-09-10 21:46:15 +02:00
|
|
|
assert stderr == ''
|
2019-05-03 20:19:28 +02:00
|
|
|
|
|
|
|
def test2():
|
2020-09-11 18:29:42 +02:00
|
|
|
ret, stdout, stderr = cppcheck(['proj-inline-suppress'])
|
2019-05-03 20:19:28 +02:00
|
|
|
assert ret == 0
|
|
|
|
assert len(stderr) > 0
|
|
|
|
|
2019-08-17 17:49:22 +02:00
|
|
|
def test_unmatched_suppression():
|
2019-08-17 17:51:48 +02:00
|
|
|
ret, stdout, stderr = cppcheck(['--inline-suppr', '--enable=information', '--error-exitcode=1', 'proj-inline-suppress/2.c'])
|
2019-08-17 17:49:22 +02:00
|
|
|
assert ret == 1
|
|
|
|
assert 'Unmatched suppression: some_warning_id' in stderr
|
2020-07-30 22:22:54 +02:00
|
|
|
|
2020-08-03 10:30:21 +02:00
|
|
|
def test_unmatched_suppression_path_with_extra_stuf():
|
2020-07-30 22:22:54 +02:00
|
|
|
ret, stdout, stderr = cppcheck(['--inline-suppr', '--enable=information', '--error-exitcode=1', './proj-inline-suppress/2.c'])
|
|
|
|
assert ret == 1
|
|
|
|
assert 'Unmatched suppression: some_warning_id' in stderr
|