mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/fiddle] test: add a test for win32_last_socket_error
https://github.com/ruby/fiddle/commit/c86cec03cd
This commit is contained in:
parent
303ab5da8b
commit
5516d74ad2
1 changed files with 15 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue