--- /dev/null
+;;; tests/eshell-tests.el --- Eshell test suite
+
+;; Copyright (C) 1999-2017 Free Software Foundation, Inc.
+
+;; Author: John Wiegley <johnw@gnu.org>
+
+;; 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 <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Eshell test suite.
+
+;;; Code:
+
+(require 'ert)
+(require 'eshell)
+
+(defmacro with-temp-eshell (&rest body)
+ "Evaluate BODY in a temporary Eshell buffer."
+ `(let* ((eshell-directory-name (make-temp-file "eshell" t))
+ (eshell-history-file-name nil)
+ (eshell-buffer (eshell t)))
+ (unwind-protect
+ (with-current-buffer eshell-buffer
+ ,@body)
+ (let (kill-buffer-query-functions)
+ (kill-buffer eshell-buffer)
+ (delete-directory eshell-directory-name t)))))
+
+(defun eshell-insert-command (text &optional func)
+ "Insert a command at the end of the buffer."
+ (goto-char eshell-last-output-end)
+ (insert-and-inherit text)
+ (funcall (or func 'eshell-send-input)))
+
+(defun eshell-match-result (regexp)
+ "Check that text after `eshell-last-input-end' matches REGEXP."
+ (goto-char eshell-last-input-end)
+ (should (string-match-p regexp (buffer-substring-no-properties
+ (point) (point-max)))))
+
+(defun eshell-command-result-p (text regexp &optional func)
+ "Insert a command at the end of the buffer."
+ (eshell-insert-command text func)
+ (eshell-match-result regexp))
+
+(defun eshell-test-command-result (command)
+ "Like `eshell-command-result', but not using HOME."
+ (let ((eshell-directory-name (make-temp-file "eshell" t))
+ (eshell-history-file-name nil))
+ (unwind-protect
+ (eshell-command-result command)
+ (delete-directory eshell-directory-name t))))
+
+;;; Tests:
+
+(ert-deftest eshell-test/simple-command-result ()
+ "Test `eshell-command-result' with a simple command."
+ (should (equal (eshell-test-command-result "+ 1 2") 3)))
+
+(ert-deftest eshell-test/lisp-command ()
+ "Test `eshell-command-result' with an elisp command."
+ (should (equal (eshell-test-command-result "(+ 1 2)") 3)))
+
+(ert-deftest eshell-test/for-loop ()
+ "Test `eshell-command-result' with a for loop.."
+ (let ((process-environment (cons "foo" process-environment)))
+ (should (equal (eshell-test-command-result
+ "for foo in 5 { echo $foo }") 5))))
+
+(ert-deftest eshell-test/for-name-loop () ;Bug#15231
+ "Test `eshell-command-result' with a for loop using `name'."
+ (let ((process-environment (cons "name" process-environment)))
+ (should (equal (eshell-test-command-result
+ "for name in 3 { echo $name }") 3))))
+
+(ert-deftest eshell-test/for-name-shadow-loop () ; bug#15372
+ "Test `eshell-command-result' with a for loop using an env-var."
+ (let ((process-environment (cons "name=env-value" process-environment)))
+ (with-temp-eshell
+ (eshell-command-result-p "echo $name; for name in 3 { echo $name }; echo $name"
+ "env-value\n3\nenv-value\n"))))
+
+(ert-deftest eshell-test/lisp-command-args ()
+ "Test `eshell-command-result' with elisp and trailing args.
+Test that trailing arguments outside the S-expression are
+ignored. e.g. \"(+ 1 2) 3\" => 3"
+ (should (equal (eshell-test-command-result "(+ 1 2) 3") 3)))
+
+(ert-deftest eshell-test/subcommand ()
+ "Test `eshell-command-result' with a simple subcommand."
+ (should (equal (eshell-test-command-result "{+ 1 2}") 3)))
+
+(ert-deftest eshell-test/subcommand-args ()
+ "Test `eshell-command-result' with a subcommand and trailing args.
+Test that trailing arguments outside the subcommand are ignored.
+e.g. \"{+ 1 2} 3\" => 3"
+ (should (equal (eshell-test-command-result "{+ 1 2} 3") 3)))
+
+(ert-deftest eshell-test/subcommand-lisp ()
+ "Test `eshell-command-result' with an elisp subcommand and trailing args.
+Test that trailing arguments outside the subcommand are ignored.
+e.g. \"{(+ 1 2)} 3\" => 3"
+ (should (equal (eshell-test-command-result "{(+ 1 2)} 3") 3)))
+
+(ert-deftest eshell-test/interp-cmd ()
+ "Interpolate command result"
+ (should (equal (eshell-test-command-result "+ ${+ 1 2} 3") 6)))
+
+(ert-deftest eshell-test/interp-lisp ()
+ "Interpolate Lisp form evaluation"
+ (should (equal (eshell-test-command-result "+ $(+ 1 2) 3") 6)))
+
+(ert-deftest eshell-test/interp-concat ()
+ "Interpolate and concat command"
+ (should (equal (eshell-test-command-result "+ ${+ 1 2}3 3") 36)))
+
+(ert-deftest eshell-test/interp-concat-lisp ()
+ "Interpolate and concat Lisp form"
+ (should (equal (eshell-test-command-result "+ $(+ 1 2)3 3") 36)))
+
+(ert-deftest eshell-test/interp-concat2 ()
+ "Interpolate and concat two commands"
+ (should (equal (eshell-test-command-result "+ ${+ 1 2}${+ 1 2} 3") 36)))
+
+(ert-deftest eshell-test/interp-concat-lisp2 ()
+ "Interpolate and concat two Lisp forms"
+ (should (equal (eshell-test-command-result "+ $(+ 1 2)$(+ 1 2) 3") 36)))
+
+(ert-deftest eshell-test/window-height ()
+ "$LINES should equal (window-height)"
+ (should (eshell-test-command-result "= $LINES (window-height)")))
+
+(ert-deftest eshell-test/window-width ()
+ "$COLUMNS should equal (window-width)"
+ (should (eshell-test-command-result "= $COLUMNS (window-width)")))
+
+(ert-deftest eshell-test/last-result-var ()
+ "Test using the \"last result\" ($$) variable"
+ (with-temp-eshell
+ (eshell-command-result-p "+ 1 2; + $$ 2"
+ "3\n5\n")))
+
+(ert-deftest eshell-test/last-result-var2 ()
+ "Test using the \"last result\" ($$) variable twice"
+ (with-temp-eshell
+ (eshell-command-result-p "+ 1 2; + $$ $$"
+ "3\n6\n")))
+
+(ert-deftest eshell-test/last-arg-var ()
+ "Test using the \"last arg\" ($_) variable"
+ (with-temp-eshell
+ (eshell-command-result-p "+ 1 2; + $_ 4"
+ "3\n6\n")))
+
+(ert-deftest eshell-test/escape-nonspecial ()
+ "Test that \"\\c\" and \"c\" are equivalent when \"c\" is not a
+special character."
+ (with-temp-eshell
+ (eshell-command-result-p "echo he\\llo"
+ "hello\n")))
+
+(ert-deftest eshell-test/escape-nonspecial-unicode ()
+ "Test that \"\\c\" and \"c\" are equivalent when \"c\" is a
+unicode character (unicode characters are nonspecial by
+definition)."
+ (with-temp-eshell
+ (eshell-command-result-p "echo Vid\\éos"
+ "Vidéos\n")))
+
+(ert-deftest eshell-test/escape-nonspecial-quoted ()
+ "Test that the backslash is preserved for escaped nonspecial
+chars"
+ (with-temp-eshell
+ (eshell-command-result-p "echo \"h\\i\""
+ ;; Backslashes are doubled for regexp.
+ "h\\\\i\n")))
+
+(ert-deftest eshell-test/escape-special-quoted ()
+ "Test that the backslash is not preserved for escaped special
+chars"
+ (with-temp-eshell
+ (eshell-command-result-p "echo \"h\\\\i\""
+ ;; Backslashes are doubled for regexp.
+ "h\\\\i\n")))
+
+(ert-deftest eshell-test/command-running-p ()
+ "Modeline should show no command running"
+ (with-temp-eshell
+ (let ((eshell-status-in-mode-line t))
+ (should (memq 'eshell-command-running-string mode-line-format))
+ (should (equal eshell-command-running-string "--")))))
+
+(ert-deftest eshell-test/forward-arg ()
+ "Test moving across command arguments"
+ (with-temp-eshell
+ (eshell-insert-command "echo $(+ 1 (- 4 3)) \"alpha beta\" file" 'ignore)
+ (let ((here (point)) begin valid)
+ (eshell-bol)
+ (setq begin (point))
+ (eshell-forward-argument 4)
+ (setq valid (= here (point)))
+ (eshell-backward-argument 4)
+ (prog1
+ (and valid (= begin (point)))
+ (eshell-bol)
+ (delete-region (point) (point-max))))))
+
+(ert-deftest eshell-test/queue-input ()
+ "Test queuing command input"
+ (with-temp-eshell
+ (eshell-insert-command "sleep 2")
+ (eshell-insert-command "echo alpha" 'eshell-queue-input)
+ (let ((count 10))
+ (while (and eshell-current-command
+ (> count 0))
+ (sit-for 1)
+ (setq count (1- count))))
+ (eshell-match-result "alpha\n")))
+
+(ert-deftest eshell-test/flush-output ()
+ "Test flushing of previous output"
+ (with-temp-eshell
+ (eshell-insert-command "echo alpha")
+ (eshell-kill-output)
+ (eshell-match-result (regexp-quote "*** output flushed ***\n"))
+ (should (forward-line))
+ (should (= (point) eshell-last-output-start))))
+
+(ert-deftest eshell-test/run-old-command ()
+ "Re-run an old command"
+ (with-temp-eshell
+ (eshell-insert-command "echo alpha")
+ (goto-char eshell-last-input-start)
+ (string= (eshell-get-old-input) "echo alpha")))
+
+(provide 'esh-test)
+
+;;; tests/eshell-tests.el ends here
+++ /dev/null
-;;; tests/eshell.el --- Eshell test suite
-
-;; Copyright (C) 1999-2017 Free Software Foundation, Inc.
-
-;; Author: John Wiegley <johnw@gnu.org>
-
-;; 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 <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;; Eshell test suite.
-
-;;; Code:
-
-(require 'ert)
-(require 'eshell)
-
-(defmacro with-temp-eshell (&rest body)
- "Evaluate BODY in a temporary Eshell buffer."
- `(let* ((eshell-directory-name (make-temp-file "eshell" t))
- (eshell-history-file-name nil)
- (eshell-buffer (eshell t)))
- (unwind-protect
- (with-current-buffer eshell-buffer
- ,@body)
- (let (kill-buffer-query-functions)
- (kill-buffer eshell-buffer)
- (delete-directory eshell-directory-name t)))))
-
-(defun eshell-insert-command (text &optional func)
- "Insert a command at the end of the buffer."
- (goto-char eshell-last-output-end)
- (insert-and-inherit text)
- (funcall (or func 'eshell-send-input)))
-
-(defun eshell-match-result (regexp)
- "Check that text after `eshell-last-input-end' matches REGEXP."
- (goto-char eshell-last-input-end)
- (should (string-match-p regexp (buffer-substring-no-properties
- (point) (point-max)))))
-
-(defun eshell-command-result-p (text regexp &optional func)
- "Insert a command at the end of the buffer."
- (eshell-insert-command text func)
- (eshell-match-result regexp))
-
-(defun eshell-test-command-result (command)
- "Like `eshell-command-result', but not using HOME."
- (let ((eshell-directory-name (make-temp-file "eshell" t))
- (eshell-history-file-name nil))
- (unwind-protect
- (eshell-command-result command)
- (delete-directory eshell-directory-name t))))
-
-;;; Tests:
-
-(ert-deftest eshell-test/simple-command-result ()
- "Test `eshell-command-result' with a simple command."
- (should (equal (eshell-test-command-result "+ 1 2") 3)))
-
-(ert-deftest eshell-test/lisp-command ()
- "Test `eshell-command-result' with an elisp command."
- (should (equal (eshell-test-command-result "(+ 1 2)") 3)))
-
-(ert-deftest eshell-test/for-loop ()
- "Test `eshell-command-result' with a for loop.."
- (let ((process-environment (cons "foo" process-environment)))
- (should (equal (eshell-test-command-result
- "for foo in 5 { echo $foo }") 5))))
-
-(ert-deftest eshell-test/for-name-loop () ;Bug#15231
- "Test `eshell-command-result' with a for loop using `name'."
- (let ((process-environment (cons "name" process-environment)))
- (should (equal (eshell-test-command-result
- "for name in 3 { echo $name }") 3))))
-
-(ert-deftest eshell-test/for-name-shadow-loop () ; bug#15372
- "Test `eshell-command-result' with a for loop using an env-var."
- (let ((process-environment (cons "name=env-value" process-environment)))
- (with-temp-eshell
- (eshell-command-result-p "echo $name; for name in 3 { echo $name }; echo $name"
- "env-value\n3\nenv-value\n"))))
-
-(ert-deftest eshell-test/lisp-command-args ()
- "Test `eshell-command-result' with elisp and trailing args.
-Test that trailing arguments outside the S-expression are
-ignored. e.g. \"(+ 1 2) 3\" => 3"
- (should (equal (eshell-test-command-result "(+ 1 2) 3") 3)))
-
-(ert-deftest eshell-test/subcommand ()
- "Test `eshell-command-result' with a simple subcommand."
- (should (equal (eshell-test-command-result "{+ 1 2}") 3)))
-
-(ert-deftest eshell-test/subcommand-args ()
- "Test `eshell-command-result' with a subcommand and trailing args.
-Test that trailing arguments outside the subcommand are ignored.
-e.g. \"{+ 1 2} 3\" => 3"
- (should (equal (eshell-test-command-result "{+ 1 2} 3") 3)))
-
-(ert-deftest eshell-test/subcommand-lisp ()
- "Test `eshell-command-result' with an elisp subcommand and trailing args.
-Test that trailing arguments outside the subcommand are ignored.
-e.g. \"{(+ 1 2)} 3\" => 3"
- (should (equal (eshell-test-command-result "{(+ 1 2)} 3") 3)))
-
-(ert-deftest eshell-test/interp-cmd ()
- "Interpolate command result"
- (should (equal (eshell-test-command-result "+ ${+ 1 2} 3") 6)))
-
-(ert-deftest eshell-test/interp-lisp ()
- "Interpolate Lisp form evaluation"
- (should (equal (eshell-test-command-result "+ $(+ 1 2) 3") 6)))
-
-(ert-deftest eshell-test/interp-concat ()
- "Interpolate and concat command"
- (should (equal (eshell-test-command-result "+ ${+ 1 2}3 3") 36)))
-
-(ert-deftest eshell-test/interp-concat-lisp ()
- "Interpolate and concat Lisp form"
- (should (equal (eshell-test-command-result "+ $(+ 1 2)3 3") 36)))
-
-(ert-deftest eshell-test/interp-concat2 ()
- "Interpolate and concat two commands"
- (should (equal (eshell-test-command-result "+ ${+ 1 2}${+ 1 2} 3") 36)))
-
-(ert-deftest eshell-test/interp-concat-lisp2 ()
- "Interpolate and concat two Lisp forms"
- (should (equal (eshell-test-command-result "+ $(+ 1 2)$(+ 1 2) 3") 36)))
-
-(ert-deftest eshell-test/window-height ()
- "$LINES should equal (window-height)"
- (should (eshell-test-command-result "= $LINES (window-height)")))
-
-(ert-deftest eshell-test/window-width ()
- "$COLUMNS should equal (window-width)"
- (should (eshell-test-command-result "= $COLUMNS (window-width)")))
-
-(ert-deftest eshell-test/last-result-var ()
- "Test using the \"last result\" ($$) variable"
- (with-temp-eshell
- (eshell-command-result-p "+ 1 2; + $$ 2"
- "3\n5\n")))
-
-(ert-deftest eshell-test/last-result-var2 ()
- "Test using the \"last result\" ($$) variable twice"
- (with-temp-eshell
- (eshell-command-result-p "+ 1 2; + $$ $$"
- "3\n6\n")))
-
-(ert-deftest eshell-test/last-arg-var ()
- "Test using the \"last arg\" ($_) variable"
- (with-temp-eshell
- (eshell-command-result-p "+ 1 2; + $_ 4"
- "3\n6\n")))
-
-(ert-deftest eshell-test/escape-nonspecial ()
- "Test that \"\\c\" and \"c\" are equivalent when \"c\" is not a
-special character."
- (with-temp-eshell
- (eshell-command-result-p "echo he\\llo"
- "hello\n")))
-
-(ert-deftest eshell-test/escape-nonspecial-unicode ()
- "Test that \"\\c\" and \"c\" are equivalent when \"c\" is a
-unicode character (unicode characters are nonspecial by
-definition)."
- (with-temp-eshell
- (eshell-command-result-p "echo Vid\\éos"
- "Vidéos\n")))
-
-(ert-deftest eshell-test/escape-nonspecial-quoted ()
- "Test that the backslash is preserved for escaped nonspecial
-chars"
- (with-temp-eshell
- (eshell-command-result-p "echo \"h\\i\""
- ;; Backslashes are doubled for regexp.
- "h\\\\i\n")))
-
-(ert-deftest eshell-test/escape-special-quoted ()
- "Test that the backslash is not preserved for escaped special
-chars"
- (with-temp-eshell
- (eshell-command-result-p "echo \"h\\\\i\""
- ;; Backslashes are doubled for regexp.
- "h\\\\i\n")))
-
-(ert-deftest eshell-test/command-running-p ()
- "Modeline should show no command running"
- (with-temp-eshell
- (let ((eshell-status-in-mode-line t))
- (should (memq 'eshell-command-running-string mode-line-format))
- (should (equal eshell-command-running-string "--")))))
-
-(ert-deftest eshell-test/forward-arg ()
- "Test moving across command arguments"
- (with-temp-eshell
- (eshell-insert-command "echo $(+ 1 (- 4 3)) \"alpha beta\" file" 'ignore)
- (let ((here (point)) begin valid)
- (eshell-bol)
- (setq begin (point))
- (eshell-forward-argument 4)
- (setq valid (= here (point)))
- (eshell-backward-argument 4)
- (prog1
- (and valid (= begin (point)))
- (eshell-bol)
- (delete-region (point) (point-max))))))
-
-(ert-deftest eshell-test/queue-input ()
- "Test queuing command input"
- (with-temp-eshell
- (eshell-insert-command "sleep 2")
- (eshell-insert-command "echo alpha" 'eshell-queue-input)
- (let ((count 10))
- (while (and eshell-current-command
- (> count 0))
- (sit-for 1)
- (setq count (1- count))))
- (eshell-match-result "alpha\n")))
-
-(ert-deftest eshell-test/flush-output ()
- "Test flushing of previous output"
- (with-temp-eshell
- (eshell-insert-command "echo alpha")
- (eshell-kill-output)
- (eshell-match-result (regexp-quote "*** output flushed ***\n"))
- (should (forward-line))
- (should (= (point) eshell-last-output-start))))
-
-(ert-deftest eshell-test/run-old-command ()
- "Re-run an old command"
- (with-temp-eshell
- (eshell-insert-command "echo alpha")
- (goto-char eshell-last-input-start)
- (string= (eshell-get-old-input) "echo alpha")))
-
-(provide 'esh-test)
-
-;;; tests/eshell.el ends here
--- /dev/null
+;;; puny-tests.el --- tests for net/puny.el -*- coding: utf-8; -*-
+
+;; Copyright (C) 2017 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 <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'ert)
+(require 'puny)
+
+(ert-deftest puny-test-encode ()
+ "Test puny encoding."
+ (should (string= (puny-encode-string "bücher") "xn--bcher-kva")))
+
+(ert-deftest puny-test-decode ()
+ "Test puny decoding."
+ (should (string= (puny-decode-string "xn--bcher-kva") "bücher")))
+
+(ert-deftest puny-test-encode2 ()
+ "Test puny encoding."
+ (should (string= (puny-encode-string "חנוך") "xn--9dbdkw")))
+
+(ert-deftest puny-test-decode2 ()
+ "Test puny decoding."
+ (should (string= (puny-decode-string "xn--9dbdkw") "חנוך")))
+
+;;; puny-tests.el ends here
+++ /dev/null
-;;; puny.el --- tests for net/puny.el -*- coding: utf-8; -*-
-
-;; Copyright (C) 2017 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 <http://www.gnu.org/licenses/>.
-
-;;; Code:
-
-(require 'ert)
-(require 'puny)
-
-(ert-deftest puny-test-encode ()
- "Test puny encoding."
- (should (string= (puny-encode-string "bücher") "xn--bcher-kva")))
-
-(ert-deftest puny-test-decode ()
- "Test puny decoding."
- (should (string= (puny-decode-string "xn--bcher-kva") "bücher")))
-
-(ert-deftest puny-test-encode2 ()
- "Test puny encoding."
- (should (string= (puny-encode-string "חנוך") "xn--9dbdkw")))
-
-(ert-deftest puny-test-decode2 ()
- "Test puny decoding."
- (should (string= (puny-decode-string "xn--9dbdkw") "חנוך")))
-
-;;; puny.el ends here
--- /dev/null
+;;; f90-tests.el --- tests for progmodes/f90.el
+
+;; Copyright (C) 2011-2017 Free Software Foundation, Inc.
+
+;; Author: Glenn Morris <rgm@gnu.org>
+
+;; 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 <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This file does not have "test" in the name, because it lives under
+;; a test/ directory, so that would be superfluous.
+
+;;; Code:
+
+(require 'ert)
+(require 'f90)
+
+(defconst f90-test-indent "\
+!! Comment before code.
+!!! Comments before code.
+#preprocessor before code
+
+program progname
+
+ implicit none
+
+ integer :: i
+
+ !! Comment.
+
+ do i = 1, 10
+
+#preprocessor
+
+ !! Comment.
+ if ( i % 2 == 0 ) then
+ !! Comment.
+ cycle
+ else
+ write(*,*) i
+ end if
+ end do
+
+!!! Comment.
+
+end program progname
+"
+ "Test string for F90 indentation.")
+
+(ert-deftest f90-test-indent ()
+ "Test F90 indentation."
+ (with-temp-buffer
+ (f90-mode)
+ (insert f90-test-indent)
+ (indent-rigidly (point-min) (point-max) -999)
+ (f90-indent-region (point-min) (point-max))
+ (should (string-equal (buffer-string) f90-test-indent))))
+
+(ert-deftest f90-test-bug3729 ()
+ "Test for http://debbugs.gnu.org/3729 ."
+ :expected-result :failed
+ (with-temp-buffer
+ (f90-mode)
+ (insert "!! Comment
+
+include \"file.f90\"
+
+subroutine test (x)
+ real x
+ x = x+1.
+ return
+end subroutine test")
+ (goto-char (point-min))
+ (forward-line 2)
+ (f90-indent-subprogram)
+ (should (= 0 (current-indentation)))))
+
+(ert-deftest f90-test-bug3730 ()
+ "Test for http://debbugs.gnu.org/3730 ."
+ (with-temp-buffer
+ (f90-mode)
+ (insert "a" )
+ (move-to-column 68 t)
+ (insert "(/ x /)")
+ (f90-do-auto-fill)
+ (beginning-of-line)
+ (skip-chars-forward "[ \t]")
+ (should (equal "&(/" (buffer-substring (point) (+ 3 (point)))))))
+
+;; TODO bug#5593
+
+(ert-deftest f90-test-bug8691 ()
+ "Test for http://debbugs.gnu.org/8691 ."
+ (with-temp-buffer
+ (f90-mode)
+ (insert "module modname
+type, bind(c) :: type1
+integer :: part1
+end type type1
+end module modname")
+ (f90-indent-subprogram)
+ (forward-line -1)
+ (should (= 2 (current-indentation)))))
+
+;; TODO bug#8812
+
+(ert-deftest f90-test-bug8820 ()
+ "Test for http://debbugs.gnu.org/8820 ."
+ (with-temp-buffer
+ (f90-mode)
+ (should (eq (char-syntax ?%) (string-to-char ".")))))
+
+(ert-deftest f90-test-bug9553a ()
+ "Test for http://debbugs.gnu.org/9553 ."
+ (with-temp-buffer
+ (f90-mode)
+ (insert "!!!")
+ (dotimes (_i 20) (insert " aaaa"))
+ (f90-do-auto-fill)
+ (beginning-of-line)
+ ;; This gives a more informative failure than looking-at.
+ (should (equal "!!! a" (buffer-substring (point) (+ 5 (point)))))))
+
+(ert-deftest f90-test-bug9553b ()
+ "Test for http://debbugs.gnu.org/9553 ."
+ (with-temp-buffer
+ (f90-mode)
+ (insert "!!!")
+ (dotimes (_i 13) (insert " aaaa"))
+ (insert "a, aaaa")
+ (f90-do-auto-fill)
+ (beginning-of-line)
+ (should (equal "!!! a" (buffer-substring (point) (+ 5 (point)))))))
+
+(ert-deftest f90-test-bug9690 ()
+ "Test for http://debbugs.gnu.org/9690 ."
+ (with-temp-buffer
+ (f90-mode)
+ (insert "#include \"foo.h\"")
+ (f90-indent-line)
+ (should (= 0 (current-indentation)))))
+
+(ert-deftest f90-test-bug13138 ()
+ "Test for http://debbugs.gnu.org/13138 ."
+ (with-temp-buffer
+ (f90-mode)
+ (insert "program prog
+ integer :: i = &
+#ifdef foo
+ & 1
+#else
+ & 2
+#endif
+
+ write(*,*) i
+end program prog")
+ (goto-char (point-min))
+ (forward-line 2)
+ (f90-indent-subprogram)
+ (should (= 0 (current-indentation)))))
+
+(ert-deftest f90-test-bug-19809 ()
+ "Test for http://debbugs.gnu.org/19809 ."
+ (with-temp-buffer
+ (f90-mode)
+ ;; The Fortran standard says that continued strings should have
+ ;; '&' at the start of continuation lines, but it seems gfortran
+ ;; allows them to be absent (albeit with a warning).
+ (insert "program prog
+ write (*,*), '&
+end program prog'
+end program prog")
+ (goto-char (point-min))
+ (f90-end-of-subprogram)
+ (should (= (point) (point-max)))))
+
+(ert-deftest f90-test-bug20680 ()
+ "Test for http://debbugs.gnu.org/20680 ."
+ (with-temp-buffer
+ (f90-mode)
+ (insert "module modname
+type, extends ( sometype ) :: type1
+integer :: part1
+end type type1
+end module modname")
+ (f90-indent-subprogram)
+ (forward-line -1)
+ (should (= 2 (current-indentation)))))
+
+(ert-deftest f90-test-bug20680b ()
+ "Test for http://debbugs.gnu.org/20680 ."
+ (with-temp-buffer
+ (f90-mode)
+ (insert "module modname
+enum, bind(c)
+enumerator :: e1 = 0
+end enum
+end module modname")
+ (f90-indent-subprogram)
+ (forward-line -1)
+ (should (= 2 (current-indentation)))))
+
+(ert-deftest f90-test-bug20969 ()
+ "Test for http://debbugs.gnu.org/20969 ."
+ (with-temp-buffer
+ (f90-mode)
+ (insert "module modname
+type, extends ( sometype ), private :: type1
+integer :: part1
+end type type1
+end module modname")
+ (f90-indent-subprogram)
+ (forward-line -1)
+ (should (= 2 (current-indentation)))))
+
+(ert-deftest f90-test-bug20969b ()
+ "Test for http://debbugs.gnu.org/20969 ."
+ (with-temp-buffer
+ (f90-mode)
+ (insert "module modname
+type, private, extends ( sometype ) :: type1
+integer :: part1
+end type type1
+end module modname")
+ (f90-indent-subprogram)
+ (forward-line -1)
+ (should (= 2 (current-indentation)))))
+
+(ert-deftest f90-test-bug21794 ()
+ "Test for http://debbugs.gnu.org/21794 ."
+ (with-temp-buffer
+ (f90-mode)
+ (insert "program prog
+do i=1,10
+associate (x => xa(i), y => ya(i))
+a(x,y,i) = fun(x,y,i)
+end associate
+end do
+end program prog")
+ (f90-indent-subprogram)
+ (forward-line -2)
+ (should (= 5 (current-indentation)))))
+
+(ert-deftest f90-test-bug25039 ()
+ "Test for http://debbugs.gnu.org/25039 ."
+ (with-temp-buffer
+ (f90-mode)
+ (insert "program prog
+select type (a)
+class is (c1)
+x = 1
+type is (t1)
+x = 2
+end select
+end program prog")
+ (f90-indent-subprogram)
+ (forward-line -3)
+ (should (= 2 (current-indentation))) ; type is
+ (forward-line -2)
+ (should (= 2 (current-indentation))))) ; class is
+
+;;; f90-tests.el ends here
+++ /dev/null
-;;; f90.el --- tests for progmodes/f90.el
-
-;; Copyright (C) 2011-2017 Free Software Foundation, Inc.
-
-;; Author: Glenn Morris <rgm@gnu.org>
-
-;; 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 <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;; This file does not have "test" in the name, because it lives under
-;; a test/ directory, so that would be superfluous.
-
-;;; Code:
-
-(require 'ert)
-(require 'f90)
-
-(defconst f90-test-indent "\
-!! Comment before code.
-!!! Comments before code.
-#preprocessor before code
-
-program progname
-
- implicit none
-
- integer :: i
-
- !! Comment.
-
- do i = 1, 10
-
-#preprocessor
-
- !! Comment.
- if ( i % 2 == 0 ) then
- !! Comment.
- cycle
- else
- write(*,*) i
- end if
- end do
-
-!!! Comment.
-
-end program progname
-"
- "Test string for F90 indentation.")
-
-(ert-deftest f90-test-indent ()
- "Test F90 indentation."
- (with-temp-buffer
- (f90-mode)
- (insert f90-test-indent)
- (indent-rigidly (point-min) (point-max) -999)
- (f90-indent-region (point-min) (point-max))
- (should (string-equal (buffer-string) f90-test-indent))))
-
-(ert-deftest f90-test-bug3729 ()
- "Test for http://debbugs.gnu.org/3729 ."
- :expected-result :failed
- (with-temp-buffer
- (f90-mode)
- (insert "!! Comment
-
-include \"file.f90\"
-
-subroutine test (x)
- real x
- x = x+1.
- return
-end subroutine test")
- (goto-char (point-min))
- (forward-line 2)
- (f90-indent-subprogram)
- (should (= 0 (current-indentation)))))
-
-(ert-deftest f90-test-bug3730 ()
- "Test for http://debbugs.gnu.org/3730 ."
- (with-temp-buffer
- (f90-mode)
- (insert "a" )
- (move-to-column 68 t)
- (insert "(/ x /)")
- (f90-do-auto-fill)
- (beginning-of-line)
- (skip-chars-forward "[ \t]")
- (should (equal "&(/" (buffer-substring (point) (+ 3 (point)))))))
-
-;; TODO bug#5593
-
-(ert-deftest f90-test-bug8691 ()
- "Test for http://debbugs.gnu.org/8691 ."
- (with-temp-buffer
- (f90-mode)
- (insert "module modname
-type, bind(c) :: type1
-integer :: part1
-end type type1
-end module modname")
- (f90-indent-subprogram)
- (forward-line -1)
- (should (= 2 (current-indentation)))))
-
-;; TODO bug#8812
-
-(ert-deftest f90-test-bug8820 ()
- "Test for http://debbugs.gnu.org/8820 ."
- (with-temp-buffer
- (f90-mode)
- (should (eq (char-syntax ?%) (string-to-char ".")))))
-
-(ert-deftest f90-test-bug9553a ()
- "Test for http://debbugs.gnu.org/9553 ."
- (with-temp-buffer
- (f90-mode)
- (insert "!!!")
- (dotimes (_i 20) (insert " aaaa"))
- (f90-do-auto-fill)
- (beginning-of-line)
- ;; This gives a more informative failure than looking-at.
- (should (equal "!!! a" (buffer-substring (point) (+ 5 (point)))))))
-
-(ert-deftest f90-test-bug9553b ()
- "Test for http://debbugs.gnu.org/9553 ."
- (with-temp-buffer
- (f90-mode)
- (insert "!!!")
- (dotimes (_i 13) (insert " aaaa"))
- (insert "a, aaaa")
- (f90-do-auto-fill)
- (beginning-of-line)
- (should (equal "!!! a" (buffer-substring (point) (+ 5 (point)))))))
-
-(ert-deftest f90-test-bug9690 ()
- "Test for http://debbugs.gnu.org/9690 ."
- (with-temp-buffer
- (f90-mode)
- (insert "#include \"foo.h\"")
- (f90-indent-line)
- (should (= 0 (current-indentation)))))
-
-(ert-deftest f90-test-bug13138 ()
- "Test for http://debbugs.gnu.org/13138 ."
- (with-temp-buffer
- (f90-mode)
- (insert "program prog
- integer :: i = &
-#ifdef foo
- & 1
-#else
- & 2
-#endif
-
- write(*,*) i
-end program prog")
- (goto-char (point-min))
- (forward-line 2)
- (f90-indent-subprogram)
- (should (= 0 (current-indentation)))))
-
-(ert-deftest f90-test-bug-19809 ()
- "Test for http://debbugs.gnu.org/19809 ."
- (with-temp-buffer
- (f90-mode)
- ;; The Fortran standard says that continued strings should have
- ;; '&' at the start of continuation lines, but it seems gfortran
- ;; allows them to be absent (albeit with a warning).
- (insert "program prog
- write (*,*), '&
-end program prog'
-end program prog")
- (goto-char (point-min))
- (f90-end-of-subprogram)
- (should (= (point) (point-max)))))
-
-(ert-deftest f90-test-bug20680 ()
- "Test for http://debbugs.gnu.org/20680 ."
- (with-temp-buffer
- (f90-mode)
- (insert "module modname
-type, extends ( sometype ) :: type1
-integer :: part1
-end type type1
-end module modname")
- (f90-indent-subprogram)
- (forward-line -1)
- (should (= 2 (current-indentation)))))
-
-(ert-deftest f90-test-bug20680b ()
- "Test for http://debbugs.gnu.org/20680 ."
- (with-temp-buffer
- (f90-mode)
- (insert "module modname
-enum, bind(c)
-enumerator :: e1 = 0
-end enum
-end module modname")
- (f90-indent-subprogram)
- (forward-line -1)
- (should (= 2 (current-indentation)))))
-
-(ert-deftest f90-test-bug20969 ()
- "Test for http://debbugs.gnu.org/20969 ."
- (with-temp-buffer
- (f90-mode)
- (insert "module modname
-type, extends ( sometype ), private :: type1
-integer :: part1
-end type type1
-end module modname")
- (f90-indent-subprogram)
- (forward-line -1)
- (should (= 2 (current-indentation)))))
-
-(ert-deftest f90-test-bug20969b ()
- "Test for http://debbugs.gnu.org/20969 ."
- (with-temp-buffer
- (f90-mode)
- (insert "module modname
-type, private, extends ( sometype ) :: type1
-integer :: part1
-end type type1
-end module modname")
- (f90-indent-subprogram)
- (forward-line -1)
- (should (= 2 (current-indentation)))))
-
-(ert-deftest f90-test-bug21794 ()
- "Test for http://debbugs.gnu.org/21794 ."
- (with-temp-buffer
- (f90-mode)
- (insert "program prog
-do i=1,10
-associate (x => xa(i), y => ya(i))
-a(x,y,i) = fun(x,y,i)
-end associate
-end do
-end program prog")
- (f90-indent-subprogram)
- (forward-line -2)
- (should (= 5 (current-indentation)))))
-
-(ert-deftest f90-test-bug25039 ()
- "Test for http://debbugs.gnu.org/25039 ."
- (with-temp-buffer
- (f90-mode)
- (insert "program prog
-select type (a)
-class is (c1)
-x = 1
-type is (t1)
-x = 2
-end select
-end program prog")
- (f90-indent-subprogram)
- (forward-line -3)
- (should (= 2 (current-indentation))) ; type is
- (forward-line -2)
- (should (= 2 (current-indentation))))) ; class is
-
-;;; f90.el ends here
--- /dev/null
+;;; vc-hg-tests.el --- tests for vc/vc-hg.el
+
+;; Copyright (C) 2016-2017 Free Software Foundation, Inc.
+
+;; Author: Dmitry Gutov <dgutov@yandex.ru>
+;; Maintainer: emacs-devel@gnu.org
+
+;; 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 <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'vc-hg)
+(require 'vc-annotate)
+
+(ert-deftest vc-hg-annotate-extract-revision-at-line-with-filename ()
+ ;; with filename
+ (with-temp-buffer
+ (save-excursion (insert "215 2007-06-20 CONTENTS:"))
+ (should (equal (vc-hg-annotate-extract-revision-at-line)
+ (cons
+ "215"
+ (expand-file-name "CONTENTS"))))))
+
+(ert-deftest vc-hg-annotate-extract-revision-at-line-with-user ()
+ (with-temp-buffer
+ (save-excursion (insert " gerv 107217 2012-09-17:"))
+ (should (equal (vc-hg-annotate-extract-revision-at-line)
+ "107217"))))
+
+(ert-deftest vc-hg-annotate-extract-revision-at-line-with-both ()
+ (with-temp-buffer
+ (save-excursion (insert "philringnalda 218075 2014-11-28 CLOBBER:"))
+ (should (equal (vc-hg-annotate-extract-revision-at-line)
+ (cons
+ "218075"
+ (expand-file-name "CLOBBER"))))))
+
+(ert-deftest vc-hg-annotate-time ()
+ (with-temp-buffer
+ (save-excursion (insert "philringnalda 218075 2014-11-28 CLOBBER:"))
+ (should (floatp (vc-hg-annotate-time)))))
+
+;;; vc-hg-tests.el ends here
+++ /dev/null
-;;; vc-hg.el --- tests for vc/vc-hg.el
-
-;; Copyright (C) 2016-2017 Free Software Foundation, Inc.
-
-;; Author: Dmitry Gutov <dgutov@yandex.ru>
-;; Maintainer: emacs-devel@gnu.org
-
-;; 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 <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;;; Code:
-
-(require 'vc-hg)
-(require 'vc-annotate)
-
-(ert-deftest vc-hg-annotate-extract-revision-at-line-with-filename ()
- ;; with filename
- (with-temp-buffer
- (save-excursion (insert "215 2007-06-20 CONTENTS:"))
- (should (equal (vc-hg-annotate-extract-revision-at-line)
- (cons
- "215"
- (expand-file-name "CONTENTS"))))))
-
-(ert-deftest vc-hg-annotate-extract-revision-at-line-with-user ()
- (with-temp-buffer
- (save-excursion (insert " gerv 107217 2012-09-17:"))
- (should (equal (vc-hg-annotate-extract-revision-at-line)
- "107217"))))
-
-(ert-deftest vc-hg-annotate-extract-revision-at-line-with-both ()
- (with-temp-buffer
- (save-excursion (insert "philringnalda 218075 2014-11-28 CLOBBER:"))
- (should (equal (vc-hg-annotate-extract-revision-at-line)
- (cons
- "218075"
- (expand-file-name "CLOBBER"))))))
-
-(ert-deftest vc-hg-annotate-time ()
- (with-temp-buffer
- (save-excursion (insert "philringnalda 218075 2014-11-28 CLOBBER:"))
- (should (floatp (vc-hg-annotate-time)))))
-
-;;; vc-hg.el ends here