Skip socket tests on Windows platform.
Some test may be OK but we skip everything as a starting point.
MODIFY
mrbgems/mruby-socket/test/ipsocket.rb
mrbgems/mruby-socket/test/ipsocket.rb
+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?

MODIFY
mrbgems/mruby-socket/test/socket.rb
mrbgems/mruby-socket/test/socket.rb
+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?

MODIFY
mrbgems/mruby-socket/test/sockettest.c
mrbgems/mruby-socket/test/sockettest.c
@@ -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());
}

MODIFY
mrbgems/mruby-socket/test/unix.rb
mrbgems/mruby-socket/test/unix.rb
+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?

Skip socket tests on Windows platform.

Some test may be OK but we skip everything as a starting point.