Added simple unix tests.

This commit is contained in:
Diego Nehab 2007-04-09 22:04:13 +00:00
parent be2e467929
commit 37f266ceea
3 changed files with 17 additions and 10 deletions

8
test/unixclnt.lua Normal file
View File

@ -0,0 +1,8 @@
socket = require"socket"
socket.unix = require"socket.unix"
c = assert(socket.unix())
assert(c:connect("/tmp/foo"))
while 1 do
local l = io.read()
assert(c:send(l .. "\n"))
end

9
test/unixsrvr.lua Normal file
View File

@ -0,0 +1,9 @@
socket = require"socket"
socket.unix = require"socket.unix"
u = assert(socket.unix())
assert(u:bind("/tmp/foo"))
assert(u:listen())
c = assert(u:accept())
while 1 do
print(assert(c:receive()))
end

View File

@ -1,10 +0,0 @@
socket = require("socket")
f = loadlib("etc-1.0.dylib", "unix_open")
f(socket)
u = socket.unix()
print(u:bind("/tmp/luasocket"))
print(u:listen())
c = u:accept()
while 1 do
print(assert(c:receive()))
end