;;; erc-scenarios-misc.el --- Misc scenarios for ERC -*- lexical-binding: t -*-
;; Copyright (C) 2022-2024 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see .
;;; Code:
(require 'ert-x)
(eval-and-compile
(let ((load-path (cons (ert-resource-directory) load-path)))
(require 'erc-scenarios-common)))
(eval-when-compile (require 'erc-join))
(ert-deftest erc-scenarios-base-flood ()
:tags '(:expensive-test)
(erc-scenarios-common-with-cleanup
((erc-scenarios-common-dialog "base/flood")
(dumb-server (erc-d-run "localhost" t 'soju))
(port (process-contact dumb-server :service))
(erc-server-flood-penalty 0.5) ; this ratio MUST match
(erc-server-flood-margin 1.5) ; the default of 3:10
(expect (erc-d-t-make-expecter))
erc-autojoin-channels-alist)
(ert-info ("Connect to bouncer")
(with-current-buffer
(erc :server "127.0.0.1"
:port port
:nick "tester"
:password "changeme"
:full-name "tester")
(should (string= (buffer-name) (format "127.0.0.1:%d" port)))
(funcall expect 5 "Soju")))
(ert-info ("#chan@foonet exists")
(with-current-buffer (erc-d-t-wait-for 5 (get-buffer "#chan/foonet"))
(erc-d-t-search-for 2 "")
(erc-d-t-absent-for 0.1 "")
(erc-d-t-absent-for 0.1 "