[gnus git] branch master updated: n0-15-75-gc8e100b =1= Installed simple NNTP testing.

David Engster <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  c8e100b618d49f22a02b6a33f3a0303fb75d21f1 (commit)
      from  2c311f43f25dbb0a0353712573d06496bd93ace2 (commit)


- Log -----------------------------------------------------------------
commit c8e100b618d49f22a02b6a33f3a0303fb75d21f1
Author: David Engster <[email protected]>
Date:   Wed Apr 20 20:31:23 2011 +0200

    Installed simple NNTP testing.
    
    * tests/gnustest-nntp.el: New file for simple NNTP testing.
    
    * Makefile.in (test-nntp): New rule.
    (check): Add it.
    (test-registry): Change '$(EMACS_COMP)' to '$(EMACS) $(FLAGS)'.

diff --git a/lisp/tests/gnustest-nntp.el b/lisp/tests/gnustest-nntp.el
new file mode 100644
index 0000000..5838efe
--- /dev/null
+++ b/lisp/tests/gnustest-nntp.el
@@ -0,0 +1,94 @@
+;;; gnustest-nntp.el --- Simple NNTP testing for Gnus
+;; Copyright (C) 2011 Free Software Foundation, Inc.
+
+;; Author: David Engster <[email protected]>
+
+;; This file is not 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, 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; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+
+;; This test will
+;;
+;;   - Fire up Gnus
+;;   - Connect to Gmane
+;;   - Subscribe to gmane.discuss
+;;   - Get its active info
+;;   - Get one specific article by message-id and check its subject
+;;   - Quit Gnus
+
+;;; Code:
+
+(require 'ert)
+(require 'net-utils)
+
+(defvar gnustest-nntp-server "news.gmane.org"
+  "NNTP server used for testing.")
+
+(defun gnustest-ping-host (host)
+  "Ping HOST once and return non-nil if successful."
+  (let* ((ping-program-options '("-c" "1"))
+	 (buf (ping host))
+	 proc)
+    (sleep-for 0.5)
+    (with-current-buffer buf
+      (accept-process-output (get-buffer-process (current-buffer)) 2)
+      (goto-char (point-min))
+      (prog1
+	  (re-search-forward ",[ ]*1.*?received,[ ]*0" nil t)
+	(when (setq proc (get-buffer-process (current-buffer)))
+	  (set-process-query-on-exit-flag proc nil))
+	(kill-buffer)))))
+
+(setq gnus-home-directory (concat temporary-file-directory (make-temp-name "gnus-test-")))
+(message "***** Using %s as temporary Gnus home." gnus-home-directory)
+(mkdir gnus-home-directory)
+(setq-default gnus-init-file nil)
+
+(require 'gnus-load)
+
+(setq gnus-select-method `(nntp ,gnustest-nntp-server))
+
+
+(if (null (gnustest-ping-host gnustest-nntp-server))
+    (message "***** Skipping tests: Gmane doesn't seem to be available.")
+  ;; Server seems to be available, so start Gnus.
+  (message "***** Firing up Gnus; connecting to Gmane.")
+  (gnus)
+
+  (ert-deftest gnustest-nntp-run-simple-test ()
+    "Test Gnus with gmane.discuss."
+    (set-buffer gnus-group-buffer)
+    (gnus-group-jump-to-group "gmane.discuss")
+    (gnus-group-get-new-news-this-group 1)
+    (gnus-active "gmane.discuss")
+    (message "***** Reading active from gmane.discuss.")
+    (should (> (car (gnus-active "gmane.discuss")) 0))
+    (should (> (cdr (gnus-active "gmane.discuss")) 10000))
+    (gnus-group-unsubscribe-current-group)
+    (gnus-group-set-current-level 1 1)
+    (gnus-group-select-group 5)
+    (message "***** Getting article with certain MID and check subject.")
+    (set-buffer gnus-summary-buffer)
+    (gnus-summary-refer-article "[email protected]")
+    (should (string= (gnus-summary-article-subject) "Re: gwene idea: strip from from subject if present"))
+    (gnus-summary-exit)
+    (message "***** Quitting Gnus.")
+    (set-buffer gnus-group-buffer)
+    (gnus-group-save-newsrc)
+    (gnus-group-exit))
+)

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/tests/gnustest-nntp.el |   94 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 94 insertions(+), 0 deletions(-)
 create mode 100644 lisp/tests/gnustest-nntp.el

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.