52 lines
1.2 KiB
Plaintext
52 lines
1.2 KiB
Plaintext
irce = require "irce"
|
|
socket = require "socket"
|
|
test = require "ketracel.test"
|
|
|
|
describe "ngircd protocol support", ->
|
|
local file
|
|
local last_msg
|
|
client = socket.tcp!
|
|
client\settimeout 1
|
|
irc = irce.new!
|
|
irc\set_send_func (message) =>
|
|
last_msg = message
|
|
print "[server] > " .. message
|
|
client\send message
|
|
irc\load_module require "irce.modules.ngircd"
|
|
|
|
setup ->
|
|
print "got here"
|
|
file = io.popen "ngircd -n -f ./spec/ngircd.conf", "r"
|
|
|
|
teardown ->
|
|
with io.popen "killall ngircd", "r"
|
|
\close!
|
|
with file
|
|
print \read "*all"
|
|
\close!
|
|
|
|
it "actually is running ngircd", ->
|
|
with io.popen "pstree"
|
|
data = \read "*all"
|
|
assert.truthy string.find data, "ngircd"
|
|
|
|
it "registers", ->
|
|
bursted = false
|
|
irc\set_callback "376", =>
|
|
bursted = true
|
|
|
|
client\connect "127.0.0.1", 6667
|
|
irc\REGISTER "hunter2", "kc-test", "0.0.1", "ketracel.akua", "test", "31"
|
|
|
|
while not bursted
|
|
msg = client\receive!
|
|
print "[server] " .. msg
|
|
irc\process msg
|
|
|
|
@irc\clear_callback "376"
|
|
|
|
it "can use the Client class", ->
|
|
cli = test.Client "test_user"
|
|
cli\wait_for "005"
|
|
cli\quit!
|