From 0e4f8ae855a54142e812b4604eca20f186db9fe4 Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Tue, 31 Aug 2021 06:11:37 -0700 Subject: Add comments and clean up whitespace --- tests/test_c_generator.py | 2 +- tests/test_util.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/test_c_generator.py b/tests/test_c_generator.py index 0cffa9e..4563523 100644 --- a/tests/test_c_generator.py +++ b/tests/test_c_generator.py @@ -430,7 +430,7 @@ class TestCasttoC(unittest.TestCase): memmgr_path = self._find_file('memmgr.h') ast2 = parse_file(memmgr_path, use_cpp=True, - cpp_path = cpp_path(), cpp_args = cpp_args()) + cpp_path=cpp_path(), cpp_args=cpp_args()) void_ptr_type = ast2.ext[-3].type.type void_type = void_ptr_type.type self.assertEqual(generator.visit(c_ast.Cast(void_ptr_type, test_fun)), diff --git a/tests/test_util.py b/tests/test_util.py index 0b3365c..3ac3886 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -1,14 +1,29 @@ +#------------------------------------------------------------------------------ +# pycparser: test_util.py +# +# Utility code for tests. +# +# Eli Bendersky [https://eli.thegreenplace.net/] +# This file contributed by vit9696@users.noreply.github.com +# License: BSD +#------------------------------------------------------------------------------ import platform + def cpp_supported(): + """Is cpp (the C preprocessor) supported as a native command?""" return platform.system() == 'Linux' or platform.system() == 'Darwin' + def cpp_path(): + """Path to cpp command.""" if platform.system() == 'Darwin': return 'gcc' return 'cpp' + def cpp_args(args=[]): + """Turn args into a suitable format for passing to cpp.""" if isinstance(args, str): args = [args] if platform.system() == 'Darwin': -- cgit v1.2.1