diff options
author | Sutou Kouhei <[email protected]> | 2021-04-20 11:11:16 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2021-07-13 19:37:45 +0900 |
commit | 5516d74ad2465ec98a09f80337a2ff9a78ba22c6 (patch) | |
tree | 2abe6654ee86055b18b4fab15b609c670a3f9b69 /test | |
parent | 303ab5da8b34faf6b4b608f1f7512dfd08544cc8 (diff) |
[ruby/fiddle] test: add a test for win32_last_socket_error
https://github.com/ruby/fiddle/commit/c86cec03cd
Diffstat (limited to 'test')
-rw-r--r-- | test/fiddle/test_function.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/fiddle/test_function.rb b/test/fiddle/test_function.rb index 842221c91f..5d41477b9f 100644 --- a/test/fiddle/test_function.rb +++ b/test/fiddle/test_function.rb @@ -9,7 +9,10 @@ module Fiddle def setup super Fiddle.last_error = nil - Fiddle.win32_last_error = nil if WINDOWS + if WINDOWS + Fiddle.win32_last_error = nil + Fiddle.win32_last_socket_error = nil + end end def test_default_abi @@ -106,6 +109,17 @@ module Fiddle set_last_error.call(n) assert_equal(n, Fiddle.win32_last_error) end + + def test_win32_last_socket_error + ws2_32 = Fiddle.dlopen("ws2_32") + args = [ws2_32["WSASetLastError"], [TYPE_INT], TYPE_VOID] + args << Function::STDCALL if Function.const_defined?(:STDCALL) + wsa_set_last_error = Function.new(*args) + assert_nil(Fiddle.win32_last_socket_error) + n = 1 << 29 | 1 + wsa_set_last_error.call(n) + assert_equal(n, Fiddle.win32_last_socket_error) + end end def test_strcpy |