irc.client: add test
parent
527b50fa56
commit
f3577572ec
|
@ -34,6 +34,7 @@ M: mb-writer dispose drop ;
|
||||||
: %add-named-chat ( chat -- ) irc> attach-chat ;
|
: %add-named-chat ( chat -- ) irc> attach-chat ;
|
||||||
: %push-line ( line -- ) irc> stream>> in>> push-line yield ;
|
: %push-line ( line -- ) irc> stream>> in>> push-line yield ;
|
||||||
: %join ( channel -- ) <irc-channel-chat> irc> attach-chat ;
|
: %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 )
|
: read-matching-message ( chat quot: ( msg -- ? ) -- irc-message )
|
||||||
[ in-messages>> 0.1 seconds ] dip mailbox-get-timeout? ;
|
[ in-messages>> 0.1 seconds ] dip mailbox-get-timeout? ;
|
||||||
|
@ -79,8 +80,7 @@ M: mb-writer dispose drop ;
|
||||||
|
|
||||||
! Test join
|
! Test join
|
||||||
[ { "JOIN #factortest" } [
|
[ { "JOIN #factortest" } [
|
||||||
"#factortest" %join
|
"#factortest" %join %pop-output-line
|
||||||
irc> stream>> out>> lines>> pop
|
|
||||||
] unit-test
|
] unit-test
|
||||||
] with-irc
|
] with-irc
|
||||||
|
|
||||||
|
@ -221,3 +221,10 @@ M: mb-writer dispose drop ;
|
||||||
[ participant-changed? ] read-matching-message
|
[ participant-changed? ] read-matching-message
|
||||||
] unit-test
|
] unit-test
|
||||||
] with-irc
|
] 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
|
||||||
|
|
Loading…
Reference in New Issue