From: Christian Heller Date: Wed, 3 Dec 2025 17:36:27 +0000 (+0100) Subject: Some tests refactoring. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/condition_descriptions?a=commitdiff_plain;p=ircplom Some tests refactoring. --- diff --git a/src/tests/_timeout_retries.test b/src/tests/_timeout_retries.test index 32ace8f..7801288 100644 --- a/src/tests/_timeout_retries.test +++ b/src/tests/_timeout_retries.test @@ -1,7 +1,7 @@ insert ./lib/001-to-usermode +insert ./lib/attempting insert ./lib/attempting-to-connected -insert ./lib/conn -# for: attempting, connect, connected +insert ./lib/connect insert ./lib/cmd-disconnect # for: cmd-disconnect insert ./lib/disconnect @@ -13,29 +13,29 @@ insert ./lib/trigger-ping × fake-testing-timeout log 1 $ connection_state set to: [failed to connect: FAKE TESTING TIMEOUT] -insert retry-in : +1 ? :§§ +insert retry-in : + ? :§§ × attempting-to-connected-plus-timeout -insert attempting-to-connected : +1 6697=10000 WIN_IDS :2 -insert trigger-ping : +0 LOG_ID=1 SERVER_ID :0 +insert attempting-to-connected : + 6697=10000 WIN_IDS :2 +insert trigger-ping : + LOG_ID=1 SERVER_ID :0 insert no-timely-pong × timeout-w-exponential-wait -insert attempting : +1 6697 :OLD_PORT +insert attempting : + 6697 :OLD_PORT log 1 $ port set to: [NEW_PORT] -insert fake-testing-timeout : +1 §§ :SECONDS +insert fake-testing-timeout : + §§ :SECONDS × ××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××× # NB: FakeIrcConnection on any port > 10000 will fail connecting with a timeout # the TestingClient meanwhile will decrement any port of that range by 1 after # each started connection attempt -insert connect : +1 6697 :10003 +insert connect : + 6697 :10003 # check increase of retry waits -insert timeout-w-exponential-wait : +1 OLD_PORT=10003 NEW_PORT=10002 SECONDS :1 -insert timeout-w-exponential-wait : +1 OLD_PORT=10002 NEW_PORT=10001 SECONDS :2 -insert timeout-w-exponential-wait : +1 OLD_PORT=10001 NEW_PORT=10000 SECONDS :4 +insert timeout-w-exponential-wait : + OLD_PORT=10003 NEW_PORT=10002 SECONDS :1 +insert timeout-w-exponential-wait : + OLD_PORT=10002 NEW_PORT=10001 SECONDS :2 +insert timeout-w-exponential-wait : + OLD_PORT=10001 NEW_PORT=10000 SECONDS :4 # check connecting works with TestingClient port finally reduced to 10000, # and retry chain also started by in-connection timeout @@ -51,11 +51,11 @@ wait 2 > /reconnect insert attempting-to-connected-plus-timeout > /reconnect -insert attempting-to-connected : +1 6697=10000 WIN_IDS :2 +insert attempting-to-connected : + 6697=10000 WIN_IDS :2 wait 2 # same way ensure retry chain wasn't solely blocked by being connected insert 001-to-usermode insert cmd-disconnect :-1 -insert disconnect1 1: +1 WIN_IDS :2 +insert disconnect1 1: + WIN_IDS :2 wait 2 diff --git a/src/tests/channels.test b/src/tests/channels.test index 5099772..0ff910b 100644 --- a/src/tests/channels.test +++ b/src/tests/channels.test @@ -21,39 +21,35 @@ insert ./lib/user-set-to insert ./lib/usermode × part-empty -insert part : + USERIDS_CLEAR :emptied +insert part-no-msg-me : + USERIDS_CLEAR :emptied + +× privmsg-win +insert privmsg : + TARGET_WIN_ID=NUMBER TARGET :#ch_winNUMBER × topic-set-to -log 1 $ channels:CHANNEL:topic set to: [Topic(what='NEWTOPIC', who=NickUserHost(nick='baz', user='~baz', host='baz.baz'))] -log 4 $ baz!~baz@baz.baz set topic: NEWTOPIC +log 1 $ channels:CHANNEL:topic set to: [Topic(what='NEWTOPIC', who=NickUserHost(nick='baz', user='~bazbaz', host='baz.baz'))] +log 4 $ baz!~bazbaz@baz.baz set topic: NEWTOPIC × reconnect > /reconnect insert attempting-to-connected : + WIN_IDS :2,3,4 insert caps-neg-empty insert 001-setting-nick -log 1 > JOIN :#ch_test0 +log 1 > JOIN :#ch_win3 insert usermode -insert servermsglogged : + MSG ::foo!~baz@baz.bar.foo JOIN #ch_test0 -insert join-empty 2: + CHAN_WIN_ID=3 CHANNEL :#ch_test0 +insert servermsglogged : + MSG ::foo!~foofoo@foo.foo JOIN #ch_win3 +insert join-empty 2: + NUMBER :3 × join-already-in > /join TARGET log LOG_WIN_ID $ already in that channel -× part-other-0 -insert servermsglogged : + MSG ::NICK!~NICK@NICK.NICK PART ARGS - -× part-other-1 -insert parts-core : + USERIDS_CLEAR=set§to:§REMAINING_IDS CHANNEL=#ch_test0 CHAN_WIN_ID=3 § : - -× part-other-no-msg -insert part-other-0 : + ARGS ::#ch_test0 -insert part-other-1 : + exitMSG= exitPREFIX : +× part-no-msg-other +insert part-no-msg 2:-1 + NUMBER=3 USERIDS_CLEAR :set to: REMAINING_IDS × set-prefix -insert servermsglogged : + MSG ::foo.bar.baz MODE #ch_test0 MODESET NICK -log 1 $ channels:#ch_test0:prefixes:PREFIX NEW_IDS +insert servermsglogged : + MSG ::foo.bar.baz MODE #ch_win3 MODESET NICK +log 1 $ channels:#ch_win3:prefixes:PREFIX NEW_IDS log 3 $ NICK VERB PREFIX × ×-------------------------- @@ -68,66 +64,66 @@ insert 001-to-usermode log 2 $ not sending, since not in channel # check join with minimum context (no topic, no other users etc.) -insert join-empty : + CHAN_WIN_ID=3 CHANNEL :#ch_test0 +insert join-empty : + NUMBER :3 # check privmsg into channel from other window only works by direct addressing > msg_test1 log 2 # invalid prompt command: not prefixed by / -insert privmsg : + TARGET_WIN_ID=3 TARGET=#ch_test0 TXT :msg_test1 +insert privmsg-win : + NUMBER=3 TXT :msg_test1 # check from within channel window privmsg works directly and indirectly > /window 3 -insert privmsg : + TARGET_WIN_ID=3 TARGET=#ch_test0 TXT :msg_test2 +insert privmsg-win : + NUMBER=3 TXT :msg_test2 > msg_test3 -insert privmsg 1: + TARGET_WIN_ID=3 TARGET=#ch_test0 TXT :msg_test3 +insert privmsg-win 1: + NUMBER=3 TXT :msg_test3 # check /part and that it only works from within channel window, and if already in channel > /window 2 > /part log 2 # invalid prompt command: /part unknown > /window 3 -insert part-empty : + CHAN_WIN_ID=3 CHANNEL :#ch_test0 +insert part-empty : + NUMBER :3 > /part log 3 $ not in that channel # check /join without argument joins channel previously joined in same window > /join -insert join-empty 1: + CHAN_WIN_ID=3 CHANNEL :#ch_test0 +insert join-empty 1: + NUMBER :3 # check cannot /join channel already joined, neither from its window nor from elsewhere insert join-already-in : + LOG_WIN_ID=3 TARGET : -insert join-already-in : + LOG_WIN_ID=3 TARGET :#ch_test0 +insert join-already-in : + LOG_WIN_ID=3 TARGET :#ch_win3 > /window 2 -insert join-already-in : + LOG_WIN_ID=2 TARGET :#ch_test0 +insert join-already-in : + LOG_WIN_ID=2 TARGET :#ch_win3 # check join to different channel name initiates new window, even if there's already a window for a channel that's been /parted > /window 3 -insert part-empty : + CHAN_WIN_ID=3 CHANNEL :#ch_test0 -insert join-empty : + CHAN_WIN_ID=4 CHANNEL :#ch_test1 +insert part-empty : + NUMBER :3 +insert join-empty : + NUMBER :4 # check 353 also understood if using @ rather than = -insert join-empty : + CHAN_WIN_ID=3 CHANNEL=#ch_test0 = :@ -insert part-empty : + CHAN_WIN_ID=3 CHANNEL :#ch_test0 +insert join-empty : + NUMBER=3 = :@ +insert part-empty : + NUMBER :3 # check /join to, and part from, channel with one other user -insert join-channel-0 : + CHANNEL=#ch_test0 RESIDENT_NAMES :foo bar +insert join-channel-0 : + CHANNEL=#ch_win3 RESIDENT_NAMES :foo bar insert user-set-to :1 + USER_ID=1 USERNICK :bar -insert join-channel-1 : + CHANNEL=#ch_test0 RESIDENT_IDS :[1], [me] +insert join-channel-1 : + CHANNEL=#ch_win3 RESIDENT_IDS :[1], [me] log 3 $ residents: bar, foo -insert part : + CHANNEL=#ch_test0 CHAN_WIN_ID=3 USERIDS_CLEAR :set to: [1] +insert part-no-msg-me : + NUMBER=3 USERIDS_CLEAR :set to: [1] log 1 $ users:1 deleted # check /join into channel with many other users, with multi-line 353, and membership prefixes -insert join-channel-0 : + CHANNEL=#ch_test0 RESIDENT_NAMES :foo @baz +oof +insert join-channel-0 : + CHANNEL=#ch_win3 RESIDENT_NAMES :foo @baz +oof insert user-set-to :1 + USER_ID=2 USERNICK :baz -log 1 $ channels:#ch_test0:prefixes:@ set to: [2] +log 1 $ channels:#ch_win3:prefixes:@ set to: [2] insert user-set-to :1 + USER_ID=3 USERNICK :oof -log 1 $ channels:#ch_test0:prefixes:+ set to: [3] -insert servermsglogged : + MSG ::foo.bar.baz 353 foo = #ch_test0 :+rab zab +log 1 $ channels:#ch_win3:prefixes:+ set to: [3] +insert servermsglogged : + MSG ::foo.bar.baz 353 foo = #ch_win3 :+rab zab insert user-set-to :1 + USER_ID=4 USERNICK :rab -log 1 $ channels:#ch_test0:prefixes:+ set to: [3], [4] +log 1 $ channels:#ch_win3:prefixes:+ set to: [3], [4] insert user-set-to :1 + USER_ID=5 USERNICK :zab -insert join-channel-1 : + CHANNEL=#ch_test0 RESIDENT_IDS :[2], [3], [4], [5], [me] +insert join-channel-1 : + CHANNEL=#ch_win3 RESIDENT_IDS :[2], [3], [4], [5], [me] log 3 $ residents: @baz, +oof, +rab, zab, foo # check server giving and taking membership prefixes @@ -140,92 +136,92 @@ insert set-prefix : + MODESET=+o PREFIX=@ VERB=gains NICK=baz NEW_IDS :set to: [ insert set-prefix : + MODESET=+o PREFIX=@ VERB=gains NICK=foo NEW_IDS :set to: [2], [5], [me] # check server setting unknown modes towards users -insert servermsglogged : + MSG ::foo.bar.baz MODE #ch_test0 +a zab +insert servermsglogged : + MSG ::foo.bar.baz MODE #ch_win3 +a zab insert no-handler -2: + ALERT_WIN_IDS=2,3,4 ? :for nickname setting channel mode: +a -insert servermsglogged : + MSG ::foo.bar.baz MODE #ch_test0 -b rab +insert servermsglogged : + MSG ::foo.bar.baz MODE #ch_win3 -b rab insert no-handler -2: + ALERT_WIN_IDS=2,3,4 ? :for nickname setting channel mode: -b # check /join into channel with topic set > /window 4 -insert part-empty : + CHAN_WIN_ID=4 CHANNEL :#ch_test1 -insert join-channel-0-0 : + CHANNEL :#ch_test1 -insert servermsglogged : + MSG ::foo.bar.baz 332 foo #ch_test1 :foo bar baz -insert servermsglogged : + MSG ::foo.bar.baz 333 foo #ch_test1 baz!~baz@OLD.baz.baz 1234567890 -insert topic-set-to : + baz.baz=OLD.baz.baz CHANNEL=#ch_test1 NEWTOPIC :foo bar baz -insert join-channel-0-1 : + CHANNEL=#ch_test1 RESIDENT_NAMES :foo baz -insert join-channel-1 : + CHANNEL=#ch_test1 RESIDENT_IDS :[2], [me] +insert part-empty : + NUMBER :4 +insert join-channel-0-0 : + CHANNEL :#ch_win4 +insert servermsglogged : + MSG ::foo.bar.baz 332 foo #ch_win4 :foo bar baz +insert servermsglogged : + MSG ::foo.bar.baz 333 foo #ch_win4 baz!~bazbaz@OLD.baz.baz 1234567890 +insert topic-set-to : + baz.baz=OLD.baz.baz CHANNEL=#ch_win4 NEWTOPIC :foo bar baz +insert join-channel-0-1 : + CHANNEL=#ch_win4 RESIDENT_NAMES :foo baz +insert join-channel-1 : + CHANNEL=#ch_win4 RESIDENT_IDS :[2], [me] log 4 $ residents: baz, foo # check _observed_ topic change _does_ affect users database, and … -insert servermsglogged : + MSG ::baz!~baz@baz.baz TOPIC #ch_test1 :foo bar baz -insert user-set-to 1: + USER_ID=2 USERNAME=~baz USERHOST :baz.baz +insert servermsglogged : + MSG ::baz!~bazbaz@baz.baz TOPIC #ch_win4 :foo bar baz +insert user-set-to 1: + USER_ID=2 USERNAME=~bazbaz USERHOST :baz.baz # … is echoed into channel window _if_ either content or setter change -insert topic-set-to : + CHANNEL=#ch_test1 NEWTOPIC :foo bar baz -insert servermsglogged : + MSG ::baz!~baz@baz.baz TOPIC #ch_test1 :foo bar baz -insert servermsglogged : + MSG ::baz!~baz@baz.baz TOPIC #ch_test1 :foo foo baz -insert topic-set-to : + CHANNEL=#ch_test1 NEWTOPIC :foo foo baz +insert topic-set-to : + CHANNEL=#ch_win4 NEWTOPIC :foo bar baz +insert servermsglogged : + MSG ::baz!~bazbaz@baz.baz TOPIC #ch_win4 :foo bar baz +insert servermsglogged : + MSG ::baz!~bazbaz@baz.baz TOPIC #ch_win4 :foo foo baz +insert topic-set-to : + CHANNEL=#ch_win4 NEWTOPIC :foo foo baz # check effects of other users' messages (PRIVMSG and NOTICE) -insert servermsglogged : + MSG ::baz!~baz@baz.baz PRIVMSG #ch_test0 :msg_test3 msg_test4 +insert servermsglogged : + MSG ::baz!~bazbaz@baz.baz PRIVMSG #ch_win3 :msg_test3 msg_test4 log 3 < [@baz] msg_test3 msg_test4 -insert servermsglogged : + MSG ::oof!~oof@oof.oof NOTICE #ch_test0 :msg_test5 msg_test6 -insert user-set-to 1: + USER_ID=3 USERNAME=~oof USERHOST :oof.oof +insert servermsglogged : + MSG ::oof!~oofoof@oof.oof NOTICE #ch_win3 :msg_test5 msg_test6 +insert user-set-to 1: + USER_ID=3 USERNAME=~oofoof USERHOST :oof.oof log 3 < (+oof) msg_test5 msg_test6 # check effect own PRIVMSG into channel, now that we got @ -insert privmsg : + TARGET_WIN_ID=3 TARGET=#ch_test0 foo=@foo TXT :msg_test7 +insert privmsg-win : + NUMBER=3 foo=@foo TXT :msg_test7 # check effect of server NOTICE to channel -insert servermsglogged : + MSG ::*.?.net NOTICE #ch_test0 :msg_test8 msg_test9 +insert servermsglogged : + MSG ::*.?.net NOTICE #ch_win3 :msg_test8 msg_test9 log 3 < (*.?.net) msg_test8 msg_test9 # check part of user visible, and of user NOT visible in other channel -insert part-other-no-msg : + USER_ID=2 NICK=baz REMAINING_IDS :[3], [4], [5], [me] -log 1 $ channels:#ch_test0:prefixes:@ set to: [5], [me] -insert part-other-no-msg : + USER_ID=3 NICK=oof REMAINING_IDS :[4], [5], [me] -log 1 $ channels:#ch_test0:prefixes:+ emptied +insert part-no-msg-other : + USER_ID=2 NICK=baz REMAINING_IDS :[3], [4], [5], [me] +log 1 $ channels:#ch_win3:prefixes:@ set to: [5], [me] +insert part-no-msg-other : + USER_ID=3 NICK=oof REMAINING_IDS :[4], [5], [me] +log 1 $ channels:#ch_win3:prefixes:+ emptied log 1 $ users:3 deleted # check other-user part with exit message -insert part-other-0 : + NICK=zab ARGS :#ch_test0 :goodbye -insert user-set-to 1: + USER_ID=5 USERNAME=~zab USERHOST :zab.zab -insert part-other-1 : + USER_ID=5 NICK=zab exitPREFIX=:§ exitMSG=goodbye REMAINING_IDS=[4],§[me] § : -log 1 $ channels:#ch_test0:prefixes:@ set to: [me] +insert part 2:4 + NICK=zab ARGS :#ch_win3 :goodbye +insert user-set-to 1: + USER_ID=5 USERNAME=~zabzab USERHOST :zab.zab +insert parts-core : + USER_ID=5 NICK=zab NUMBER=3 USERIDS_CLEAR=set§to:§[4],§[me] exitMSG=goodbye exitPREFIX=:§ § : +log 1 $ channels:#ch_win3:prefixes:@ set to: [me] log 1 $ users:5 deleted # check re-join of user kept visible in other channel -insert servermsglogged : + MSG ::baz!~baz@baz.baz JOIN :#ch_test0 -log 1 $ channels:#ch_test0:user_ids set to: [2], [4], [me] -log 3 $ baz!~baz@baz.baz joins +insert servermsglogged : + MSG ::baz!~bazbaz@baz.baz JOIN :#ch_win3 +log 1 $ channels:#ch_win3:user_ids set to: [2], [4], [me] +log 3 $ baz!~bazbaz@baz.baz joins # check re-join of user NOT kept visible in other channel -insert servermsglogged : + MSG ::oof!~oof@oof.oof JOIN :#ch_test0 -insert user-set-to : + USER_ID=6 USERNICK=oof USERNAME=~oof USERHOST :oof.oof -log 1 $ channels:#ch_test0:user_ids set to: [2], [4], [6], [me] -log 3 $ oof!~oof@oof.oof joins +insert servermsglogged : + MSG ::oof!~oofoof@oof.oof JOIN :#ch_win3 +insert user-set-to : + USER_ID=6 USERNICK=oof USERNAME=~oofoof USERHOST :oof.oof +log 1 $ channels:#ch_win3:user_ids set to: [2], [4], [6], [me] +log 3 $ oof!~oofoof@oof.oof joins # check renaming of user communicated into all windows of channels they're in – be it others, or oneself -insert rename : + USER_ID=2 NUH=baz!~baz@baz.baz NEWNICK :bazbaz -insert rename : + USER_ID=2 NUH=bazbaz!~baz@baz.baz NEWNICK :baz -insert cmd-nick : + NUH=foo!~baz@baz.bar.foo USER_ID=me NEWNICK :myself +insert rename : + USER_ID=2 NUH=baz!~bazbaz@baz.baz NEWNICK :bazbaz +insert rename : + USER_ID=2 NUH=bazbaz!~bazbaz@baz.baz NEWNICK :baz +insert cmd-nick : + NUH=foo!~foofoo@foo.foo USER_ID=me NEWNICK :myself # reverting to foo to easen fragment re-use later on -insert cmd-nick : + NUH=myself!~baz@baz.bar.foo USER_ID=me NEWNICK :foo +insert cmd-nick : + NUH=myself!~foofoo@foo.foo USER_ID=me NEWNICK :foo # check QUIT affecting user in all their channels, removing them from DB -insert servermsglogged : + MSG ::baz!~baz@baz.baz QUIT :Client Quit +insert servermsglogged : + MSG ::baz!~bazbaz@baz.baz QUIT :Client Quit log 1 $ users:2:exit_msg set to: [QClient Quit] -log , $ baz!~baz@baz.baz quits: Client Quit -insert quit : + CHAN_WIN_ID=3 CHANNEL=#ch_test0 USER_ID=2 NICK=baz REMAINING_IDS :[4], [6], [me] -insert quit : + CHAN_WIN_ID=4 CHANNEL=#ch_test1 USER_ID=2 NICK=baz REMAINING_IDS :[me] +log , $ baz!~bazbaz@baz.baz quits: Client Quit +insert quit : + USER_ID=2 NICK=baz NUMBER=3 REMAINING_IDS :[4], [6], [me] +insert quit : + USER_ID=2 NICK=baz NUMBER=4 REMAINING_IDS :[me] log 1 $ users:2 deleted # check effects of own QUIT while present in one channel -insert part : + CHAN_WIN_ID=4 USERIDS_CLEAR=emptied CHANNEL :#ch_test1 +insert part-empty : + NUMBER :4 insert cmd-disconnect-0 -insert quit : + CHAN_WIN_ID=3 CHANNEL=#ch_test0 USER_ID=me NICK=foo foo@foo.foo=baz@baz.bar.foo REMAINING_IDS :[4], [6] -log 1 $ channels:#ch_test0:prefixes:@ emptied +insert quit : + USER_ID=me NICK=foo NUMBER=3 REMAINING_IDS :[4], [6] +log 1 $ channels:#ch_win3:prefixes:@ emptied insert cmd-disconnect-1 :-1 insert disconnect1 : + WIN_IDS :2,3,4 diff --git a/src/tests/config.test b/src/tests/config.test index b87aeed..0f4119c 100644 --- a/src/tests/config.test +++ b/src/tests/config.test @@ -1,13 +1,8 @@ -insert ./lib/conn -# for: attempting, connect, connected +insert ./lib/connect-w-password +# for: connect-to-connected-w-password × ×--------------------------------------------------- log 0 # Found config at tests/config.toml, reading … -log 0 # Connecting: {'hostname': 'foo.bar.baz', 'nickname': 'foo', 'password': 'supersecret', 'username': 'baz', 'realname': 'bar', 'port': 1234, 'channels': ['#test', '##testtest']} - -insert connect 1: +1 6697 :1234 -log 1 $ password set to: [supersecret] -insert attempting :-1 +1 6697 :1234 -log 2 $ - password: supersecret -insert connected : +1 WIN_IDS :2 +log 0 # Connecting: {'hostname': 'foo.bar.baz', 'nickname': 'foo', 'password': 'supersecret', 'username': 'foofoo', 'realname': 'foo foo', 'port': 1234, 'channels': ['#test', '##testtest']} +insert connect-to-connected-w-password 1: + 6697=1234 SECRET=supersecret WIN_IDS :2 diff --git a/src/tests/config.toml b/src/tests/config.toml index 362c1a3..f1d0d69 100644 --- a/src/tests/config.toml +++ b/src/tests/config.toml @@ -4,8 +4,8 @@ to_highlight = ['quux'] hostname = 'foo.bar.baz' nickname = 'foo' password = 'supersecret' -username = 'baz' -realname = 'bar' +username = 'foofoo' +realname = 'foo foo' port = 1234 channels = [ '#test', diff --git a/src/tests/connect_disconnect_legalities.test b/src/tests/connect_disconnect_legalities.test index 6da0223..c11de61 100644 --- a/src/tests/connect_disconnect_legalities.test +++ b/src/tests/connect_disconnect_legalities.test @@ -22,7 +22,7 @@ log 1 $ not re-connecting since already connected # handle /disconnect on being connected insert cmd-disconnect :-1 -insert disconnect1 1: +1 WIN_IDS :2 +insert disconnect1 1: + WIN_IDS :2 # fail to disconnect when already disconnected > /disconnect @@ -30,9 +30,9 @@ log 1 $ already disconnected and not attempting connect # succeed to re-connect after disconnect > /reconnect -insert attempting-to-connected : +1 WIN_IDS :2 +insert attempting-to-connected : + WIN_IDS :2 # allow /disconnect outside connection for auto-connect stops -insert error-to-disconnected : +0 §§§ :Closing link: (Connection timed out) -insert retry-in : +1 ? :1 +insert error-to-disconnected : + §§§ :Closing link: (Connection timed out) +insert retry-in : + ? :1 insert disconnect-to-stop-auto-reconnect diff --git a/src/tests/error_disconnects.test b/src/tests/error_disconnects.test index b9c89ca..747640e 100644 --- a/src/tests/error_disconnects.test +++ b/src/tests/error_disconnects.test @@ -8,8 +8,8 @@ insert ./lib/retry-in × reconnect-error-logged > /reconnect -insert attempting-to-connected : +1 WIN_IDS :2 -insert error-to-disconnected : +0 §§§ :XXX +insert attempting-to-connected : + WIN_IDS :2 +insert error-to-disconnected : + §§§ :XXX × ××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××× @@ -17,14 +17,14 @@ insert error-to-disconnected : +0 §§§ :XXX insert connect-to-connected # test default ERROR handling -insert error-to-disconnected : +0 §§§ :abc def ghi +insert error-to-disconnected : + §§§ :abc def ghi # test ERROR regex (non-)matches > /window 1 -insert reconnect-error-logged : +0 XXX :Closing link: (this should not match) -insert reconnect-error-logged : +0 XXX :Closing link: (Connection timed out) -insert retry-in : +1 ? :1 -insert reconnect-error-logged : +0 XXX :closing Link: (connection timed out) -insert retry-in : +1 ? :1 -insert reconnect-error-logged : +0 XXX :Closing link: (Ping timeout: 240 seconds) -insert retry-in : +1 ? :1 +insert reconnect-error-logged : + XXX :Closing link: (this should not match) +insert reconnect-error-logged : + XXX :Closing link: (Connection timed out) +insert retry-in : + ? :1 +insert reconnect-error-logged : + XXX :closing Link: (connection timed out) +insert retry-in : + ? :1 +insert reconnect-error-logged : + XXX :Closing link: (Ping timeout: 240 seconds) +insert retry-in : + ? :1 diff --git a/src/tests/isupports.test b/src/tests/isupports.test index 3897a64..468d086 100644 --- a/src/tests/isupports.test +++ b/src/tests/isupports.test @@ -13,20 +13,20 @@ insert ./lib/servermsglogged insert ./lib/user-set-to × un-default -insert servermsglogged : +0 MSG ::foo.bar.baz 005 foo KEY=VALUE : +insert servermsglogged : + MSG ::foo.bar.baz 005 foo KEY=VALUE : log 1 $ isupport:KEY set to: [VALUE] × un-defaults -insert un-default : +0 KEY=CHANTYPES VALUE :123=456 -insert un-default : +0 KEY=PREFIX VALUE :(ovE)@+= -insert un-default : +0 KEY=USERLEN VALUE :8 +insert un-default : + KEY=CHANTYPES VALUE :123=456 +insert un-default : + KEY=PREFIX VALUE :(ovE)@+= +insert un-default : + KEY=USERLEN VALUE :8 × join-and-hi -insert servermsglogged : +0 MSG ::NICKNAME!TO_CUTq@NICKNAME.NICKNAME JOIN :#ch_test8 -insert user-set-to : +1 USERHOST=NICKNAME.NICKNAME USERNAME=TO_CUTq USERNICK :NICKNAME -log 1 $ channels:#ch_test8:user_ids set to: RESIDENT_IDS, [me] +insert servermsglogged : + MSG ::NICKNAME!TO_CUTq@NICKNAME.NICKNAME JOIN :#ch_win9 +insert user-set-to : + USERHOST=NICKNAME.NICKNAME USERNAME=TO_CUTq USERNICK :NICKNAME +log 1 $ channels:#ch_win9:user_ids set to: RESIDENT_IDS, [me] log 9 $ NICKNAME!TO_CUTq@NICKNAME.NICKNAME joins -insert servermsglogged : +0 MSG ::NICKNAME!~TO_CUT@NICKNAME.NICKNAME PRIVMSG #ch_test8 :hi +insert servermsglogged : + MSG ::NICKNAME!~TO_CUT@NICKNAME.NICKNAME PRIVMSG #ch_win9 :hi log 1 $ users:USER_ID:user set to: [~TO_CUT] log 9 < [NICKNAME] hi @@ -41,66 +41,66 @@ insert caps-neg-empty insert 001-to-usermode # check setting of ISUPPORTs both with and without parameters, and last arg ignored -insert servermsglogged : +0 MSG ::foo.bar.baz 005 foo ABC=DEF GHI :are supported by this server +insert servermsglogged : + MSG ::foo.bar.baz 005 foo ABC=DEF GHI :are supported by this server log 1 $ isupport:ABC set to: [DEF] log 1 $ isupport:GHI set to: [] # check further 005 not re-setting whole dict, and last arg possibly empty -insert servermsglogged : +0 MSG ::foo.bar.baz 005 foo MNO=PQR STU=VWX,YZ : +insert servermsglogged : + MSG ::foo.bar.baz 005 foo MNO=PQR STU=VWX,YZ : log 1 $ isupport:MNO set to: [PQR] log 1 $ isupport:STU set to: [VWX,YZ] # check minus args clearing non-defaulty ISUPPORTs, and intermingling with positive args -insert servermsglogged : +0 MSG ::foo.bar.baz 005 foo -GHI DEF=MNO -STU :ignore me +insert servermsglogged : + MSG ::foo.bar.baz 005 foo -GHI DEF=MNO -STU :ignore me log 1 $ isupport:GHI deleted log 1 $ isupport:DEF set to: [MNO] log 1 $ isupport:STU deleted # check setting and un-setting of defaulty ISUPPORTs insert un-defaults -insert servermsglogged : +0 MSG ::foo.bar.baz 005 foo -CHANTYPES -PREFIX -USERLEN : +insert servermsglogged : + MSG ::foo.bar.baz 005 foo -CHANTYPES -PREFIX -USERLEN : insert isupport-clear 1: # check disconnect on defaulty ISUPPORTs re-instates the respective defaults insert un-defaults > /window 1 insert cmd-disconnect :-1 -insert disconnect1 1: +1 WIN_IDS :2 +insert disconnect1 1: + WIN_IDS :2 > /reconnect -insert attempting-to-connected : +1 WIN_IDS :2 +insert attempting-to-connected : + WIN_IDS :2 insert caps-neg-empty insert 001-to-usermode # check effect of CHANTYPES -insert join-empty : + CHAN_WIN_ID=3 CHANNEL :#ch_test0 -insert join-empty : + CHAN_WIN_ID=4 CHANNEL :&ch_test1 -insert no-handler : +0 ALERT_WIN_IDS=2,3,4 ? :foo!~baz@baz.bar.foo JOIN $ch_test2 -insert un-default : +0 KEY=CHANTYPES VALUE :#$% -insert join-empty : + CHAN_WIN_ID=5 CHANNEL :#ch_test3 -insert no-handler : +0 ALERT_WIN_IDS=2,3,4,5 ? :foo!~baz@baz.bar.foo JOIN &ch_test4 -insert join-empty : + CHAN_WIN_ID=6 CHANNEL :#ch_test5 +insert join-empty : + NUMBER :3 +insert join-empty : + NUMBER=4 #ch_win :&ch_win +insert no-handler : + ALERT_WIN_IDS=2,3,4 ? :foo!~baz@baz.bar.foo JOIN $ch_winA +insert un-default : + KEY=CHANTYPES VALUE :#$% +insert join-empty : + NUMBER :5 +insert no-handler : + ALERT_WIN_IDS=2,3,4,5 ? :foo!~baz@baz.bar.foo JOIN &ch_winB +insert join-empty : + NUMBER=6 #ch_win :$ch_win # test effect of PREFIX -insert join-channel-0 : +0 CHANNEL=#ch_test6 RESIDENT_NAMES :foo @bar +baz =quux -insert user-set-to :1 +1 USER_ID=1 USERNICK :bar -log 1 $ channels:#ch_test6:prefixes:@ set to: [1] -insert user-set-to :1 +1 USER_ID=2 USERNICK :baz -log 1 $ channels:#ch_test6:prefixes:+ set to: [2] -insert user-set-to :1 +1 USER_ID=3 USERNICK :=quux -insert join-channel-1 : +0 CHANNEL=#ch_test6 RESIDENT_IDS :[1], [2], [3], [me] +insert join-channel-0 : + CHANNEL=#ch_win7 RESIDENT_NAMES :foo @bar +baz =quux +insert user-set-to :1 + USER_ID=1 USERNICK :bar +log 1 $ channels:#ch_win7:prefixes:@ set to: [1] +insert user-set-to :1 + USER_ID=2 USERNICK :baz +log 1 $ channels:#ch_win7:prefixes:+ set to: [2] +insert user-set-to :1 + USER_ID=3 USERNICK :=quux +insert join-channel-1 : + CHANNEL=#ch_win7 RESIDENT_IDS :[1], [2], [3], [me] log 7 $ residents: @bar, +baz, =quux, foo -insert un-default : +0 KEY=PREFIX VALUE :(vE)+= -insert join-channel-0 : +0 CHANNEL=#ch_test7 RESIDENT_NAMES :foo @bar +baz =quux -insert user-set-to :1 +1 USER_ID=4 USERNICK :@bar -log 1 $ channels:#ch_test7:prefixes:+ set to: [2] -insert user-set-to :1 +1 USER_ID=5 USERNICK :quux -log 1 $ channels:#ch_test7:prefixes:= set to: [5] -insert join-channel-1 : +0 CHANNEL=#ch_test7 RESIDENT_IDS :[2], [4], [5], [me] +insert un-default : + KEY=PREFIX VALUE :(vE)+= +insert join-channel-0 : +0 CHANNEL=#ch_win8 RESIDENT_NAMES :foo @bar +baz =quux +insert user-set-to :1 + USER_ID=4 USERNICK :@bar +log 1 $ channels:#ch_win8:prefixes:+ set to: [2] +insert user-set-to :1 + USER_ID=5 USERNICK :quux +log 1 $ channels:#ch_win8:prefixes:= set to: [5] +insert join-channel-1 : + CHANNEL=#ch_win8 RESIDENT_IDS :[2], [4], [5], [me] log 8 $ residents: +baz, @bar, =quux, foo # test effect of USERLEN -insert join-empty : + CHAN_WIN_ID=9 CHANNEL :#ch_test8 -insert join-and-hi : +0 NICKNAME=user0 USER_ID=6 TO_CUT=foobarbaz RESIDENT_IDS :[6] -insert un-default : +0 KEY=USERLEN VALUE :8 -insert join-and-hi : +0 NICKNAME=user1 USER_ID=7 TO_CUT=foobarb RESIDENT_IDS :[6], [7] +insert join-empty : + NUMBER :9 +insert join-and-hi : + NICKNAME=user0 USER_ID=6 TO_CUT=foobarbaz RESIDENT_IDS :[6] +insert un-default : + KEY=USERLEN VALUE :8 +insert join-and-hi : + NICKNAME=user1 USER_ID=7 TO_CUT=foobarb RESIDENT_IDS :[6], [7] diff --git a/src/tests/lib/001-setting-nick b/src/tests/lib/001-setting-nick index 5151ef1..15c2879 100644 --- a/src/tests/lib/001-setting-nick +++ b/src/tests/lib/001-setting-nick @@ -2,5 +2,5 @@ insert ./lib/servermsglogged insert ./lib/user-set-to × 001-setting-nick -insert servermsglogged : +0 MSG ::foo.bar.baz 001 foo :Welcome to the foo.bar.baz network -insert user-set-to :1 +1 USER_ID=me USERNICK :foo +insert servermsglogged : + MSG ::foo.bar.baz 001 foo :Welcome to the foo.bar.baz network +insert user-set-to :1 + USER_ID=me USERNICK :foo diff --git a/src/tests/lib/attempting b/src/tests/lib/attempting new file mode 100644 index 0000000..1b8f719 --- /dev/null +++ b/src/tests/lib/attempting @@ -0,0 +1,8 @@ +× attempting +log 1 $ connection_state set to: [connecting] +log 2 $ attempting connection to foo.bar.baz:6697 identifying with … +log 2 $ - nickname: foo +log 2 $ - realname: foo foo +log 2 $ - username: foofoo +log 2 $ - no password + diff --git a/src/tests/lib/attempting-to-connected b/src/tests/lib/attempting-to-connected index 68705a4..cf9d345 100644 --- a/src/tests/lib/attempting-to-connected +++ b/src/tests/lib/attempting-to-connected @@ -1,5 +1,5 @@ -insert ./lib/conn -# for: attempting, connected +insert ./lib/attempting +insert ./lib/connected × attempting-to-connected insert attempting diff --git a/src/tests/lib/cmd-disconnect b/src/tests/lib/cmd-disconnect index 8ab7477..28e39b8 100644 --- a/src/tests/lib/cmd-disconnect +++ b/src/tests/lib/cmd-disconnect @@ -5,9 +5,9 @@ insert ./lib/error-to-disconnect × cmd-disconnect-0 > /disconnect log 1 > QUIT :ircplom says bye -insert servermsglogged : +0 MSG ::foo!~baz@baz.bar.foo QUIT :Client Quit +insert servermsglogged : +0 MSG ::foo!~foofoo@foo.foo QUIT :Client Quit log 1 $ users:me:exit_msg set to: [QClient Quit] -log , $ foo!~baz@baz.bar.foo quits: Client Quit +log , $ foo!~foofoo@foo.foo quits: Client Quit × cmd-disconnect-1 insert error-to-disconnect : +0 ? ::Closing link: foo.foo (Client Quit) diff --git a/src/tests/lib/conn b/src/tests/lib/conn deleted file mode 100644 index e0b1052..0000000 --- a/src/tests/lib/conn +++ /dev/null @@ -1,26 +0,0 @@ -insert ./lib/isupport-clear - -× attempting -log 1 $ connection_state set to: [connecting] -log 2 $ attempting connection to foo.bar.baz:6697 identifying with … -log 2 $ - nickname: foo -log 2 $ - realname: bar -log 2 $ - username: baz -log 2 $ - no password - -× connect -> /connect foo.bar.baz:6697 foo bar:baz -insert isupport-clear 1: +1 -log , $ NOT CONNECTED -log 1 $ hostname set to: [foo.bar.baz] -log 1 $ port set to: [6697] -log 1 $ nick_wanted set to: [foo] -log 1 $ user_wanted set to: [baz] -log 1 $ realname set to: [bar] - -× connected -log 1 $ connection_state set to: [connected] -log WIN_IDS $ CONNECTED -log 1 > CAP LS :302 -log 1 > USER baz 0 * :bar -log 1 > NICK :foo diff --git a/src/tests/lib/connect b/src/tests/lib/connect new file mode 100644 index 0000000..527d62a --- /dev/null +++ b/src/tests/lib/connect @@ -0,0 +1,11 @@ +insert ./lib/isupport-clear + +× connect +> /connect foo.bar.baz:6697 foo foo foo:foofoo +insert isupport-clear 1: +1 +log , $ NOT CONNECTED +log 1 $ hostname set to: [foo.bar.baz] +log 1 $ port set to: [6697] +log 1 $ nick_wanted set to: [foo] +log 1 $ user_wanted set to: [foofoo] +log 1 $ realname set to: [foo foo] diff --git a/src/tests/lib/connect-to-connected b/src/tests/lib/connect-to-connected index 3dc0eee..8d9892a 100644 --- a/src/tests/lib/connect-to-connected +++ b/src/tests/lib/connect-to-connected @@ -1,7 +1,5 @@ insert ./lib/attempting-to-connected -# for: attempting-to-connected -insert ./lib/conn -# for: connect +insert ./lib/connect × connect-to-connected insert connect diff --git a/src/tests/lib/connect-w-password b/src/tests/lib/connect-w-password new file mode 100644 index 0000000..e194342 --- /dev/null +++ b/src/tests/lib/connect-w-password @@ -0,0 +1,17 @@ +insert ./lib/attempting +insert ./lib/connect +insert ./lib/connected + +× connect-w-password +> /connect foo.bar.baz:6697 foo:SECRET foo foo:foofoo +insert connect 1: +log 1 $ password set to: [SECRET] + +× attempting-to-connected-w-password +insert attempting :-1 +log 2 $ - password: SECRET +insert connected + +× connect-to-connected-w-password +insert connect-w-password +insert attempting-to-connected-w-password diff --git a/src/tests/lib/connected b/src/tests/lib/connected new file mode 100644 index 0000000..45ae99c --- /dev/null +++ b/src/tests/lib/connected @@ -0,0 +1,7 @@ +× connected +log 1 $ connection_state set to: [connected] +log WIN_IDS $ CONNECTED +log 1 > CAP LS :302 +log 1 > USER foofoo 0 * :foo foo +log 1 > NICK :foo + diff --git a/src/tests/lib/error-to-disconnect b/src/tests/lib/error-to-disconnect index 00c853f..d2dc965 100644 --- a/src/tests/lib/error-to-disconnect +++ b/src/tests/lib/error-to-disconnect @@ -3,5 +3,5 @@ insert ./lib/disconnect insert ./lib/servermsglogged × error-to-disconnect -insert servermsglogged : +0 MSG :ERROR :? -insert disconnect0 : +1 EXIT_MSG :? +insert servermsglogged : + MSG :ERROR :? +insert disconnect0 : + EXIT_MSG :? diff --git a/src/tests/lib/error-to-disconnected b/src/tests/lib/error-to-disconnected index 7126435..0dec882 100644 --- a/src/tests/lib/error-to-disconnected +++ b/src/tests/lib/error-to-disconnected @@ -3,5 +3,5 @@ insert ./lib/disconnect insert ./lib/error-to-disconnect × error-to-disconnected -insert error-to-disconnect :-1 +0 ? :§§§ -insert disconnect1 1:-1 +1 WIN_IDS :2 +insert error-to-disconnect :-1 + ? :§§§ +insert disconnect1 1:-1 + WIN_IDS :2 diff --git a/src/tests/lib/join-empty b/src/tests/lib/join-empty index 3db8192..69a94cc 100644 --- a/src/tests/lib/join-empty +++ b/src/tests/lib/join-empty @@ -3,7 +3,7 @@ insert ./lib/servermsglogged × join-channel-0-0 > /join CHANNEL log 1 > JOIN :CHANNEL -insert servermsglogged : + MSG ::foo!~baz@baz.bar.foo JOIN :CHANNEL +insert servermsglogged : + MSG ::foo!~foofoo@foo.foo JOIN :CHANNEL × join-channel-0-1 insert servermsglogged : + MSG ::foo.bar.baz 353 foo = CHANNEL :RESIDENT_NAMES @@ -17,6 +17,6 @@ insert servermsglogged : + MSG ::foo.bar.baz 366 foo CHANNEL :End of /NAMES list log 1 $ channels:CHANNEL:user_ids set to: RESIDENT_IDS × join-empty -insert join-channel-0 : + RESIDENT_NAMES :foo -insert join-channel-1 : + RESIDENT_IDS :[me] -log CHAN_WIN_ID $ residents: foo +insert join-channel-0 : + CHANNEL=#ch_winNUMBER RESIDENT_NAMES :foo +insert join-channel-1 : + CHANNEL=#ch_winNUMBER RESIDENT_IDS :[me] +log NUMBER $ residents: foo diff --git a/src/tests/lib/no-timely-pong b/src/tests/lib/no-timely-pong index 72bab47..3fd4aa6 100644 --- a/src/tests/lib/no-timely-pong +++ b/src/tests/lib/no-timely-pong @@ -5,6 +5,6 @@ insert ./lib/retry-in × no-timely-pong servermsg 0 timeout servermsg 0 no timely PONG from server -insert disconnect0 :-1 +1 EXIT_MSG :broken: no timely PONG from server -insert disconnect1 1:-1 +1 WIN_IDS :2 -insert retry-in : +1 ? :1 +insert disconnect0 :-1 + EXIT_MSG :broken: no timely PONG from server +insert disconnect1 1:-1 + WIN_IDS :2 +insert retry-in : + ? :1 diff --git a/src/tests/lib/part b/src/tests/lib/part index e6b5e92..f0f07d4 100644 --- a/src/tests/lib/part +++ b/src/tests/lib/part @@ -1,20 +1,26 @@ insert ./lib/servermsglogged × exit-channel -log 1 $ channels:CHANNEL:exits:USER_ID set to: [exitTYPEexitMSG] -log 1 $ channels:CHANNEL:user_ids USERIDS_CLEAR -log CHAN_WIN_ID $ NICK!~NICK@NICK.NICK exitDESCexitPREFIXexitMSG -log 1 $ channels:CHANNEL:exits:USER_ID deleted +log 1 $ channels:#ch_winNUMBER:exits:USER_ID set to: [exitTYPEexitMSG] +log 1 $ channels:#ch_winNUMBER:user_ids USERIDS_CLEAR +log NUMBER $ NICK!~NICKNICK@NICK.NICK exitDESCexitPREFIXexitMSG +log 1 $ channels:#ch_winNUMBER:exits:USER_ID deleted × parts-core insert exit-channel : + exitTYPE=P exitDESC :parts × part > /part -log 1 > PART :CHANNEL -insert servermsglogged : + MSG ::foo!~baz@baz.bar.foo PART :CHANNEL -insert parts-core : + exitPREFIX= exitMSG= USER_ID=me NICK=foo foo@foo.foo :baz@baz.bar.foo -log 1 $ channels:CHANNEL deleted +log 1 > PART :#ch_winNUMBER +insert servermsglogged : + MSG ::NICK!~NICKNICK@NICK.NICK PART ARGS +insert parts-core : + exitPREFIX= exitMSG : +log 1 $ channels:#ch_winNUMBER deleted + +× part-no-msg +insert part : + ARGS ::#ch_winNUMBER + +× part-no-msg-me +insert part-no-msg : + USER_ID=me NICK :foo × quits insert exit-channel : + exitTYPE=Q exitDESC=quits exitPREFIX=:§ exitMSG=Client§Quit § : diff --git a/src/tests/lib/usermode b/src/tests/lib/usermode index 27edba3..958248e 100644 --- a/src/tests/lib/usermode +++ b/src/tests/lib/usermode @@ -2,6 +2,6 @@ insert ./lib/servermsglogged insert ./lib/user-set-to × usermode -insert servermsglogged : +0 MSG ::foo!~baz@baz.bar.foo MODE foo +ABC -insert user-set-to 1: +1 USER_ID=me USERNAME=~baz USERHOST :baz.bar.foo +insert servermsglogged : + MSG ::foo!~foofoo@foo.foo MODE foo +ABC +insert user-set-to 1: + USER_ID=me USERNAME=~foofoo USERHOST :foo.foo log 1 $ users:me:modes set to: [ABC] diff --git a/src/tests/pingpong.test b/src/tests/pingpong.test index 699edd3..171c4bc 100644 --- a/src/tests/pingpong.test +++ b/src/tests/pingpong.test @@ -27,5 +27,5 @@ insert full-timeout # on re-connect, ensure timer cleared, i.e. only 2nd time-out will disconnect > /window 1 > /reconnect -insert attempting-to-connected : +1 WIN_IDS :2 +insert attempting-to-connected : + WIN_IDS :2 insert full-timeout diff --git a/src/tests/test.test b/src/tests/test.test index 51b90c1..3dca973 100644 --- a/src/tests/test.test +++ b/src/tests/test.test @@ -2,8 +2,8 @@ insert ./lib/attempting-to-connected insert ./lib/cap-msg insert ./lib/cmd-disconnect insert ./lib/cmd-nick -insert ./lib/conn -# for: attempting, connect, connected +insert ./lib/connect-w-password +# for: attempting-to-connected-w-password, connect-to-connected-w-password insert ./lib/disconnect # for: disconnect0, disconnect1 insert ./lib/disconnect-to-stop-auto-reconnect @@ -13,7 +13,7 @@ insert ./lib/join-empty # for: join-channel-0, join-channel-1 insert ./lib/no-handler insert ./lib/part -# for: part, quit, quits +# for: part-no-msg-me, quit, quits insert ./lib/pingpong insert ./lib/privmsg insert ./lib/req-sasl @@ -35,7 +35,7 @@ log 1 > NICK :NAME_B # expect some NOTICE and PING to process/reply during initiation insert servernotice : + XXX :*** Looking up your ident... insert servernotice : + XXX :*** Looking up your hostname... -insert servernotice : + XXX :*** Found your hostname (baz.bar.foo) +insert servernotice : + XXX :*** Found your hostname (foo.foo) insert ping-pong # handle 433 @@ -92,71 +92,71 @@ log 2 $ - (to this server) - insert servermsglogged : + MSG ::foo1 MODE foo1 :+Ziw log 1 $ users:me:modes set to: [Ziw] # handle bot query NOTICE -insert servermsglogged : + MSG ::SaslServ!SaslServ@services.bar.baz NOTICE foo1 :Last login from ~baz@foo.bar.baz on Jan 1 22:00:00 2021 +0000. -log 3 < (SaslServ) Last login from ~baz@foo.bar.baz on Jan 1 22:00:00 2021 +0000. +insert servermsglogged : + MSG ::SaslServ!SaslServ@services.bar.baz NOTICE foo1 :Last login from ~foo@foo.foo on Jan 1 22:00:00 2021 +0000. +log 3 < (SaslServ) Last login from ~foo@foo.foo on Jan 1 22:00:00 2021 +0000. × during_conn # test recoverable 432 -insert cmd-nick :2 +1 NEWNICK :@foo +insert cmd-nick :2 + NEWNICK :@foo insert servermsglogged : + MSG ::*.?.net 432 foo1 @foo :Erroneous nickname log 1 $ nickname refused for bad format, keeping current one # rename to easen code-reuse -insert cmd-nick :4 + NUH=foo1!~baz@baz.bar.foo NEWNICK :foo -log 1 $ users:me:user set to: [~baz] -log 1 $ users:me:host set to: [baz.bar.foo] -insert cmd-nick 4:-2 +1 USER_ID=me NEWNICK :foo -log rename_win_ids $ foo1!~baz@baz.bar.foo renames foo +insert cmd-nick :4 + NUH=foo1!~foofoo@foo.foo NEWNICK :foo +log 1 $ users:me:user set to: [~foofoo] +log 1 $ users:me:host set to: [foo.foo] +insert cmd-nick 4:-2 + USER_ID=me NEWNICK :foo +log rename_win_ids $ foo1!~foofoo@foo.foo renames foo # join channel with other user -insert join-channel-0 : + CHANNEL=#test RESIDENT_NAMES :foo @baz -insert user-set-to :1 +1 USER_ID=1 USERNICK :baz -log 1 $ channels:#test:prefixes:@ set to: [1] -insert join-channel-1 : + CHANNEL=#test RESIDENT_IDS :[1], [me] +insert join-channel-0 : + CHANNEL=#ch_win4 RESIDENT_NAMES :foo @baz +insert user-set-to :1 + USER_ID=1 USERNICK :baz +log 1 $ channels:#ch_win4:prefixes:@ set to: [1] +insert join-channel-1 : + CHANNEL=#ch_win4 RESIDENT_IDS :[1], [me] log 4 $ residents: @baz, foo # process non-self channel JOIN -insert servermsglogged : + MSG ::bar!~bar@bar.bar JOIN :#test -insert user-set-to : +1 USER_ID=2 USERNICK=bar USERNAME=~bar USERHOST :bar.bar -log 1 $ channels:#test:user_ids set to: [1], [2], [me] -log 4 $ bar!~bar@bar.bar joins +insert servermsglogged : + MSG ::bar!~barbar@bar.bar JOIN :#ch_win4 +insert user-set-to : + USER_ID=2 USERNICK=bar USERNAME=~barbar USERHOST :bar.bar +log 1 $ channels:#ch_win4:user_ids set to: [1], [2], [me] +log 4 $ bar!~barbar@bar.bar joins # join second channel with partial residents identity to compare distribution of resident-specific messages -insert join-channel-0 : + CHANNEL=#testtest RESIDENT_NAMES :foo bar -insert join-channel-1 : + CHANNEL=#testtest RESIDENT_IDS :[2], [me] +insert join-channel-0 : + CHANNEL=#ch_win5 RESIDENT_NAMES :foo bar +insert join-channel-1 : + CHANNEL=#ch_win5 RESIDENT_IDS :[2], [me] log 5 $ residents: bar, foo # handle query window with known user -insert servermsglogged : + MSG ::bar!~bar@bar.bar PRIVMSG foo :hi there +insert servermsglogged : + MSG ::bar!~barbar@bar.bar PRIVMSG foo :hi there log 6 < [bar] hi there -insert privmsg : +1 TARGET_WIN_ID=6 TARGET=bar TXT :hello, how is it going -insert servermsglogged : + MSG ::bar!~bar@bar.bar PRIVMSG foo :fine! +insert privmsg : + TARGET_WIN_ID=6 TARGET=bar TXT :hello, how is it going +insert servermsglogged : + MSG ::bar!~barbar@bar.bar PRIVMSG foo :fine! log 6 < [bar] fine! # handle failure to query absent user -insert privmsg : +1 TARGET_WIN_ID=7 TARGET=barbar TXT :hello! +insert privmsg : + TARGET_WIN_ID=7 TARGET=barbar TXT :hello! insert servermsglogged : + MSG ::*.?.net 401 foo barbar :No such nick/channel log 7 $ barbar not online # handle non-self renaming, even into window of previously not found target -insert servermsglogged : + MSG ::bar!~bar@bar.bar NICK :barbar +insert servermsglogged : + MSG ::bar!~barbar@bar.bar NICK :barbar log 1 $ users:2:nick set to: [barbar] -log 4,5,6,7 $ bar!~bar@bar.bar renames barbar +log 4,5,6,7 $ bar!~barbar@bar.bar renames barbar # handle non-self QUIT -insert servermsglogged : + MSG ::barbar!~bar@bar.bar QUIT :Client Quit +insert servermsglogged : + MSG ::barbar!~barbar@bar.bar QUIT :Client Quit log 1 $ users:2:exit_msg set to: [QClient Quit] -log 6,7 $ barbar!~bar@bar.bar quits: Client Quit -insert quit : + CHAN_WIN_ID=4 CHANNEL=#test USER_ID=2 NICK=bar bar!=barbar! REMAINING_IDS :[1], [me] -insert quit : + CHAN_WIN_ID=5 CHANNEL=#testtest USER_ID=2 NICK=bar bar!=barbar! REMAINING_IDS :[me] +log 6,7 $ barbar!~barbar@bar.bar quits: Client Quit +insert quit : + USER_ID=2 NICK=bar NUMBER=4 bar!=barbar! REMAINING_IDS :[1], [me] +insert quit : + USER_ID=2 NICK=bar NUMBER=5 bar!=barbar! REMAINING_IDS :[me] log 1 $ users:2 deleted # handle self-PART: clear channel, and its squatters > /window 4 -insert part : + CHAN_WIN_ID=4 CHANNEL=#test USERIDS_CLEAR :set to: [1] +insert part-no-msg-me : + NUMBER=4 USERIDS_CLEAR :set to: [1] log 1 $ users:1 deleted # handle lack of implementation @@ -164,10 +164,10 @@ insert no-handler : + ALERT_WIN_IDS=2,3,4,5,6,7 ? :foo bar baz # handle /disconnect, clear all insert cmd-disconnect-0 :-1 -log 3,6,7 $ foo!~baz@baz.bar.foo quits: Client Quit -insert quits : + CHAN_WIN_ID=5 CHANNEL=#testtest USER_ID=me NICK=foo foo@foo.foo=baz@baz.bar.foo USERIDS_CLEAR :emptied +log 3,6,7 $ foo!~foofoo@foo.foo quits: Client Quit +insert quits : + USER_ID=me NICK=foo NUMBER=5 USERIDS_CLEAR :emptied insert cmd-disconnect-1 -insert disconnect1 :-1 +1 WIN_IDS :2,3,4,5,6,7 +insert disconnect1 :-1 + WIN_IDS :2,3,4,5,6,7 log 1 $ motd emptied log 1 $ users cleared @@ -178,24 +178,19 @@ log 6 $ cannot send, connection seems closed > /window 1 > /privmsg barbar test log 1 $ cannot send, connection seems closed -> /privmsg #test test +> /privmsg #win4 test log 1 $ not sending, since not in channel × ××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××× # on /connect init databases, log in new windows, connect with values set by /connect, init CAP negotiation -> /connect foo.bar.baz:6697 foo:bar bar:baz -insert connect 1: -log 1 $ password set to: [bar] -insert attempting :-1 -log 2 $ - password: bar +insert connect-to-connected-w-password : + WIN_IDS :2 -insert connected : +1 WIN_IDS :2 insert conn_init_1 insert conn_init_2 # check difference in available commands when switching to client window -> /join #test +> /join #ch_win4 log 0 # invalid prompt command: /join unknown insert enter-list-start log 0 # 1) foo.bar.baz:debug @@ -231,7 +226,7 @@ log 1 # /window.reconnect insert during_conn : + rename_win_ids :3 # test setting up second client, but 432 irrecoverably -> /connect baz.bar.foo:6697 ?foo bar:baz +> /connect baz.bar.foo:6697 ?foo foo foo:foofoo insert connect 1: +8 foo.bar.baz=baz.bar.foo [foo] :[?foo] insert attempting :2 +8 foo.bar.baz :baz.bar.foo log 9 $ - nickname: ?foo @@ -255,11 +250,9 @@ insert disconnect-to-stop-auto-reconnect : +10 # check that (save TUI tests assuming start on window 0, and no 4 yet) on reconnect, all the same effects can be expected > /window 1 > /reconnect -insert attempting :-1 -log 2 $ - password: bar -insert connected : +1 WIN_IDS :2,3,4,5,6,7 +insert attempting-to-connected-w-password : + WIN_IDS :2,3,4,5,6,7 insert conn_init_1 insert conn_init_2 :2 -log 1 > JOIN :#testtest +log 1 > JOIN :#ch_win5 insert conn_init_2 2: insert during_conn : + rename_win_ids :3,6,7 diff --git a/src/tests/tui_draw.test b/src/tests/tui_draw.test index a3e80d4..af4f635 100644 --- a/src/tests/tui_draw.test +++ b/src/tests/tui_draw.test @@ -131,12 +131,12 @@ insert line-server-log : +3 ? :isupport:USERLEN set to: [10] insert line-server-log : +4 ? :hostname set to: [foo.bar.baz] insert line-server-log : +5 ? :port set to: [6697] insert line-server-log : +6 ? :nick_wanted set to: [foo] -insert line-server-log : +7 ? :user_wanted set to: [baz] -insert line-server-log : +8 ? :realname set to: [bar] +insert line-server-log : +7 ? :user_wanted set to: [foofoo] +insert line-server-log : +8 ? :realname set to: [foo foo] insert line-server-log : +9 ? :connection_state set to: [connecting] insert line-server-log : +10 ? :connection_state set to: [connected] insert line-client-msg : +11 ? :CAP LS :302 -insert line-client-msg : +12 ? :USER baz 0 * :bar +insert line-client-msg : +12 ? :USER foofoo 0 * :foo foo insert line-client-msg : +13 ? :NICK :foo insert lines-ping-pong : +14 ?? :0 insert lines-ping-pong : +16 ?? :1 diff --git a/src/tests/userset.test b/src/tests/userset.test index 028749a..967044f 100644 --- a/src/tests/userset.test +++ b/src/tests/userset.test @@ -1,8 +1,8 @@ insert ./lib/cap-msg insert ./lib/cmd-disconnect # for cmd-disconnect-0, cmd-disconnect-1 -insert ./lib/conn -# for: attempting, connected +insert ./lib/connect-w-password +# for: attempting-to-connected-w-password, connect-w-password insert ./lib/disconnect # for: disconnect1 insert ./lib/req-sasl @@ -12,9 +12,7 @@ insert ./lib/user-set-to × connecting-to-nick > /reconnect -insert attempting :-1 + foo.bar.baz=STORE bar=foo baz=foo STORE :foo.bar.baz -log 2 $ - password: foo -insert connected : + WIN_IDS=2 baz=foo bar :foo +insert attempting-to-connected-w-password : + SECRET=foo WIN_IDS :2 × cap-to-auth insert get-sasl-plain @@ -30,9 +28,7 @@ log 1 > CAP :END × ×------------------------------------- -> /connect foo.bar.baz:6697 foo:foo foo:foo -insert connect 1: + [bar]=[foo] [baz] :[foo] -log 1 $ password set to: [foo] +insert connect-w-password : + SECRET :foo # check not setting any user data, going straight to disconnect once possible insert connecting-to-nick 1: @@ -46,7 +42,7 @@ insert disconnect1 1:-1 + WIN_IDS :2 insert connecting-to-nick # insert cmd-disconnect-0 :-2 + ~baz@baz.bar.foo :~foo@foo.foo -insert user-set-to : + USER_ID=me USERNICK=foo USERNAME=~foo USERHOST :foo.foo +insert user-set-to : + USER_ID=me USERNICK=foo USERNAME=~foofoo USERHOST :foo.foo insert cmd-disconnect-0 -2: + ~baz@baz.bar.foo :~foo@foo.foo insert cmd-disconnect-1 :-1 insert disconnect1 1: + WIN_IDS :2 @@ -54,14 +50,14 @@ insert disconnect1 1: + WIN_IDS :2 # check receiving nickname during set-up, other stuff only via QUIT message # check immediate insert connecting-to-nick -insert cap-msg : +0 CAPMSG :* LS : +insert cap-msg : + CAPMSG :* LS : log 1 > CAP :LIST -insert cap-msg : +0 CAPMSG :foo LIST : +insert cap-msg : + CAPMSG :foo LIST : insert user-set-to :1 + USER_ID=me USERNICK :foo log 1 > CAP :END # insert cmd-disconnect-0 :-2 + ~baz@baz.bar.foo :~foo@foo.foo -insert user-set-to 1: + USER_ID=me USERNAME=~foo USERHOST :foo.foo +insert user-set-to 1: + USER_ID=me USERNAME=~foofoo USERHOST :foo.foo insert cmd-disconnect-0 -2: + ~baz@baz.bar.foo :~foo@foo.foo insert cmd-disconnect-1 :-1 insert disconnect1 1: + WIN_IDS :2 @@ -72,7 +68,7 @@ insert cap-to-auth insert end-auth : + NUMERIC=904 SASL_STATE :failed # insert cmd-disconnect-0 :-2 + ~baz@baz.bar.foo :~foo@foo.foo -insert user-set-to 1: + USER_ID=me USERNAME=~foo USERHOST :foo.foo +insert user-set-to 1: + USER_ID=me USERNAME=~foofoo USERHOST :foo.foo insert cmd-disconnect-0 -2: + ~baz@baz.bar.foo :~foo@foo.foo insert cmd-disconnect-1 insert disconnect1 1:-1 + WIN_IDS :2 @@ -88,8 +84,8 @@ log 1 $ sasl_account set to: [foo] insert end-auth : + NUMERIC=903 SASL_STATE :successful # check tilde addition and MODE setting -insert servermsglogged : +0 MSG ::foo!~foo@foo.foo MODE foo +aBc +insert servermsglogged : + MSG ::foo!~foo@foo.foo MODE foo +aBc log 1 $ users:me:user set to: [~foo] log 1 $ users:me:modes set to: [Bac] -insert servermsglogged : +0 MSG ::foo!~foo@foo.foo MODE foo -cba +insert servermsglogged : + MSG ::foo!~foo@foo.foo MODE foo -cba log 1 $ users:me:modes set to: [B]