Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PP_NUMBER, remove CPP_INTEGER, CPP_FLOAT #80

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions tests/issue0079.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from __future__ import absolute_import, print_function
import unittest, time
try:
from StringIO import StringIO
except ImportError:
from io import StringIO

class runner(object):
def runTest(self):
from pcpp import Preprocessor, OutputDirective, Action
import os, sys, re

p = Preprocessor()
p.parse(self.input)
oh = StringIO()
willwray marked this conversation as resolved.
Show resolved Hide resolved
p.write(oh)
print("ok")
if oh.getvalue() != self.output:
print("Should be:\n" + self.output + "EOF\n", file = sys.stderr)
print("\nWas:\n" + oh.getvalue()+"EOF\n", file = sys.stderr)
self.assertEqual(p.return_code, 0)
self.assertEqual(oh.getvalue(), self.output)

class pp_number_pasting(unittest.TestCase, runner):
input = r"""#define CAT_(A,B)A##B
willwray marked this conversation as resolved.
Show resolved Hide resolved
#define CAT(A,B)CAT_(A,B)
#define Ox 0x
#if CAT(Ox,1)
PP_NUMBER pasted ok
#else
PP_NUMBER paste fail
#endif
"""
output = r"""
willwray marked this conversation as resolved.
Show resolved Hide resolved



PP_NUMBER pasted ok
"""