File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,26 @@ describe SystemError do
18
18
19
19
it " avoid reset from message" do
20
20
Errno .value = :ENOENT
21
- error = ::RuntimeError .from_errno(message: " foobar" .tap { Errno .value = :EPERM })
21
+ error = ::RuntimeError .from_errno(" foobar" .tap { Errno .value = :EPERM })
22
22
error.os_error.should eq Errno ::ENOENT
23
23
end
24
24
end
25
+
26
+ {% if flag?(:win32 ) % }
27
+ describe " .from_winerror" do
28
+ it " avoid reset from message" do
29
+ WinError .value = :ERROR_FILE_NOT_FOUND
30
+ error = ::RuntimeError .from_winerror(" foobar" .tap { WinError .value = :ERROR_ACCESS_DENIED })
31
+ error.os_error.should eq WinError ::ERROR_ACCESS_DENIED # This should be ERROR_FILE_NOT_FOUND
32
+ end
33
+ end
34
+
35
+ describe " .from_wsa_error" do
36
+ it " avoid reset from message" do
37
+ WinError .wsa_value = :ERROR_FILE_NOT_FOUND
38
+ error = ::RuntimeError .from_wsa_error(" foobar" .tap { WinError .wsa_value = :ERROR_ACCESS_DENIED })
39
+ error.os_error.should eq WinError ::ERROR_ACCESS_DENIED # This should be ERROR_FILE_NOT_FOUND
40
+ end
41
+ end
42
+ {% end % }
25
43
end
Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ module SystemError
133
133
134
134
@[Deprecated (" Use `.from_os_error` instead" )]
135
135
def from_winerror (* , winerror : WinError = WinError .value, ** opts)
136
- from_os_error(message , winerror, ** opts)
136
+ from_os_error(nil , winerror, ** opts)
137
137
end
138
138
{% end % }
139
139
end
You can’t perform that action at this time.
0 commit comments