mirror of
https://github.com/rizsotto/scan-build.git
synced 2025-12-21 12:19:29 +01:00
33 lines
993 B
Python
33 lines
993 B
Python
# -*- coding: utf-8 -*-
|
|
# The LLVM Compiler Infrastructure
|
|
#
|
|
# This file is distributed under the University of Illinois Open Source
|
|
# License. See LICENSE.TXT for details.
|
|
|
|
import libscanbuild.clang as sut
|
|
from . import fixtures
|
|
import os.path
|
|
|
|
|
|
class GetClangArgumentsTest(fixtures.TestCase):
|
|
|
|
def test_get_clang_arguments(self):
|
|
with fixtures.TempDir() as tmpdir:
|
|
filename = os.path.join(tmpdir, 'test.c')
|
|
with open(filename, 'w') as handle:
|
|
handle.write('')
|
|
|
|
result = sut.get_arguments(
|
|
tmpdir,
|
|
['clang', '-c', filename, '-DNDEBUG', '-Dvar="this is it"'])
|
|
|
|
self.assertIn('NDEBUG', result)
|
|
self.assertIn('var="this is it"', result)
|
|
|
|
def test_get_clang_arguments_fails(self):
|
|
self.assertRaises(
|
|
Exception,
|
|
sut.get_arguments,
|
|
'.',
|
|
['clang', '-###', '-fsyntax-only', '-x', 'c', 'notexist.c'])
|