summaryrefslogtreecommitdiffstats
path: root/clang/tools/scan-build-py/tests/unit/fixtures.py
diff options
context:
space:
mode:
authorLaszlo Nagy <rizsotto.mailinglist@gmail.com>2016-01-12 22:38:41 +0000
committerLaszlo Nagy <rizsotto.mailinglist@gmail.com>2016-01-12 22:38:41 +0000
commitbc68758dd5b3a4e15c23572e9b1ece7abbb2455b (patch)
treeb1477b7fe2d62e9053769134bd25c7384c04f5c3 /clang/tools/scan-build-py/tests/unit/fixtures.py
parent7bee31689049dd825ff390fa30fe3645f2d87877 (diff)
downloadbcm5719-llvm-bc68758dd5b3a4e15c23572e9b1ece7abbb2455b.tar.gz
bcm5719-llvm-bc68758dd5b3a4e15c23572e9b1ece7abbb2455b.zip
D9600: Add scan-build python implementation
llvm-svn: 257533
Diffstat (limited to 'clang/tools/scan-build-py/tests/unit/fixtures.py')
-rw-r--r--clang/tools/scan-build-py/tests/unit/fixtures.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/clang/tools/scan-build-py/tests/unit/fixtures.py b/clang/tools/scan-build-py/tests/unit/fixtures.py
new file mode 100644
index 00000000000..d80f5e64774
--- /dev/null
+++ b/clang/tools/scan-build-py/tests/unit/fixtures.py
@@ -0,0 +1,40 @@
+# -*- 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 contextlib
+import tempfile
+import shutil
+import unittest
+
+
+class Spy(object):
+ def __init__(self):
+ self.arg = None
+ self.success = 0
+
+ def call(self, params):
+ self.arg = params
+ return self.success
+
+
+@contextlib.contextmanager
+def TempDir():
+ name = tempfile.mkdtemp(prefix='scan-build-test-')
+ try:
+ yield name
+ finally:
+ shutil.rmtree(name)
+
+
+class TestCase(unittest.TestCase):
+ def assertIn(self, element, collection):
+ found = False
+ for it in collection:
+ if element == it:
+ found = True
+
+ self.assertTrue(found, '{0} does not have {1}'.format(collection,
+ element))
OpenPOWER on IntegriCloud