How to use the pcpp.CmdPreprocessor function in pcpp

To help you get started, we’ve selected a few pcpp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ned14 / pcpp / tests / issue0037.py View on Github external
def runTest(self):
        from pcpp import CmdPreprocessor
        p = CmdPreprocessor(['pcpp', '--time', '--passthru-comments',
                             '-o', 'tests/issue0037.i',
                             'tests/issue0037/inc.h'])
        with open('tests/issue0037.i', 'rt') as ih:
            output = ih.read()
        if output != shouldbe:
            print("Should be:\n" + shouldbe + "EOF\n", file = sys.stderr)
            print("\nWas:\n" + output + "EOF\n", file = sys.stderr)
        self.assertEqual(p.return_code, 0)
        self.assertEqual(output, shouldbe)