testing :D

This commit is contained in:
Cadey Ratio 2019-12-25 20:38:19 +00:00
parent fdfb591c13
commit 559df11d41
4 changed files with 130 additions and 0 deletions

16
scripts/dev_ipad_run.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
moonc-5.3 `find -type f | grep 'moon$'`
ngircd -f ./spec/ngircd.conf
function trap_ctrlc () {
killall ngircd
exit 0
}
trap "trap_ctrlc" 2
cd src
export KETRACEL_DEBUG=yes
export KETRACEL_SPASS=hunter2
lua5.3 -l set_paths ketracel.lua

4
scripts/test.sh Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
moonc `find -type f | grep -v spec | grep 'moon$'`
busted --defer-print

42
spec/ngircd.conf Normal file
View File

@ -0,0 +1,42 @@
[Global]
Name = test.localhost
Info = oh god
Listen = 0.0.0.0
MotdPhrase = testing
Network = ShadowNET
Ports = 6667
ServerGID = 65534
ServerUID = 65534
[Limits]
MaxJoins = 50
MaxNickLength = 31
MaxListSize = 100
PingTimeout = 120
PongTimeout = 20
[Options]
AllowedChannelTypes = #&+
AllowRemoteOper = yes
CloakUserToNick = yes
DNS = no
Ident = no
MorePrivacy = no
NoticeBeforeRegistration = yes
OperCanUseMode = yes
OperChanPAutoOp = yes
PAM = no
PAMIsOptional = yes
RequireAuthPing = yes
[Channel]
Name = #lobby
Topic = Welcome to the new ShadowNET!
Modes = tn
[Server]
Name = ketracel.akua
Passive = yes
MyPassword = hunter2
PeerPassword = hunter2
ServiceMask = Ketracel,*Serv

View File

@ -0,0 +1,68 @@
irce = require "irce"
socket = require "socket"
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 do a normal client connection", ->
irc_client = socket.tcp!
ircce = irce.new!
ircce\set_send_func (message) =>
print "[client] > " .. message
irc_client\send message
running = true
ircce\set_callback "005", =>
running = false
ircce\load_module require "irce.modules.base"
irc_client\connect "127.0.0.1", 6667
ircce\NICK "test"
ircce\USER "test", "hunter2"
while running
msg = irc_client\receive!
print "[client] < " .. msg
ircce\process msg
ircce\QUIT "bye"
irc_client\close!