[pypy-commit] cffi default: Additional test for this case

arigo noreply at buildbot.pypy.org
Sun Aug 12 23:51:20 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r836:c0ca0cf9f274
Date: 2012-08-12 23:51 +0200
http://bitbucket.org/cffi/cffi/changeset/c0ca0cf9f274/

Log:	Additional test for this case

diff --git a/c/test_c.py b/c/test_c.py
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -944,6 +944,16 @@
     stderr = ll.read_variable(BVoidP, "stderr")
     assert stderr == cast(BVoidP, _testfunc(8))
 
+def test_read_variable_as_unknown_length_array():
+    if sys.platform == 'win32':
+        py.test.skip("untested")
+    BCharP = new_pointer_type(new_primitive_type("char"))
+    BArray = new_array_type(BCharP, None)
+    ll = find_and_load_library('c')
+    stderr = ll.read_variable(BArray, "stderr")
+    assert repr(stderr).startswith("<cdata 'char *' 0x")
+    # ^^ and not 'char[]', which is basically not allowed and would crash
+
 def test_write_variable():
     if sys.platform == 'win32':
         py.test.skip("untested")


More information about the pypy-commit mailing list