-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #17 Fix failure to issue
#line
directive for first include …
…file in a file. Thanks to Sei-Lisa for reporting this.
- Loading branch information
Showing
4 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
#line 1 "tests/issue0017/issue0017.c" | ||
#line 1 "inc.h" | ||
inc1 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from __future__ import absolute_import, print_function | ||
import unittest | ||
|
||
class issue0017(unittest.TestCase): | ||
def runTest(self): | ||
from pcpp import Preprocessor | ||
import os, sys | ||
|
||
p = Preprocessor() | ||
path = 'tests/issue0017/issue0017.c' | ||
with open(path, 'rt') as ih: | ||
p.parse(ih.read(), path) | ||
with open('tests/issue0017.i', 'w') as oh: | ||
p.write(oh) | ||
with open('tests/issue0017.i', 'r') as ih: | ||
was = ih.read() | ||
with open('tests/issue0017-ref.i', 'r') as ih: | ||
shouldbe = ih.read() | ||
if was != shouldbe: | ||
print("Should be:\n" + shouldbe, file = sys.stderr) | ||
print("\n\nWas:\n" + was, file = sys.stderr) | ||
self.assertEqual(p.return_code, 0) | ||
self.assertEqual(was, shouldbe) |