Ejemplo n.º 1
0
 def runTest(self):
     if sys.version_info.major >= 3:
         from pcpp import CmdPreprocessor
         if self.multiple:
             p = CmdPreprocessor([
                 'pcpp', '-o', 'tests/alternate_input_encodings.c',
                 '--assume-input-encoding', 'utf_16_le',
                 '--output-encoding', 'utf_8',
                 'tests/alternate_input_encodings1_ucs16le.c',
                 'tests/alternate_input_encodings2_ucs16le.c'
             ])
         else:
             p = CmdPreprocessor([
                 'pcpp', '-o', 'tests/alternate_input_encodings.c',
                 '--assume-input-encoding', 'utf_16_le',
                 '--output-encoding', 'utf_8',
                 'tests/alternate_input_encodings1_ucs16le.c'
             ])
         with io.open('tests/alternate_input_encodings.c',
                      'rt',
                      encoding='utf-8') as ih:
             output = ih.read()
         if output != self.shouldbe:
             print("Should be:\n" + repr(self.shouldbe) + "EOF\n",
                   file=sys.stderr)
             print("\nWas:\n" + repr(output) + "EOF\n", file=sys.stderr)
         self.assertEqual(p.return_code, 0)
         self.assertEqual(output, self.shouldbe)
Ejemplo n.º 2
0
 def runTest(self):
     from pcpp import CmdPreprocessor
     p = CmdPreprocessor(['pcpp'] + self.options +
                         ['-o', 'tests/issue0063.i', 'tests/issue0063.c'])
     with open('tests/issue0063.i', 'rt') as ih:
         output = ih.read()
     if output != self.shouldbe:
         print("Should be:\n" + self.shouldbe + "EOF\n", file=sys.stderr)
         print("\nWas:\n" + output + "EOF\n", file=sys.stderr)
     self.assertEqual(p.return_code, 0)
     self.assertEqual(output, self.shouldbe)
Ejemplo n.º 3
0
 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)
Ejemplo n.º 4
0
 def runTest(self):
     from pcpp import CmdPreprocessor
     # failure: p = CmdPreprocessor(['pcpp', '--line-directive', '#line',
     # p = CmdPreprocessor(['pcpp', '--line-directive', 'nothing',
     # p = CmdPreprocessor(['pcpp', '--line-directive', 'None',
     p = CmdPreprocessor([
         'pcpp', '--line-directive', '', '-o', 'tests/issue0044.i',
         'tests/issue0044.h'
     ])
     with open('tests/issue0044.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)
Ejemplo n.º 5
0
 def runTest(self):
     from pcpp import CmdPreprocessor
     p = CmdPreprocessor(['pcpp', '--time',
                          'tests/issue0030/source1.c'])
     self.assertEqual(p.return_code, 0)