From: Christian Heller Date: Thu, 2 Oct 2025 18:41:43 +0000 (+0200) Subject: Change test files' extensions from besides-the-point .txt to meaningful .test. X-Git-Url: https://plomlompom.com/repos/?a=commitdiff_plain;h=75c93cc8efb77c52300455907614c60701a777f8;p=ircplom Change test files' extensions from besides-the-point .txt to meaningful .test. --- diff --git a/src/tests/config.test b/src/tests/config.test new file mode 100644 index 0000000..9e8106a --- /dev/null +++ b/src/tests/config.test @@ -0,0 +1,25 @@ +0 .# Found config at tests/config.toml, reading … +0 .# Connecting: {'hostname': 'irc.test0.net', 'nickname': 'foo', 'password': 'bar', 'username': 'baz', 'realname': 'quux', 'port': 1234, 'channels': ['#test', '##testtest']} +1 .$ isupport cleared +1 .$ isupport:CHANTYPES set to: [#&] +1 .$ isupport:PREFIX set to: [(ov)@+] +1 .$ isupport:USERLEN set to: [10] +1 .$ caps cleared +1 .$ users cleared +1 .$ channels cleared +, .$ DISCONNECTED +1 .$ hostname set to: [irc.test0.net] +1 .$ port set to: [1234] +1 .$ nick_wanted set to: [foo] +1 .$ user_wanted set to: [baz] +1 *$ realname set to: [quux] +1 .$ password set to: [bar] +1 .$ connection_state set to: [connecting] +1 .$ connection_state set to: [connected] +, .$ CONNECTED +1 .> CAP LS :302 +1 *> USER baz 0 * :quux +1 .> NICK :foo + +> /quit +0 .< diff --git a/src/tests/config.txt b/src/tests/config.txt deleted file mode 100644 index 9e8106a..0000000 --- a/src/tests/config.txt +++ /dev/null @@ -1,25 +0,0 @@ -0 .# Found config at tests/config.toml, reading … -0 .# Connecting: {'hostname': 'irc.test0.net', 'nickname': 'foo', 'password': 'bar', 'username': 'baz', 'realname': 'quux', 'port': 1234, 'channels': ['#test', '##testtest']} -1 .$ isupport cleared -1 .$ isupport:CHANTYPES set to: [#&] -1 .$ isupport:PREFIX set to: [(ov)@+] -1 .$ isupport:USERLEN set to: [10] -1 .$ caps cleared -1 .$ users cleared -1 .$ channels cleared -, .$ DISCONNECTED -1 .$ hostname set to: [irc.test0.net] -1 .$ port set to: [1234] -1 .$ nick_wanted set to: [foo] -1 .$ user_wanted set to: [baz] -1 *$ realname set to: [quux] -1 .$ password set to: [bar] -1 .$ connection_state set to: [connecting] -1 .$ connection_state set to: [connected] -, .$ CONNECTED -1 .> CAP LS :302 -1 *> USER baz 0 * :quux -1 .> NICK :foo - -> /quit -0 .< diff --git a/src/tests/pingpong.test b/src/tests/pingpong.test new file mode 100644 index 0000000..a468f57 --- /dev/null +++ b/src/tests/pingpong.test @@ -0,0 +1,66 @@ +> /connect foo.bar.baz foo:bar baz:foobarbazquux +| 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: [foobarbazquux] +1 .$ realname set to: [baz] +1 .$ password set to: [bar] +1 .$ port set to: [6697] +| conn0-in +1 .$ connection_state set to: [connecting] +1 .$ connection_state set to: [connected] +| conn0-out +, .$ CONNECTED +| conn1-in +1 .> CAP LS :302 +1 .> USER foobarbazquux 0 * :baz +1 .> NICK :foo + +# ensure we PONG properly +:0:1 .< PING :? +1 .> PONG :? +| conn1-out + +# ping on timeout, go on as normal if PONG received +| trigger-ping-in +<0 FAKE_IRC_CONN_TIMEOUT_EXCEPTION +1 .> PING :what's up? +| trigger-ping-out +:0:1 .< :*.?.net PONG *.?.net :what's up? +:0:1 .< :*.?.net NOTICE * :*** Looking up your ident... +2 .< *** [ server] *** Looking up your ident... + +# another timeout instead of pong? disconnect +| full-timeout-in +repeat trigger-ping-in trigger-ping-out +<0 FAKE_IRC_CONN_TIMEOUT_EXCEPTION +1 .$ connection_state set to: [broken: no timely PONG from server] +repeat isupport-clear-in isupport-clear-out +1 .$ connection_state set to: [] +2 .$ DISCONNECTED +| full-timeout-out + +# on (automatic!) re-connect, ensure timer cleared, so won't trigger already on 1st timeout +| conn2-in +1 .!$ will retry connecting in 1 seconds +repeat conn0-in conn0-out +2 .$ CONNECTED +repeat conn1-in conn1-out +| conn2-out +repeat full-timeout-in full-timeout-out + +# after proof that a full double-timeout was necessary, we again automatically re-connect before our /quit gets processed … +repeat conn2-in conn2-out + +> /quit +0 .< diff --git a/src/tests/pingpong.txt b/src/tests/pingpong.txt deleted file mode 100644 index a468f57..0000000 --- a/src/tests/pingpong.txt +++ /dev/null @@ -1,66 +0,0 @@ -> /connect foo.bar.baz foo:bar baz:foobarbazquux -| 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: [foobarbazquux] -1 .$ realname set to: [baz] -1 .$ password set to: [bar] -1 .$ port set to: [6697] -| conn0-in -1 .$ connection_state set to: [connecting] -1 .$ connection_state set to: [connected] -| conn0-out -, .$ CONNECTED -| conn1-in -1 .> CAP LS :302 -1 .> USER foobarbazquux 0 * :baz -1 .> NICK :foo - -# ensure we PONG properly -:0:1 .< PING :? -1 .> PONG :? -| conn1-out - -# ping on timeout, go on as normal if PONG received -| trigger-ping-in -<0 FAKE_IRC_CONN_TIMEOUT_EXCEPTION -1 .> PING :what's up? -| trigger-ping-out -:0:1 .< :*.?.net PONG *.?.net :what's up? -:0:1 .< :*.?.net NOTICE * :*** Looking up your ident... -2 .< *** [ server] *** Looking up your ident... - -# another timeout instead of pong? disconnect -| full-timeout-in -repeat trigger-ping-in trigger-ping-out -<0 FAKE_IRC_CONN_TIMEOUT_EXCEPTION -1 .$ connection_state set to: [broken: no timely PONG from server] -repeat isupport-clear-in isupport-clear-out -1 .$ connection_state set to: [] -2 .$ DISCONNECTED -| full-timeout-out - -# on (automatic!) re-connect, ensure timer cleared, so won't trigger already on 1st timeout -| conn2-in -1 .!$ will retry connecting in 1 seconds -repeat conn0-in conn0-out -2 .$ CONNECTED -repeat conn1-in conn1-out -| conn2-out -repeat full-timeout-in full-timeout-out - -# after proof that a full double-timeout was necessary, we again automatically re-connect before our /quit gets processed … -repeat conn2-in conn2-out - -> /quit -0 .< diff --git a/src/tests/tui_prompt_basics.test b/src/tests/tui_prompt_basics.test new file mode 100644 index 0000000..7cb09a6 --- /dev/null +++ b/src/tests/tui_prompt_basics.test @@ -0,0 +1,44 @@ +# BASIC TUI PROMPT TESTS + +# nothing should happen on empty command input +> + +# expected complaints on wrong command inputs +> foo +0 .!# invalid prompt command: not prefixed by / +> /foo +0 .!# invalid prompt command: /foo unknown +> /help foo +0 .!# invalid prompt command: /help given argument(s) while none expected +> /window +0 .!# invalid prompt command: /window too few arguments (given 0, need 1) + +# some simple expected command successes +> /help +0 .# commands available in this window: +0 .# /connect HOST_PORT [NICKNAME_PW] [REALNAME_USERNAME] +0 .# /help +0 .# /list +0 .# /prompt_enter +0 .# /quit +0 .# /window TOWARDS +0 .# /window.history.scroll DIRECTION +0 .# /window.paste +0 .# /window.prompt.backspace +0 .# /window.prompt.move_cursor DIRECTION +0 .# /window.prompt.scroll DIRECTION +> /list +0 .# windows available via /window: +0 .# 0) :start + +# should probably not be available at all by explicit prompt writing, but for now this be the expected behavior … +> /prompt_enter +0 .!# invalid prompt command: /prompt_enter would loop into ourselves +> /window.history.scroll foo +> /window.prompt.backspace +> /window.prompt.move_cursor foo +> /window.prompt.scroll foo +> /window.paste + +> /quit +0 .< diff --git a/src/tests/tui_prompt_basics.txt b/src/tests/tui_prompt_basics.txt deleted file mode 100644 index 7cb09a6..0000000 --- a/src/tests/tui_prompt_basics.txt +++ /dev/null @@ -1,44 +0,0 @@ -# BASIC TUI PROMPT TESTS - -# nothing should happen on empty command input -> - -# expected complaints on wrong command inputs -> foo -0 .!# invalid prompt command: not prefixed by / -> /foo -0 .!# invalid prompt command: /foo unknown -> /help foo -0 .!# invalid prompt command: /help given argument(s) while none expected -> /window -0 .!# invalid prompt command: /window too few arguments (given 0, need 1) - -# some simple expected command successes -> /help -0 .# commands available in this window: -0 .# /connect HOST_PORT [NICKNAME_PW] [REALNAME_USERNAME] -0 .# /help -0 .# /list -0 .# /prompt_enter -0 .# /quit -0 .# /window TOWARDS -0 .# /window.history.scroll DIRECTION -0 .# /window.paste -0 .# /window.prompt.backspace -0 .# /window.prompt.move_cursor DIRECTION -0 .# /window.prompt.scroll DIRECTION -> /list -0 .# windows available via /window: -0 .# 0) :start - -# should probably not be available at all by explicit prompt writing, but for now this be the expected behavior … -> /prompt_enter -0 .!# invalid prompt command: /prompt_enter would loop into ourselves -> /window.history.scroll foo -> /window.prompt.backspace -> /window.prompt.move_cursor foo -> /window.prompt.scroll foo -> /window.paste - -> /quit -0 .<