irc.client: add test

db4
Bruno Deferrari 2009-03-07 20:54:28 -02:00
parent 527b50fa56
commit f3577572ec
1 changed files with 9 additions and 2 deletions

View File

@ -34,6 +34,7 @@ M: mb-writer dispose drop ;
: %add-named-chat ( chat -- ) irc> attach-chat ;
: %push-line ( line -- ) irc> stream>> in>> push-line yield ;
: %join ( channel -- ) <irc-channel-chat> irc> attach-chat ;
: %pop-output-line ( -- string ) irc> stream>> out>> lines>> pop ;
: read-matching-message ( chat quot: ( msg -- ? ) -- irc-message )
[ in-messages>> 0.1 seconds ] dip mailbox-get-timeout? ;
@ -79,8 +80,7 @@ M: mb-writer dispose drop ;
! Test join
[ { "JOIN #factortest" } [
"#factortest" %join
irc> stream>> out>> lines>> pop
"#factortest" %join %pop-output-line
] unit-test
] with-irc
@ -221,3 +221,10 @@ M: mb-writer dispose drop ;
[ participant-changed? ] read-matching-message
] unit-test
] with-irc
! Send privmsg
[ { "PRIVMSG #factortest :hello" } [
"#factortest" <irc-channel-chat> [ %add-named-chat ] keep
"hello" swap speak %pop-output-line
] unit-test
] with-irc