[pypy-commit] cffi default: One of the Windows common types was lost somehow. Add a test
arigo
noreply at buildbot.pypy.org
Tue Nov 3 03:24:08 EST 2015
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r2371:427021f52c7f
Date: 2015-11-03 09:25 +0100
http://bitbucket.org/cffi/cffi/changeset/427021f52c7f/
Log: One of the Windows common types was lost somehow. Add a test that
at least dependencies are there.
diff --git a/c/commontypes.c b/c/commontypes.c
--- a/c/commontypes.c
+++ b/c/commontypes.c
@@ -31,6 +31,7 @@
EQ("FLOAT", "float"),
EQ("HACCEL", "HANDLE"),
EQ("HALF_PTR", W32_64("short","int")),
+ EQ("HANDLE", "PVOID"),
EQ("HBITMAP", "HANDLE"),
EQ("HBRUSH", "HANDLE"),
EQ("HCOLORSPACE", "HANDLE"),
diff --git a/testing/cffi1/test_commontypes.py b/testing/cffi1/test_commontypes.py
--- a/testing/cffi1/test_commontypes.py
+++ b/testing/cffi1/test_commontypes.py
@@ -1,14 +1,30 @@
-import py, os, cffi
+import py, os, cffi, re
import _cffi_backend
-def test_alphabetical_order():
+def getlines():
f = open(os.path.join(os.path.dirname(cffi.__file__),
'..', 'c', 'commontypes.c'))
lines = [line for line in f.readlines() if line.strip().startswith('EQ(')]
f.close()
+ return lines
+
+def test_alphabetical_order():
+ lines = getlines()
assert lines == sorted(lines)
+def test_dependencies():
+ r = re.compile(r'EQ[(]"([^"]+)",(?:\s*"([A-Z0-9_]+)\s*[*]*"[)])?')
+ lines = getlines()
+ d = {}
+ for line in lines:
+ match = r.search(line)
+ if match is not None:
+ d[match.group(1)] = match.group(2)
+ for value in d.values():
+ if value:
+ assert value in d
+
def test_get_common_types():
d = {}
_cffi_backend._get_common_types(d)
More information about the pypy-commit
mailing list