Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r1026:bdfa3c65f051 Date: 2012-11-04 11:12 +0100 http://bitbucket.org/cffi/cffi/changeset/bdfa3c65f051/
Log: A Win32 test diff --git a/c/test_c.py b/c/test_c.py --- a/c/test_c.py +++ b/c/test_c.py @@ -2346,3 +2346,22 @@ data = posix.read(fdr, 256) assert data == b"Xhello\n" posix.close(fdr) + +def test_GetLastError(): + if sys.platform != "win32": + py.test.skip("GetLastError(): only for Windows") + # + lib = find_and_load_library('KERNEL32') + BInt = new_primitive_type("int") + BVoid = new_void_type() + BFunc1 = new_function_type((BInt,), BVoid, False) + BFunc2 = new_function_type((), BInt, False) + SetLastError = lib.load_function(BFunc1, "SetLastError") + GetLastError = lib.load_function(BFunc2, "GetLastError") + # + SetLastError(42) + # a random function that will reset the real GetLastError() to 0 + import posix; posix.stat('.') + # + res = GetLastError() + assert res == 42 _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit