Skip socket tests on Windows platform.

Some test may be OK but we skip everything as a starting point.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2017-12-09 14:22:53 +09:00
parent b103fa229d
commit 761218e70b
4 changed files with 23 additions and 0 deletions
+4
View File
@@ -1,3 +1,5 @@
unless SocketTest.win?
# Note: most of tests below will fail if UDPSocket is broken.
assert('IPSocket.getaddress') do
@@ -38,3 +40,5 @@ assert('IPSocket.peeraddr') do
server.close
true
end
end # win?
+4
View File
@@ -1,3 +1,5 @@
unless SocketTest.win?
assert('Socket.gethostname') do
assert_true(Socket.gethostname.is_a? String)
end
@@ -32,3 +34,5 @@ assert('Socket#recvfrom') do
c.close rescue nil
end
end
end # win?
+11
View File
@@ -12,9 +12,20 @@ mrb_sockettest_tmppath(mrb_state *mrb, mrb_value klass)
return str;
}
mrb_value
mrb_sockettest_win_p(mrb_state *mrb, mrb_value klass)
{
#ifdef _WIN32
return mrb_true_value();
#else
return mrb_false_value();
#endif
}
void
mrb_mruby_socket_gem_test(mrb_state* mrb)
{
struct RClass *c = mrb_define_module(mrb, "SocketTest");
mrb_define_class_method(mrb, c, "tmppath", mrb_sockettest_tmppath, MRB_ARGS_NONE());
mrb_define_class_method(mrb, c, "win?", mrb_sockettest_win_p, MRB_ARGS_NONE());
}
+4
View File
@@ -1,3 +1,5 @@
unless SocketTest.win?
def unixserver_test_block
path = SocketTest.tmppath
File.unlink path rescue nil
@@ -124,3 +126,5 @@ assert('UNIXSocket#recvfrom') do
# a[1][1] would be "" or something
end
end
end # win?