irctk

libircclient binding for scripts
git clone https://a3nm.net/git/irctk/
Log | Files | Refs | README

commit c851e4127640a7353ad245f6b24e4e56a9e6facb
parent 0d03fe1a3eaeeea73185d47f2467d27ddf0646f6
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Sat, 21 Jul 2012 02:10:00 +0200

add test

Diffstat:
test/events.sh | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 69 insertions(+), 0 deletions(-)

diff --git a/test/events.sh b/test/events.sh @@ -0,0 +1,69 @@ +#!/bin/bash + +trap 'kill $(jobs -p)' EXIT + +cat >tosay <<EOF +/join #test2 +[#test1] /nick op2 +/mode +n +/mode -n +/part +[#test1,#test2] /topic mytopic +[#test2] /invite command +[#test2] /kick command kickarg +/say hello +/ /hello2 +/quit quitarg +EOF +cat > ref_message <<EOF +[#test1] -!- message has joined #test1 +[#test2] -!- message has joined #test2 +[#test1] -!- command has joined #test1 +[#test2] -!- command has joined #test2 +[#test1] -!- nothing has joined #test1 +[#test2] -!- nothing has joined #test2 +[] -!- op is now known as op2 +[#test1] -!- op2 mode +n on #test1 +[#test1] -!- op2 mode -n on #test1 +[#test1] -!- op2 has left #test1 (op2) +[#test2] -!- op2 changed the topic of #test2 to mytopic +[#test2] -!- command was kicked from #test2 by op2 (kickarg) +[#test2] <op2> hello +[#test2] <op2> /hello2 +[] -!- op2 has quit (Client closed connection) +EOF +cat > ref_command <<EOF +[#test1] <command> /join #test1 +[#test2] <command> /join #test2 +[#test1] <nothing> /join #test1 +[#test2] <nothing> /join #test2 +[] <op> /nick op2 +[#test1] <op2> /mode +n #test1 +[#test1] <op2> /mode -n #test1 +[#test1] <op2> /part #test1 +[#test2] <op2> /topic mytopic +[#test2] <op2> /kick command kickarg +EOF +cat > ref_nothing <<EOF +[#test2] <op2> hello +[#test2] <op2> /hello2 +EOF + +(sleep 3; cat tosay) | ../irctk -p op@localhost \#test1 \#test2 2>/dev/null & +sleep 1 +PID=$! +cat fifo1 | ../irctk -m message@localhost \#test1 \#test2 > heard_message & +PID1=$! +sleep 0.3 +cat fifo2 | ../irctk -c command@localhost \#test1 \#test2 > heard_command & +PID2=$! +sleep 0.3 +cat fifo3 | ../irctk -n nothing@localhost \#test1 \#test2 > heard_nothing & +PID3=$! +wait $PID +sleep 1 +kill $PID1 $PID2 $PID3 + +diff ref_message heard_message && diff ref_command heard_command \ + && diff ref_nothing heard_nothing +