From: Christian Heller Date: Wed, 8 Oct 2025 22:33:05 +0000 (+0200) Subject: Add test for legalities of /reconnect and /disconnect. X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/balance?a=commitdiff_plain;h=HEAD;p=ircplom Add test for legalities of /reconnect and /disconnect. --- diff --git a/src/tests/connect_disconnect_legalities.test b/src/tests/connect_disconnect_legalities.test new file mode 100644 index 0000000..51293f3 --- /dev/null +++ b/src/tests/connect_disconnect_legalities.test @@ -0,0 +1,51 @@ +# to prepare, initiate connection +> /connect foo.bar.baz foo bar:baz +| isupport-clear-in +1 ..$ isupport cleared +1 ..$ isupport:CHANTYPES set to: [#&] +1 ..$ isupport:PREFIX set to: [(ov)@+] +1 ..$ isupport:USERLEN set to: [10] +| isupport-clear-out +1 ..$ caps cleared +1 ..$ users cleared +1 ..$ channels cleared +, ..$ DISCONNECTED +1 ..$ hostname set to: [foo.bar.baz] +1 ..$ port set to: [-1] +1 ..$ nick_wanted set to: [foo] +1 ..$ user_wanted set to: [baz] +1 ..$ realname set to: [bar] +1 ..$ port set to: [6697] +| connecting-in +1 ..$ connection_state set to: [connecting] +1 ..$ connection_state set to: [connected] +, ..$ CONNECTED +1 ..> CAP LS :302 +1 ..> USER baz 0 * :bar +1 ..> NICK :foo +| connecting-out + +# fail to reconnect while connected +> /window 1 +> /reconnect +1 .!$ not re-connecting since already connected + +# handle /disconnect on being connected +> /disconnect +1 ..> QUIT :ircplom says bye +:0:1 ..< ERROR :Closing link: (whatever@whatever.com) [Quit: ircplom says bye] +1 ..$ connection_state set to: [Closing link: (whatever@whatever.com) [Quit: ircplom says bye]] +repeat isupport-clear-in isupport-clear-out +1 ..$ connection_state set to: [] +, ..$ DISCONNECTED + +# fail to disconnect when already disconnected +> /disconnect +1 .!$ cannot send, connection seems closed + +# succeed to re-connect after disconnect +> /reconnect +repeat connecting-in connecting-out + +> /quit +0 ..< diff --git a/src/tests/test.test b/src/tests/test.test index d7bc4ad..ec2bb89 100644 --- a/src/tests/test.test +++ b/src/tests/test.test @@ -318,10 +318,6 @@ 1 .!$ No handler implemented for: foo bar baz 2,3,4,5,6,7 .!$ No handler implemented for: foo bar baz -# fail to reconnect while connected -> /reconnect -1 .!$ not re-connecting since already connected - # handle /disconnect, clear all > /disconnect 1 ..> QUIT :ircplom says bye