[Win32utils-devel] Working on FFI win32-api again

Daniel Berger djberg96 at gmail.com
Wed Jul 15 09:51:37 EDT 2009


I've been working on the FFI version of win32-api again and I've got the
basic test down to 2 errors using JRuby 1.3.1.

You can checkout the latest win32-api and look at lib/ffi/win32/api.rb:

c:\Users\djberge\workspace\win32-api>jake test
(in C:/Users/djberge/workspace/win32-api)
c:/jruby/bin/../bin/jruby.bat -w -I"lib;lib/ffi"
b" "test/test_win32_api.rb"
Loaded suite

Finished in 1.386 seconds.

  1) Failure:
test_call_expected_failures(TC_Win32_API) [test/test_win32_api.rb:114]:
<TypeError> exception expected but was
Class: <RangeError>
Message: <"Value test is not an integer">
test/test_win32_api.rb:114:in `test_call_expected_failures'
test/test_win32_api.rb:114:in `test_call_expected_failures'

  2) Failure:
test_call_with_void(TC_Win32_API) [test/test_win32_api.rb:41]:
Exception raised:
Class: <ArgumentError>
Message: <"wrong number of arguments(1 for 0)">
test/test_win32_api.rb:41:in `test_call_with_void'
test/test_win32_api.rb:41:in `test_call_with_void'

17 tests, 41 assertions, 2 failures, 0 errors, 0 pendings, 0 omissions, 0

The first failure is coming from this:

assert_raise(TypeError){ @gcd.call('test', @buf) }

Here I'm passing a string 'test' instead of a long. This may be an issue
with FFI itself, so I'm not sure if we can fix it.

The second failure is coming from this:
assert_nothing_raised{ @gle.call(nil) }

Here I'm passing an explicit nil for a void parameter. Again, maybe FFI
simply doesn't allow this.



More information about the win32utils-devel mailing list